File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ def _get_location_data(self, loc_id: str) -> GwEntityData:
162162 """
163163 zone = self ._zones [loc_id ]
164164 data = self ._get_zone_data (loc_id )
165- if ctrl_state := self ._control_state (loc_id ):
165+ if ctrl_state := self ._control_state (data , loc_id ):
166166 if str (ctrl_state ) in ("cooling" , "heating" , "preheating" ):
167167 data ["control_state" ] = str (ctrl_state )
168168 self ._count += 1
@@ -174,6 +174,9 @@ def _get_location_data(self, loc_id: str) -> GwEntityData:
174174 data ["control_state" ] = "idle"
175175 self ._count += 1
176176
177+ data .pop ("setpoint" ) # remove, only used in _control_state()
178+ self ._count -= 1
179+
177180 # Thermostat data (presets, temperatures etc)
178181 self ._climate_data (loc_id , zone , data )
179182
Original file line number Diff line number Diff line change @@ -918,7 +918,7 @@ def _rank_thermostat(
918918 else :
919919 thermo_loc ["secondary" ].append (appliance_id )
920920
921- def _control_state (self , loc_id : str ) -> str | bool :
921+ def _control_state (self , data : GwEntityData , loc_id : str ) -> str :
922922 """Helper-function for _get_adam_data().
923923
924924 Adam: find the thermostat control_state of a location, from DOMAIN_OBJECTS.
@@ -929,9 +929,14 @@ def _control_state(self, loc_id: str) -> str | bool:
929929 if (location := self ._domain_objects .find (locator )) is not None :
930930 locator = './actuator_functionalities/thermostat_functionality[type="thermostat"]/control_state'
931931 if (ctrl_state := location .find (locator )) is not None :
932- return str (ctrl_state .text )
933-
934- return False
932+ return ctrl_state .text
933+
934+ # Older Adam firmware does not have the control_state key
935+ # Work around this by comparing the reported temperature and setpoint for a location
936+ setpoint = data ["setpoint" ]
937+ temperature = data ["temperature" ]
938+ # No cooling available in older firmware
939+ return "heating" if temperature < setpoint else "idle"
935940
936941 def _heating_valves (self ) -> int | bool :
937942 """Helper-function for smile.py: _get_adam_data().
You can’t perform that action at this time.
0 commit comments