Răsfoiți Sursa

device communication: ignore HA poll requests once started

We keep our own receive loop to handle push from devices. But when devices
are set to poll only, the receive loop also handles the polling. Handling
the poll requests from HA in this can cause simultaneous requests to be
sent to the device, which many devices cannot handle.

Instead of ignoring the HA requests when a persistent connection is being
used, ignore them when the receive loop is running.

Issue #653, #1804
Jason Rumney 1 an în urmă
părinte
comite
46e4428761
1 a modificat fișierele cu 1 adăugiri și 1 ștergeri
  1. 1 1
      custom_components/tuya_local/device.py

+ 1 - 1
custom_components/tuya_local/device.py

@@ -441,7 +441,7 @@ class TuyaLocalDevice(object):
 
     async def async_refresh(self):
         _LOGGER.debug("Refreshing device state for %s", self.name)
-        if self.should_poll:
+        if not self._running:
             await self._retry_on_failed_connection(
                 lambda: self._refresh_cached_state(),
                 f"Failed to refresh device state for {self.name}.",