Procházet zdrojové kódy

Fix data model logging.

List += works differently than append() when the argument is a dict,
+= adds all the keys as individual items, instead of adding the dict
as a single item as append() does.
Jason Rumney před 1 rokem
rodič
revize
1439fbc52c

+ 9 - 7
custom_components/tuya_local/cloud.py

@@ -194,13 +194,15 @@ class Cloud:
         transform = []
         transform = []
         for entry in response.get("dpStatusRelationDTOS"):
         for entry in response.get("dpStatusRelationDTOS"):
             if entry["supportLocal"]:
             if entry["supportLocal"]:
-                transform += {
-                    "id": entry["dpId"],
-                    "name": entry["dpCode"],
-                    "type": entry["valueType"],
-                    "format": entry["valueDesc"],
-                    "enumMap": entry["enumMappingMap"],
-                }
+                transform.append(
+                    {
+                        "id": entry["dpId"],
+                        "name": entry["dpCode"],
+                        "type": entry["valueType"],
+                        "format": entry["valueDesc"],
+                        "enumMap": entry["enumMappingMap"],
+                    }
+                )
         return transform
         return transform
 
 
     @property
     @property

+ 1 - 1
custom_components/tuya_local/config_flow.py

@@ -413,7 +413,7 @@ class ConfigFlowHandler(ConfigFlow, domain=DOMAIN):
                 )
                 )
                 if model:
                 if model:
                     _LOGGER.warning(
                     _LOGGER.warning(
-                        "Device specficication:\n%s",
+                        "Device specification:\n%s",
                         log_json(model),
                         log_json(model),
                     )
                     )
             except Exception as e:
             except Exception as e: