From dbbad7e05de2aa0bda32e4542f92bae9682e61b1 Mon Sep 17 00:00:00 2001 From: Pavel Skuratovich Date: Sun, 15 Oct 2023 16:49:36 +0300 Subject: [PATCH] Do not throw an error if heater/cooler entity is not yet available on startup --- custom_components/smart_thermostat/climate.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/custom_components/smart_thermostat/climate.py b/custom_components/smart_thermostat/climate.py index 9a16e7e..d1ca55b 100644 --- a/custom_components/smart_thermostat/climate.py +++ b/custom_components/smart_thermostat/climate.py @@ -971,7 +971,10 @@ def _is_device_active(self): return self.hass.states.is_state(self.heater_or_cooler_entity, STATE_ON) else: """If the valve device is currently active.""" - return float(self.hass.states.get(self.heater_or_cooler_entity).state) > 0 + try: # do not throw an error if the state is not yet available on startup + return float(self.hass.states.get(self.heater_or_cooler_entity).state) > 0 + except: + return False @property def supported_features(self):