فهرست منبع

Fix some CodeSonar code smells that don't need refactoring.

Change comment from a TODO to analysis of why we don't use the
DeviceEntry in diagnostics output.

Rename a variable in lock to avoid shadowing a Python built-in.
Jason Rumney 3 سال پیش
والد
کامیت
785edc14b9
2فایلهای تغییر یافته به همراه8 افزوده شده و 5 حذف شده
  1. 4 1
      custom_components/tuya_local/diagnostics.py
  2. 4 4
      custom_components/tuya_local/generic/lock.py

+ 4 - 1
custom_components/tuya_local/diagnostics.py

@@ -45,7 +45,10 @@ def _async_get_diagnostics(
         "protocol_version": entry.data[CONF_PROTOCOL_VERSION],
     }
 
-    # TODO: investigate what device entry holds
+    # The DeviceEntry also has interesting looking data, but this
+    # integration does not publish anything to it other than some hardcoded
+    # values that don't change between devices. Instead get the live data
+    # from the running hass.
     data |= _async_device_as_dict(hass, hass_data["device"])
 
     return data

+ 4 - 4
custom_components/tuya_local/generic/lock.py

@@ -67,12 +67,12 @@ class TuyaLocalLock(TuyaLocalEntity, LockEntity):
 
     def unlocker_id(self, dp, type):
         if dp:
-            id = dp.get_value(self._device)
-            if id:
-                if id is True:
+            unlock = dp.get_value(self._device)
+            if unlock:
+                if unlock is True:
                     return f"{type}"
                 else:
-                    return f"{type} #{id}"
+                    return f"{type} #{unlock}"
 
     @property
     def changed_by(self):