Skip to content

Commit

Permalink
cover real position was opposite. Old tradfri component confirmed this
Browse files Browse the repository at this point in the history
  • Loading branch information
slajob committed Mar 5, 2024
1 parent 2fc15e5 commit a11d513
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions custom_components/dirigera_platform/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,24 @@ def is_on(self):

@property
def current_cover_position(self):
return self._json_data.attributes.blinds_current_level
return 100 - self._json_data.attributes.blinds_current_level

@property
def target_cover_position(self):
return self._json_data.attributes.blinds_target_level
return 100 - self._json_data.attributes.blinds_target_level

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

@property
def is_closing(self):
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 != 0 and self.target_cover_position == 0:
return True

return False
Expand All @@ -104,7 +104,7 @@ def is_opening(self):
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 != 100 and self.target_cover_position == 100:
return True

return False
Expand All @@ -118,7 +118,7 @@ def close_cover(self, **kwargs):
def set_cover_position(self, **kwargs):
position = int(kwargs['position'])
if position >= 0 and position <= 100:
self._json_data.set_target_level(position)
self._json_data.set_target_level(100 - position)

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

0 comments on commit a11d513

Please sign in to comment.