瀏覽代碼

Sort device properties when making API calls

Jonathan Peters 2 年之前
父節點
當前提交
2a84d30f8f
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      custom_components/tuya_local/device.py

+ 3 - 1
custom_components/tuya_local/device.py

@@ -443,7 +443,9 @@ class TuyaLocalDevice(object):
         now = time()
 
         pending_updates = self._get_pending_updates()
-        for key, value in properties.items():
+        # format properties in numeric order
+        sorted_properties = sorted(properties.items(), key=lambda x:int(x[0]))
+        for key, value in sorted_properties:
             pending_updates[key] = {
                 "value": value,
                 "updated_at": now,