File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed
Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -309,19 +309,28 @@ def all_device_data(self):
309309 temp_sensor_list .append (DEVICE_STATE )
310310 for key , value in list (data .items ()):
311311 for item in BINARY_SENSORS :
312- if item [ATTR_ID ] == key :
313- data .pop (key )
312+ try :
313+ data .pop (item [ATTR_ID ])
314+ except KeyError :
315+ pass
316+ else :
314317 if self .active_device_present :
315318 item [ATTR_STATE ] = value
316319 temp_b_sensor_list .append (item )
317320 for item in SENSORS :
318- if item [ATTR_ID ] == key :
319- data .pop (key )
321+ try :
322+ data .pop (item [ATTR_ID ])
323+ except KeyError :
324+ pass
325+ else :
320326 item [ATTR_STATE ] = value
321327 temp_sensor_list .append (item )
322328 for item in SWITCHES :
323- if item [ATTR_ID ] == key :
324- data .pop (key )
329+ try :
330+ data .pop (item [ATTR_ID ])
331+ except KeyError :
332+ pass
333+ else :
325334 item [ATTR_STATE ] = value
326335 temp_switch_list .append (item )
327336 dev_and_data .update (data )
You can’t perform that action at this time.
0 commit comments