From 1d675f22c712e9fef4d3b246fa8f3d14abf4d03c Mon Sep 17 00:00:00 2001 From: Jean-Marc Collin Date: Sun, 12 Jan 2025 11:26:32 +0100 Subject: [PATCH] Issue #779 - error in ValveOpenPercent sensor at startup (#814) * issue #779 - error in ValveOpenPercent sensor at startup * fix log --------- Co-authored-by: Jean-Marc Collin --- custom_components/versatile_thermostat/sensor.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/custom_components/versatile_thermostat/sensor.py b/custom_components/versatile_thermostat/sensor.py index 502d6e8..4ab57d8 100644 --- a/custom_components/versatile_thermostat/sensor.py +++ b/custom_components/versatile_thermostat/sensor.py @@ -303,6 +303,10 @@ class ValveOpenPercentSensor(VersatileThermostatBaseEntity, SensorEntity): """Called when my climate have change""" # _LOGGER.debug("%s - climate state change", self._attr_unique_id) + if not self.my_climate or not hasattr(self.my_climate, "valve_open_percent"): + _LOGGER.warning("%s - my_climate not found or no valve_open_percent property found. This could be normal at startup. Ignore the underlying device change.", self) + return + old_state = self._attr_native_value self._attr_native_value = self.my_climate.valve_open_percent if old_state != self._attr_native_value: