From 1685376cec9f74d931a43b0c61bf0e1751a1e420 Mon Sep 17 00:00:00 2001 From: mampfes Date: Sat, 28 Dec 2024 15:46:49 +0100 Subject: [PATCH] enable speed-controls only if device is switched off --- custom_components/bayernluefter/number.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/custom_components/bayernluefter/number.py b/custom_components/bayernluefter/number.py index 7f816b9..4a3a1fd 100644 --- a/custom_components/bayernluefter/number.py +++ b/custom_components/bayernluefter/number.py @@ -81,6 +81,14 @@ def __init__( super().__init__(coordinator, description) self.entity_description = description + @property + def available(self) -> bool: + return ( + super().available + and self.entity_description.key in self._device.data + and not self._device.data.get("SystemOn", False) + ) + @property def native_value(self) -> float | None: """Return the value reported by the sensor."""