Z-Wave.Me: Cover: Fixed calibration errors and add missing is_closed (#85452)

* Cover: Fixed calibration errors and add missing is_closed

* Style

* Style

* whitespace
This commit is contained in:
Poltorak Serguei 2023-01-09 04:18:36 +03:00 committed by GitHub
parent dfa9f0e11d
commit 1f86a0a76f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -73,8 +73,23 @@ class ZWaveMeCover(ZWaveMeEntity, CoverEntity):
"""Return current position of cover.
None is unknown, 0 is closed, 100 is fully open.
Allow small calibration errors (some devices after a long time become not well calibrated)
"""
if self.device.level == 99: # Scale max value
if self.device.level > 95:
return 100
return self.device.level
@property
def is_closed(self) -> bool | None:
"""Return true if cover is closed.
None is unknown.
Allow small calibration errors (some devices after a long time become not well calibrated)
"""
if self.device.level is None:
return None
return self.device.level < 5