File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed
custom_components/battery_notes Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -33,16 +33,17 @@ async def async_get_config_entry_diagnostics(
3333 entity = entity_registry .async_get (source_entity_id )
3434 device_id = entity .device_id
3535
36- device_entry = device_registry .async_get (device_id )
37-
3836 diagnostics = {"entry" : config_entry .as_dict ()}
39- if device_entry :
40- device_info = {
41- "manufacturer" : device_entry .manufacturer ,
42- "model" : device_entry .model ,
43- "model_id" : get_device_model_id (device_entry ),
44- "hw_version" : device_entry .hw_version ,
45- }
46- diagnostics .update ({"device" : device_info })
37+
38+ if device_id :
39+ device_entry = device_registry .async_get (device_id )
40+ if device_entry :
41+ device_info = {
42+ "manufacturer" : device_entry .manufacturer ,
43+ "model" : device_entry .model ,
44+ "model_id" : get_device_model_id (device_entry ),
45+ "hw_version" : device_entry .hw_version ,
46+ }
47+ diagnostics .update ({"device" : device_info })
4748
4849 return diagnostics
You can’t perform that action at this time.
0 commit comments