Support 0d devices
See original GitHub issueI’m using tuyaApi in node-red, via node node-red-contrib-tuya-smart-device. I have 20+ Tuya devices, like switches, sensors, ad some ZigBee devices. All devices work well in smartLife app. The node-red actual comportment is:
- All devices (except some sensors) accepts “SET” commands:
Example, using a real device, a switch, the command (sets the switch on for 10 s) :
payload: { multiple: true, data: { 1: true, 102: 10}}
produces the answer:
12 Dec 11:50:26 - [info] [tuya-smart-device:fe3fbeb2.ac31f] Data from device: "{"dps":{"1":true,"102":10},"t":1607770225}"
Using a virtual device, i.e. a radiator controller and ZigBee hub, the command (sets the target temperature)
payload: { "devId": "60a423fffeb5b90d", "dps": 103, "set": 220 }
produces the answer:
12 Dec 12:06:24 - [info] [tuya-smart-device:a9ea9736.7483f8] Data from device: "{"dps":{"103":220},"cid":"60a423fffeb5b90d","type":query,"t":1607771183}"
- I get a message also when some values are changed in smartLife, e.g.:
12 Dec 12:14:08 - [info] [tuya-smart-device:fe3fbeb2.ac31f] Data from device: "{"dps":{"1":true},"t":1607771648}"
12 Dec 12:16:12 - [info] [tuya-smart-device:a9ea9736.7483f8] Data from device: "{"dps":{"101":47},"cid":"00158d00056e5022","t":1607771771}"
- I get also messages in case of an event on the device, or from the sensors (without any request):
Switch countdown end:
12 Dec 11:50:36 - [info] [tuya-smart-device:fe3fbeb2.ac31f] Data from device: "{"dps":{"1":false,"102":0},"t":1607770235}"
Temperature from a ZigBee sensor, about every 3600s (request by Tuya cloud?):
12 Dec 12:14:28 - [info] [tuya-smart-device:a9ea9736.7483f8] Data from device: "{"dps":{"103":215},"cid":"60a423fffeb5b90d","t":1607771667}"
It sounds good, so all ok? Sorry, not really.
- Any ‘GET’ command in any device (real, virtual, …) in any form, don’t work! Always I get:
12 Dec 11:32:32 - [error] [tuya-smart-device:fe3fbeb2.ac31f] json obj data unvalid
This is a big problem because I cannot poll any RO device data points, so some parameters are unreachable.
(see also issue #246 and issue #23) I tryed also a tuyapi update to version 6, but no changes.
I found it very strange that the answer to a ‘SET’ command from node-red is always handled well, and the answer to a ‘GET’ command gets always an error (but the answer is well processed if the ‘GET’ is from the cloud).
Any idea?
Best regards m.sillano
Issue Analytics
- State:
- Created 3 years ago
- Comments:26 (14 by maintainers)
Top GitHub Comments
Save for the current constructed instance yes, for future program executions no.
Definitely.
If you’re asking whether
await get()
should resolve before dps queries / switching to the 0d scheme is finished I’d say no.Everything else sounds good, thanks for taking a look!
PS: hehe detection done as I proposed 😃 https://github.com/rospogrigio/localtuya/blob/master/custom_components/localtuya/pytuya/__init__.py#L546