Procházet zdrojové kódy

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 před 1 rokem
rodič
revize
46e4428761
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  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}.",