From 1f86a0a76f48df816355f52e2a25fd712873effd Mon Sep 17 00:00:00 2001 From: Poltorak Serguei Date: Mon, 9 Jan 2023 04:18:36 +0300 Subject: [PATCH] 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 --- homeassistant/components/zwave_me/cover.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/zwave_me/cover.py b/homeassistant/components/zwave_me/cover.py index 5e2fdba8608..790cfc6c574 100644 --- a/homeassistant/components/zwave_me/cover.py +++ b/homeassistant/components/zwave_me/cover.py @@ -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