@@ -298,6 +298,16 @@ async def update_gw_devices(self):
298298 for key , value in list (data .items ()):
299299 self .update_helper (data , dev_dict , dev_id , key , "switches" )
300300
301+ def append_special (self , data , dev_id , bs_list , s_list ):
302+ """Helper for all_device_data()."""
303+ if dev_id == self .gateway_id :
304+ if self .single_master_thermostat () is not None :
305+ bs_list .append (PW_NOTIFICATION )
306+ if not self .active_device_present and "heating_state" in data :
307+ s_list .append (DEVICE_STATE )
308+ if dev_id == self .heater_id and self .single_master_thermostat () is False :
309+ s_list .append (DEVICE_STATE )
310+
301311 def all_device_data (self ):
302312 "Helper-function: collect data for each device and add to self.gw_devices."
303313 dev_id_list = []
@@ -308,13 +318,8 @@ def all_device_data(self):
308318 temp_sensor_list = []
309319 temp_switch_list = []
310320 data = self .get_device_data (dev_id )
311- if dev_id == self .gateway_id :
312- if self .single_master_thermostat () is not None :
313- temp_b_sensor_list .append (PW_NOTIFICATION )
314- if not self .active_device_present and "heating_state" in data :
315- temp_sensor_list .append (DEVICE_STATE )
316- if dev_id == self .heater_id and self .single_master_thermostat () is False :
317- temp_sensor_list .append (DEVICE_STATE )
321+
322+ self .append_special (data , dev_id , temp_b_sensor_list , temp_sensor_list )
318323 for key , value in list (data .items ()):
319324 for item in BINARY_SENSORS :
320325 try :
0 commit comments