Browse Source

Cloud: fix detection of hubs that don't have a local key

When the local key is really missing, the string comparison throws an
error, making the cloud config useless for anyone with one of these devices
attached to their account.

Issue #2475
Jason Rumney 1 year ago
parent
commit
10c6eee6ab
1 changed files with 4 additions and 1 deletions
  1. 4 1
      custom_components/tuya_local/cloud.py

+ 4 - 1
custom_components/tuya_local/cloud.py

@@ -155,7 +155,10 @@ class Cloud:
                 "support_local": device.support_local,
                 "support_local": device.support_local,
                 CONF_DEVICE_CID: None,
                 CONF_DEVICE_CID: None,
                 "version": None,
                 "version": None,
-                "is_hub": device.category in HUB_CATEGORIES or device.local_key == "",
+                "is_hub": (
+                    device.category in HUB_CATEGORIES
+                    or not hasattr(device, "local_key")
+                ),
             }
             }
             _LOGGER.debug("Found device: {cloud_device}")
             _LOGGER.debug("Found device: {cloud_device}")