I just set up LocalTuya for the first time to connect to an ultrasonic tank level sensor. This thing is super cool and appears to work well through the Tuya app. It’s very flaky through LocalTuya though. I can get data reliably through `tuya-cli` with no problem, and HomeAssistant always gets a datapoint whenever I reload the LocalTuya integration, but otherwise I seem to only get a first datapoint immediately and then sporadically every 10 minutes or so (UPDATE: now it seems to be only every few hours).
I sort of worked around it with this hacky automation to just reload LocalTuya every 10 seconds, but a) I hate that and b) it seems to give me a bogus reading every few times I reload:
alias: Reload LocalTuya
description: ""
trigger:
- platform: time_pattern
seconds: /10
minutes: "*"
hours: "*"
condition: []
action:
- service: localtuya.reload
metadata: {}
data: {}
mode: single
I’ve tried manually setting the Scan Interval
and the DPS
but that doesn’t seem to change anything.
When I enable debug mode I see some promising logs:
[custom_components.localtuya.pytuya] [ebf...hix] updatedps() entry (dps [], dps_cache {'1': 'normal', '2': 24, '22': 24})
[custom_components.localtuya.pytuya] [ebf...hix] Sending payload: b'{"dpId":[]}'
[custom_components.localtuya.pytuya] [ebf...hix] Dispatching message CMD 18 TuyaMessage(seqno=632, cmd=18, retcode=0, payload=b'', crc=2673679595, crc_good=True)
[custom_components.localtuya.pytuya] [ebf...hix] Got normal updatedps response
That packet from the updatedps
message looks like correct updated data: {'1': 'normal', '2': 24, '22': 24}
but I have no idea why it’s not making its way into my LTSS database.
Has anyone else solved this?