From c467aa4e0002d75417e39e635260a60f81923874 Mon Sep 17 00:00:00 2001 From: Thibaut Date: Tue, 29 Jun 2021 17:13:52 +0200 Subject: [PATCH] Fix is_opening/is_closing for RTS covers (#463) --- custom_components/tahoma/cover.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/custom_components/tahoma/cover.py b/custom_components/tahoma/cover.py index a1231b49b..e29707ce4 100644 --- a/custom_components/tahoma/cover.py +++ b/custom_components/tahoma/cover.py @@ -324,11 +324,12 @@ def is_opening(self): ): return True - is_moving = self.device.states[CORE_MOVING_STATE].value - current_closure = self.device.states[CORE_CLOSURE_STATE] - target_closure = self.device.states[CORE_TARGET_CLOSURE_STATE] + is_moving = self.device.states.get(CORE_MOVING_STATE) + current_closure = self.device.states.get(CORE_CLOSURE_STATE) + target_closure = self.device.states.get(CORE_TARGET_CLOSURE_STATE) return ( is_moving + and is_moving.value and current_closure and target_closure and current_closure.value > target_closure.value @@ -344,11 +345,12 @@ def is_closing(self): ): return True - is_moving = self.device.states.get(CORE_MOVING_STATE).value - current_closure = self.device.states[CORE_CLOSURE_STATE] - target_closure = self.device.states[CORE_TARGET_CLOSURE_STATE] + is_moving = self.device.states.get(CORE_MOVING_STATE) + current_closure = self.device.states.get(CORE_CLOSURE_STATE) + target_closure = self.device.states.get(CORE_TARGET_CLOSURE_STATE) return ( is_moving + and is_moving.value and current_closure and target_closure and current_closure.value < target_closure.value