Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Covers position and target level #11

Merged
merged 4 commits into from
Mar 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions custom_components/dirigera_platform/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,40 +85,40 @@ def target_cover_position(self):

@property
def is_closed(self):
if self.current_cover_position() is None:
if self.current_cover_position is None:
return False
return self.current_cover_position() == 100
return self.current_cover_position == 100

@property
def is_closing(self):
if self.current_cover_position() is None or self.target_cover_position() is False:
if self.current_cover_position is None or self.target_cover_position is False:
return False

if self.current_cover_position() != 100 and self.target_cover_position() == 100:
if self.current_cover_position != 100 and self.target_cover_position == 100:
return True

return False

@property
def is_opening(self):
if self.current_cover_position() is None or self.target_cover_position() is False:
if self.current_cover_position is None or self.target_cover_position is False:
return False

if self.current_cover_position() != 0 and self.target_cover_position() == 0:
if self.current_cover_position != 0 and self.target_cover_position == 0:
return True

return False

def open_cover(self, **kwargs):
self._json_data.set_target_position(0)
self._json_data.set_target_level(0)

def close_cover(self, **kwargs):
self._json_data.set_target_position(100)
self._json_data.set_target_level(100)

def set_cover_position(self, **kwargs):
position = int(kwargs[0])
position = int(kwargs['position'])
if position >= 0 and position <= 100:
self._json_data.set_target_position(position)
self._json_data.set_target_level(position)

def update(self):
logger.debug("cover update...")
Expand Down
Loading