Skip to content

Commit

Permalink
Set dpsUsed for device22 devices.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
make-all committed Apr 21, 2023
1 parent 3677230 commit 48fde32
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions custom_components/tuya_local/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,12 @@ async def async_receive(self):
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()

Expand Down

0 comments on commit 48fde32

Please sign in to comment.