|
|
@@ -443,9 +443,7 @@ class TuyaLocalDevice(object):
|
|
|
now = time()
|
|
|
|
|
|
pending_updates = self._get_pending_updates()
|
|
|
- # format properties in numeric order
|
|
|
- sorted_properties = sorted(properties.items(), key=lambda x:int(x[0]))
|
|
|
- for key, value in sorted_properties:
|
|
|
+ for key, value in properties.items():
|
|
|
pending_updates[key] = {
|
|
|
"value": value,
|
|
|
"updated_at": now,
|
|
|
@@ -571,9 +569,13 @@ class TuyaLocalDevice(object):
|
|
|
|
|
|
def _get_pending_updates(self):
|
|
|
now = time()
|
|
|
+ # sort pending updates according to their API identifier
|
|
|
+ pending_updates_sorted = sorted(
|
|
|
+ self._pending_updates.items(), key=lambda x: int(x[0])
|
|
|
+ )
|
|
|
self._pending_updates = {
|
|
|
key: value
|
|
|
- for key, value in self._pending_updates.items()
|
|
|
+ for key, value in pending_updates_sorted
|
|
|
if not value["sent"]
|
|
|
or now - value.get("updated_at", 0) < self._FAKE_IT_TIMEOUT
|
|
|
}
|