Skip to content

Commit

Permalink
Update cover.py
Browse files Browse the repository at this point in the history
fixed TypeError: unsupported operand type(s) for -: 'int' and 'NoneType' error
  • Loading branch information
dinamitebla authored and gicamm committed Apr 23, 2024
1 parent 89ab6ec commit 50f3897
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions custom_components/comelit/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ def is_closing(self):

@property
def current_cover_position(self): # -> int | None:
return 100 - self._position

if self._position: # if not None:
return 100 - self._position
else:
return self._position

def set_cover_position(self, position, **kwargs):
_LOGGER.debug(f"Trying to SET POSITION {position} cover {self.name}! _state={self._state}")
self._hub.cover_position(self._id, 100 - position)
Expand Down

0 comments on commit 50f3897

Please sign in to comment.