@@ -35,7 +35,7 @@ def _all_entity_data(self) -> None:
3535 Collect data for each entity and add to self.gw_entities.
3636 """
3737 self ._update_gw_entities ()
38- if self .check_name ( ADAM ) :
38+ if self ._is_thermostat :
3939 self ._update_zones ()
4040 self .gw_entities .update (self ._zones )
4141
@@ -48,6 +48,8 @@ def _update_zones(self) -> None:
4848 data = self ._get_location_data (location_id )
4949 zone .update (data )
5050
51+ self ._update_for_cooling (zone )
52+
5153 def _update_gw_entities (self ) -> None :
5254 """Helper-function for _all_entities_data() and async_update().
5355
@@ -76,8 +78,6 @@ def _update_gw_entities(self) -> None:
7678 if is_battery_low :
7779 entity ["binary_sensors" ]["low_battery" ] = True
7880
79- self ._update_for_cooling (entity )
80-
8181 remove_empty_platform_dicts (entity )
8282
8383 def _detect_low_batteries (self ) -> list [str ]:
@@ -126,7 +126,7 @@ def _update_for_cooling(self, entity: GwEntityData) -> None:
126126 if (
127127 self .check_name (ANNA )
128128 and self ._cooling_present
129- and entity ["dev_class" ] == "thermostat "
129+ and entity ["dev_class" ] == "climate "
130130 ):
131131 thermostat = entity ["thermostat" ]
132132 sensors = entity ["sensors" ]
@@ -142,11 +142,9 @@ def _update_for_cooling(self, entity: GwEntityData) -> None:
142142 thermostat .pop ("setpoint" )
143143 temp_dict .update (thermostat )
144144 entity ["thermostat" ] = temp_dict
145- if "setpoint" in sensors :
146- sensors .pop ("setpoint" )
147145 sensors ["setpoint_low" ] = temp_dict ["setpoint_low" ]
148146 sensors ["setpoint_high" ] = temp_dict ["setpoint_high" ]
149- self ._count += 2 # add 4, remove 2
147+ self ._count += 3 # add 4, remove 1
150148
151149 def _get_location_data (self , loc_id : str ) -> GwEntityData :
152150 """Helper-function for _all_entity_data() and async_update().
@@ -197,11 +195,6 @@ def _get_entity_data(self, entity_id: str) -> GwEntityData:
197195 if self .check_name (ADAM ):
198196 self ._get_adam_data (entity , data )
199197
200- # Thermostat data for Anna (presets, temperatures etc)
201- if self .check_name (ANNA ) and entity ["dev_class" ] == "thermostat" :
202- self ._climate_data (entity_id , entity , data )
203- self ._get_anna_control_state (data )
204-
205198 return data
206199
207200 def _check_availability (
@@ -249,16 +242,12 @@ def _get_adam_data(self, entity: GwEntityData, data: GwEntityData) -> None:
249242 self ._count += 1
250243
251244 def _climate_data (
252- self , location_id : str , entity : GwEntityData , data : GwEntityData
245+ self , loc_id : str , entity : GwEntityData , data : GwEntityData
253246 ) -> None :
254247 """Helper-function for _get_entity_data().
255248
256249 Determine climate-control entity data.
257250 """
258- loc_id = location_id
259- if entity .get ("location" ) is not None :
260- loc_id = entity ["location" ]
261-
262251 # Presets
263252 data ["preset_modes" ] = None
264253 data ["active_preset" ] = None
@@ -301,20 +290,6 @@ def check_reg_mode(self, mode: str) -> bool:
301290 "regulation_modes" in gateway and gateway ["select_regulation_mode" ] == mode
302291 )
303292
304- def _get_anna_control_state (self , data : GwEntityData ) -> None :
305- """Set the thermostat control_state based on the opentherm/onoff device state."""
306- data ["control_state" ] = "idle"
307- self ._count += 1
308- for entity in self .gw_entities .values ():
309- if entity ["dev_class" ] != "heater_central" :
310- continue
311-
312- binary_sensors = entity ["binary_sensors" ]
313- if binary_sensors ["heating_state" ]:
314- data ["control_state" ] = "heating"
315- if binary_sensors .get ("cooling_state" ):
316- data ["control_state" ] = "cooling"
317-
318293 def _get_schedule_states_with_off (
319294 self , location : str , schedules : list [str ], selected : str , data : GwEntityData
320295 ) -> None :
0 commit comments