4
0
Эх сурвалжийг харах

Get the device from the hass_data the way we store it.

In device.py device is stored as "device" dict entry, we do not have a device_manager property like the built in tuya integraton does.
Jason Rumney 3 жил өмнө
parent
commit
4b15cc881f

+ 3 - 12
custom_components/tuya_local/diagnostics.py

@@ -44,18 +44,9 @@ def _async_get_diagnostics(
         "host": REDACTED,
     }
 
-    if device:
-        tuya_device_id = next(iter(device.identitifers))[1]
-        data |= _async_device_as_dict(
-            hass, hass_data.device_manager.device_map[tuya_device_id]
-        )
-    else:
-        data.update(
-            devices=[
-                _async_device_as_dict(hass, device)
-                for device in hass_data.device_manager.device_map.values()
-            ]
-        )
+    # TODO: investigate what device entry holds
+    data |= _async_device_as_dict(hass, hass_data["device"])
+
     return data