Explorar o código

fix(device): don't try to add full_poll to non-dict returned data

Sometimes devices seem to return a tuple instead of a dict (empty result?).
Don't try to add full_poll to that, nor return it as a data response

Discussion #5148
Jason Rumney hai 1 día
pai
achega
aa3d4ac734
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      custom_components/tuya_local/device.py

+ 3 - 2
custom_components/tuya_local/device.py

@@ -415,8 +415,9 @@ class TuyaLocalDevice(object):
                     else:
                         if "dps" in poll:
                             poll = poll["dps"]
-                        poll["full_poll"] = full_poll
-                        yield poll
+                        if isinstance(poll, dict):
+                            poll["full_poll"] = full_poll
+                            yield poll
 
             except CancelledError:
                 self._running = False