Ver Fonte

Do not clobber old dps when updating.

Many devices only seem to return partial data for each update.
To avoid reporting attributes as missing, keep the old data when a partial
update comes through.

May help with #92, #137 and other issues with strange behaviour.
Jason Rumney há 3 anos atrás
pai
commit
525ca88382
1 ficheiros alterados com 1 adições e 1 exclusões
  1. 1 1
      custom_components/tuya_local/device.py

+ 1 - 1
custom_components/tuya_local/device.py

@@ -166,7 +166,7 @@ class TuyaLocalDevice(object):
 
     def _refresh_cached_state(self):
         new_state = self._api.status()
-        self._cached_state = new_state["dps"]
+        self._cached_state = self._cached_state | new_state["dps"]
         self._cached_state["updated_at"] = time()
         _LOGGER.debug(f"{self.name} refreshed device state: {json.dumps(new_state)}")
         _LOGGER.debug(