@@ -35,6 +35,7 @@ def _all_device_data(self) -> None:
3535 Collect data for each device and add to self.gw_data and self.gw_devices.
3636 """
3737 self ._update_gw_devices ()
38+ self ._update_climates ()
3839 self .gw_data .update (
3940 {
4041 "gateway_id" : self .gateway_id ,
@@ -49,6 +50,15 @@ def _all_device_data(self) -> None:
4950 {"heater_id" : self ._heater_id , "cooling_present" : self ._cooling_present }
5051 )
5152
53+ def _update_climates (self ) -> None :
54+ """Helper-function for _all_device_data() and async_update().
55+
56+ Collect data for each climate-location and add to self.climate_data.
57+ """
58+ for location_id , climate in self .climate_data .items ():
59+ data = self ._get_location_data (location_id )
60+ climate .update (data )
61+
5262 def _update_gw_devices (self ) -> None :
5363 """Helper-function for _all_device_data() and async_update().
5464
@@ -140,10 +150,24 @@ def _update_for_cooling(self, device: DeviceData) -> None:
140150 sensors ["setpoint_high" ] = temp_dict ["setpoint_high" ]
141151 self ._count += 2
142152
143- def _get_device_data (self , dev_id : str ) -> DeviceData :
153+ def _get_location_data (self , loc_id : str ) -> DeviceData :
144154 """Helper-function for _all_device_data() and async_update().
145155
146- Provide device-data, based on Location ID (= dev_id), from APPLIANCES.
156+ Provide device-data, based on Location ID (= loc_id).
157+ """
158+ climate = self .climate_data [loc_id ]
159+ data = self ._get_climate_data (loc_id )
160+ if ctrl_state := self ._control_state (loc_id ):
161+ data ["control_state" ] = ctrl_state
162+ self ._count += 1
163+
164+ # Thermostat data (presets, temperatures etc)
165+ self ._device_data_climate (loc_id , climate , data )
166+
167+ def _get_device_data (self , dev_id : str ) -> DeviceData :
168+ """Helper-function for _update_gw_devices() and async_update().
169+
170+ Provide device-data, based on appliance_id ()= dev_id).
147171 """
148172 device = self .gw_devices [dev_id ]
149173 data = self ._get_measurement_data (dev_id )
@@ -162,13 +186,7 @@ def _get_device_data(self, dev_id: str) -> DeviceData:
162186 # Switching groups data
163187 self ._device_data_switching_group (device , data )
164188 # Adam data
165- self ._device_data_adam (device , data )
166- # Skip obtaining data for (Adam) secondary thermostats
167- if device ["dev_class" ] not in ZONE_THERMOSTATS :
168- return data
169-
170- # Thermostat data (presets, temperatures etc)
171- self ._device_data_climate (device , data )
189+ self ._device_data_adam (dev_id , device , data )
172190
173191 return data
174192
@@ -187,7 +205,7 @@ def _check_availability(
187205 if message in msg :
188206 data ["available" ] = False
189207
190- def _device_data_adam (self , device : DeviceData , data : DeviceData ) -> None :
208+ def _device_data_adam (self , loc_id : str , device : DeviceData , data : DeviceData ) -> None :
191209 """Helper-function for _get_device_data().
192210
193211 Determine Adam heating-status for on-off heating via valves,
@@ -211,20 +229,12 @@ def _device_data_adam(self, device: DeviceData, data: DeviceData) -> None:
211229 data ["gateway_modes" ] = self ._gw_allowed_modes
212230 self ._count += 1
213231
214- # Control_state, only available for Adam primary thermostats
215- if device ["dev_class" ] in ZONE_THERMOSTATS :
216- loc_id = device ["location" ]
217- if ctrl_state := self ._control_state (loc_id ):
218- data ["control_state" ] = ctrl_state
219- self ._count += 1
220232
221- def _device_data_climate (self , device : DeviceData , data : DeviceData ) -> None :
233+ def _device_data_climate (self , loc_id : str , device : DeviceData , data : DeviceData ) -> None :
222234 """Helper-function for _get_device_data().
223235
224236 Determine climate-control device data.
225237 """
226- loc_id = device ["location" ]
227-
228238 # Presets
229239 data ["preset_modes" ] = None
230240 data ["active_preset" ] = None
0 commit comments