4
0
Эх сурвалжийг харах

Set dpsUsed for device22 devices.

dpsUsed is required by device22 devices in order to get informmation back
from async_refresh.  For other devices it doesn't seem to be used.
Default if not specified is "1" only, which is not enough for some devices.
Other common starting points for dps are 20 and 101.

Issue #451
Jason Rumney 2 жил өмнө
parent
commit
48fde329e0

+ 6 - 0
custom_components/tuya_local/device.py

@@ -313,6 +313,12 @@ class TuyaLocalDevice(object):
     async def async_possible_types(self):
         cached_state = self._get_cached_state()
         if len(cached_state) <= 1:
+            # in case of device22 devices, we need to poll them with a dp
+            # that exists on the device to get anything back.  Most switch-like
+            # devices have dp 1. Lights generally start from 20.  101 is where
+            # vendor specific dps start.  Between them, these three should cover
+            # most devices.
+            self._api.set_dpsUsed({"1": None, "20": None, "101": None})
             await self.async_refresh()
             cached_state = self._get_cached_state()