Skip to content

Commit

Permalink
Merge pull request #11 from slajob/main
Browse files Browse the repository at this point in the history
Fix Covers  position and target level
  • Loading branch information
sanjoyg authored Mar 2, 2024
2 parents c81de08 + abc2c90 commit 1156f99
Showing 1 changed file with 10 additions and 10 deletions.
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

0 comments on commit 1156f99

Please sign in to comment.