@@ -214,65 +214,6 @@ async def full_update_device(self):
214214 if self .smile_type != "power" :
215215 self ._modules = await self .request (MODULES )
216216
217- def update_helper (self , data , dev_dict , dev_id , key , entity_type ):
218- """Helper for update_gw_devices."""
219- for tmp_dict in dev_dict [entity_type ]:
220- if key == tmp_dict [ATTR_ID ]:
221- gw_list = self .gw_devices [dev_id ][entity_type ]
222- for idx , item in enumerate (gw_list ):
223- if key == item [ATTR_ID ]:
224- gw_list [idx ][ATTR_STATE ] = data [key ]
225-
226- def update_device_state (self , data , dev_dict ):
227- """Helper for device_state_updater()."""
228- _cooling_state = False
229- _dhw_state = False
230- _heating_state = False
231- state = "idle"
232- icon = IDLE_ICON
233-
234- for idx , item in enumerate (dev_dict ["binary_sensors" ]):
235- if item [ATTR_ID ] == "dhw_state" :
236- if item [ATTR_STATE ]:
237- state = "dhw-heating"
238- icon = FLAME_ICON
239- _dhw_state = True
240-
241- if "heating_state" in data :
242- if data ["heating_state" ]:
243- state = "heating"
244- icon = HEATING_ICON
245- _heating_state = True
246- if _heating_state and _dhw_state :
247- state = "dhw and heating"
248- icon = HEATING_ICON
249- if "cooling_state" in data :
250- if data ["cooling_state" ]:
251- state = "cooling"
252- icon = COOLING_ICON
253- _cooling_state = True
254- if _cooling_state and _dhw_state :
255- state = "dhw and cooling"
256- icon = COOLING_ICON
257-
258- return [state , icon ]
259-
260- def device_state_updater (self , data , dev_id , dev_dict ):
261- """ Device State sensor update helper."""
262- for idx , item in enumerate (dev_dict ["sensors" ]):
263- if item [ATTR_ID ] == "device_state" :
264- result = self .update_device_state (data , dev_dict )
265- self .gw_devices [dev_id ]["sensors" ][idx ][ATTR_STATE ] = result [0 ]
266- self .gw_devices [dev_id ]["sensors" ][idx ][ATTR_ICON ] = result [1 ]
267-
268- def pw_notification_updater (self , dev_id , dev_dict ):
269- """ PW_Notification update helper."""
270- for idx , item in enumerate (dev_dict ["binary_sensors" ]):
271- if item [ATTR_ID ] == "plugwise_notification" :
272- self .gw_devices [dev_id ]["binary_sensors" ][idx ][ATTR_STATE ] = (
273- self .notifications != {}
274- )
275-
276217 async def update_gw_devices (self ):
277218 """Update all XML data from device."""
278219 await self .update_domain_objects ()
@@ -288,15 +229,15 @@ async def update_gw_devices(self):
288229 self .gw_devices [dev_id ][key ] = value
289230 if "binary_sensors" in dev_dict :
290231 for key , value in list (data .items ()):
291- self .update_helper (data , dev_dict , dev_id , key , "binary_sensors" )
232+ self .update_helper (data , dev_dict , dev_id , "binary_sensors" , key )
292233 self .pw_notification_updater (dev_id , dev_dict )
293234 if "sensors" in dev_dict :
294235 for key , value in list (data .items ()):
295- self .update_helper (data , dev_dict , dev_id , key , "sensors" )
236+ self .update_helper (data , dev_dict , dev_id , "sensors" , key )
296237 self .device_state_updater (data , dev_id , dev_dict )
297238 if "switches" in dev_dict :
298239 for key , value in list (data .items ()):
299- self .update_helper (data , dev_dict , dev_id , key , "switches" )
240+ self .update_helper (data , dev_dict , dev_id , "switches" , key )
300241
301242 def append_special (self , data , dev_id , bs_list , s_list ):
302243 """Helper for all_device_data()."""
0 commit comments