File tree Expand file tree Collapse file tree
custom_components/smart_thermostat Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -934,9 +934,18 @@ def _is_device_active(self):
934934 in self .heater_or_cooler_entity ])
935935 else :
936936 """If the valve device is currently active."""
937+ is_active = False
937938 try : # do not throw an error if the state is not yet available on startup
938- return any ([float (self .hass .states .get (heater_or_cooler_entity ).state ) > 0 for heater_or_cooler_entity
939- in self .heater_or_cooler_entity ])
939+ for heater_or_cooler_entity in self .heater_or_cooler_entity :
940+ state = self .hass .states .get (heater_or_cooler_entity ).state
941+ try :
942+ value = float (state )
943+ if value > 0 :
944+ is_active = True
945+ except ValueError :
946+ if state in ['on' , 'open' ]:
947+ is_active = True
948+ return is_active
940949 except :
941950 return False
942951
You can’t perform that action at this time.
0 commit comments