Open JeffResc opened 4 years ago
Did you have the application open during the process ? If yes, can you try by closing it first ?
I did not have the Tuya app open the first time I tried, but I tried again ensuring that the app was killed from the background apps on my phone and waited 5 minutes, then I tried again and still no luck.
I opened this device and noticed it was based on the WR3E chip, not the ESP8266. Are you aware of any API changes between these two chips?
Should not be any difference. Can you try tuyadebug.tgz
in this repo and see if it works from command line?
Sorry if it's obvious, but which python file should I run, there's multiple and I'm not really sure what each do.
I was able to test this from the command line now, but still with no luck. I've also verified my device is at 10.0.0.240
. I've censored out my device ID and key, but here are the logs:
Ver 3.1
jeff@DESKTOP-SHC2B57:~/localtuya-homeassistant/tuyadebug$ ./test.py XXXXX 10.0.0.240 YYYYY 3.1
INFO:localtuya:localtuya version 0.0.19
INFO:localtuya:Python 3.8.2 (default, Jul 16 2020, 14:00:26)
[GCC 9.3.0] on linux
INFO:localtuya:Using pytuya version '8.1.0'
INFO:localtuya:Detecting list of available DPS of device XXXXX [10.0.0.240], protocol 3.1.
DEBUG:localtuya.pytuya:Sending command status (device type: type_0a)
DEBUG:localtuya.pytuya:paylod=b'{"gwId":"XXXXX","devId":"XXXXX"}'
DEBUG:localtuya.pytuya:decode payload=b'e_\xf4\x17D\xa3!r"\xb8x\xdb\xe4|\xa4\x88\xc2\x9b0\x0e\xa9\xe8\x86\x16s\xe7\xf7E\x8b\xdf%\x1a'
DEBUG:localtuya.pytuya:'data unvalid' error detected: switching to dev_type 'type_0d'
DEBUG:localtuya.pytuya:Re-send status due to device type change (type_0a -> type_0d)
DEBUG:localtuya.pytuya:Sending command status (device type: type_0d)
DEBUG:localtuya.pytuya:paylod=b'{"devId":"XXXXX","uid":"XXXXX","t":"1601914131","dps":{"1":null,"2":null,"3":null,"4":null,"5":null,"6":null,"7":null,"8":null,"9":null,"10":null}}'
DEBUG:localtuya.pytuya:Failed to connect to 10.0.0.240. Raising Exception.
WARNING:localtuya.pytuya:Failed to get status: timed out
INFO:localtuya:Detecting list of available DPS of device XXXXX [10.0.0.240], protocol 3.1.
DEBUG:localtuya.pytuya:Sending command status (device type: type_0a)
DEBUG:localtuya.pytuya:paylod=b'{"gwId":"XXXXX","devId":"XXXXX"}'
DEBUG:localtuya.pytuya:decode payload=b'e_\xf4\x17D\xa3!r"\xb8x\xdb\xe4|\xa4\x88\xc2\x9b0\x0e\xa9\xe8\x86\x16s\xe7\xf7E\x8b\xdf%\x1a'
DEBUG:localtuya.pytuya:'data unvalid' error detected: switching to dev_type 'type_0d'
DEBUG:localtuya.pytuya:Re-send status due to device type change (type_0a -> type_0d)
DEBUG:localtuya.pytuya:Sending command status (device type: type_0d)
DEBUG:localtuya.pytuya:paylod=b'{"devId":"XXXXX","uid":"XXXXX","t":"1601914140","dps":{"1":null,"2":null,"3":null,"4":null,"5":null,"6":null,"7":null,"8":null,"9":null,"10":null}}'
DEBUG:localtuya.pytuya:Failed to connect to 10.0.0.240. Raising Exception.
WARNING:localtuya.pytuya:Failed to get status: timed out
INFO:localtuya:Detecting list of available DPS of device XXXXX [10.0.0.240], protocol 3.1.
DEBUG:localtuya.pytuya:Sending command status (device type: type_0a)
DEBUG:localtuya.pytuya:paylod=b'{"gwId":"XXXXX","devId":"XXXXX"}'
DEBUG:localtuya.pytuya:decode payload=b'e_\xf4\x17D\xa3!r"\xb8x\xdb\xe4|\xa4\x88\xc2\x9b0\x0e\xa9\xe8\x86\x16s\xe7\xf7E\x8b\xdf%\x1a'
DEBUG:localtuya.pytuya:'data unvalid' error detected: switching to dev_type 'type_0d'
DEBUG:localtuya.pytuya:Re-send status due to device type change (type_0a -> type_0d)
DEBUG:localtuya.pytuya:Sending command status (device type: type_0d)
DEBUG:localtuya.pytuya:paylod=b'{"devId":"XXXXX","uid":"XXXXX","t":"1601914149","dps":{"1":null,"2":null,"3":null,"4":null,"5":null,"6":null,"7":null,"8":null,"9":null,"10":null}}'
DEBUG:localtuya.pytuya:Failed to connect to 10.0.0.240. Raising Exception.
WARNING:localtuya.pytuya:Failed to get status: timed out
INFO:localtuya:TIMEOUT: No response from device XXXXX [10.0.0.240] after 2 attempts.
Ver 3.3
jeff@DESKTOP-SHC2B57:~/localtuya-homeassistant/tuyadebug$ ./test.py XXXXX 10.0.0.240 YYYYY 3.3
INFO:localtuya:localtuya version 0.0.19
INFO:localtuya:Python 3.8.2 (default, Jul 16 2020, 14:00:26)
[GCC 9.3.0] on linux
INFO:localtuya:Using pytuya version '8.1.0'
INFO:localtuya:Detecting list of available DPS of device XXXXX [10.0.0.240], protocol 3.3.
DEBUG:localtuya.pytuya:Sending command status (device type: type_0a)
DEBUG:localtuya.pytuya:paylod=b'{"gwId":"XXXXX","devId":"XXXXX"}'
DEBUG:localtuya.pytuya:decode payload=b'e_\xf4\x17D\xa3!r"\xb8x\xdb\xe4|\xa4\x88\xc2\x9b0\x0e\xa9\xe8\x86\x16s\xe7\xf7E\x8b\xdf%\x1a'
DEBUG:localtuya.pytuya:'data unvalid' error detected: switching to dev_type 'type_0d'
DEBUG:localtuya.pytuya:Re-send status due to device type change (type_0a -> type_0d)
DEBUG:localtuya.pytuya:Sending command status (device type: type_0d)
DEBUG:localtuya.pytuya:paylod=b'{"devId":"XXXXX","uid":"XXXXX","t":"1601913936","dps":{"1":null,"2":null,"3":null,"4":null,"5":null,"6":null,"7":null,"8":null,"9":null,"10":null}}'
DEBUG:localtuya.pytuya:Failed to connect to 10.0.0.240. Raising Exception.
WARNING:localtuya.pytuya:Failed to get status: timed out
INFO:localtuya:Detecting list of available DPS of device XXXXX [10.0.0.240], protocol 3.3.
DEBUG:localtuya.pytuya:Sending command status (device type: type_0a)
DEBUG:localtuya.pytuya:paylod=b'{"gwId":"XXXXX","devId":"XXXXX"}'
DEBUG:localtuya.pytuya:decode payload=b'e_\xf4\x17D\xa3!r"\xb8x\xdb\xe4|\xa4\x88\xc2\x9b0\x0e\xa9\xe8\x86\x16s\xe7\xf7E\x8b\xdf%\x1a'
DEBUG:localtuya.pytuya:'data unvalid' error detected: switching to dev_type 'type_0d'
DEBUG:localtuya.pytuya:Re-send status due to device type change (type_0a -> type_0d)
DEBUG:localtuya.pytuya:Sending command status (device type: type_0d)
DEBUG:localtuya.pytuya:paylod=b'{"devId":"XXXXX","uid":"XXXXX","t":"1601913945","dps":{"1":null,"2":null,"3":null,"4":null,"5":null,"6":null,"7":null,"8":null,"9":null,"10":null}}'
DEBUG:localtuya.pytuya:Failed to connect to 10.0.0.240. Raising Exception.
WARNING:localtuya.pytuya:Failed to get status: timed out
INFO:localtuya:Detecting list of available DPS of device XXXXX [10.0.0.240], protocol 3.3.
DEBUG:localtuya.pytuya:Sending command status (device type: type_0a)
DEBUG:localtuya.pytuya:paylod=b'{"gwId":"XXXXX","devId":"XXXXX"}'
DEBUG:localtuya.pytuya:decode payload=b'e_\xf4\x17D\xa3!r"\xb8x\xdb\xe4|\xa4\x88\xc2\x9b0\x0e\xa9\xe8\x86\x16s\xe7\xf7E\x8b\xdf%\x1a'
DEBUG:localtuya.pytuya:'data unvalid' error detected: switching to dev_type 'type_0d'
DEBUG:localtuya.pytuya:Re-send status due to device type change (type_0a -> type_0d)
DEBUG:localtuya.pytuya:Sending command status (device type: type_0d)
DEBUG:localtuya.pytuya:paylod=b'{"devId":"XXXXX","uid":"XXXXX","t":"1601913953","dps":{"1":null,"2":null,"3":null,"4":null,"5":null,"6":null,"7":null,"8":null,"9":null,"10":null}}'
DEBUG:localtuya.pytuya:Failed to connect to 10.0.0.240. Raising Exception.
WARNING:localtuya.pytuya:Failed to get status: timed out
INFO:localtuya:TIMEOUT: No response from device XXXXX [10.0.0.240] after 2 attempts.
@rospogrigio Can you help out with this? You know they script a lot better than me 😊
It's weird because it tries to connect as a type_0a device and it gets the "json data unvalid" error, then it switches to type_0d but it seems to get no response at that point, and it seems very repeatable. @JeffResc I'd suggest to try to switch off the official app you are using because it may conflict, and also try to reboot the device (I mean taking out the power and giving it back). If the connection still times out, we have a situation we have never encountered before so we need to debug some more, and maybe the only way would be that you give us SSH access to your HA environment for debugging (would keep it as a last resource, however). Let us know
So I successfully unpaired it from Tuya (I made sure to only disconnect it, not deleting data), which seemed to reset the device and it wouldn't rejoin the network. I had to re-add the device in Tuya to make it rejoin the network and then I tried running the debug script again and I got a different output. Please let me know if this is a more expected output for unpairing the device or if I unpaired it incorrectly.
jeff@DESKTOP-SHC2B57:~/localtuya-homeassistant/tuyadebug$ ./test.py XXXXX 10.0.0.240 YYYYY 3.3
INFO:localtuya:localtuya version 0.0.19
INFO:localtuya:Python 3.8.2 (default, Jul 16 2020, 14:00:26)
[GCC 9.3.0] on linux
INFO:localtuya:Using pytuya version '8.1.0'
INFO:localtuya:Detecting list of available DPS of device XXXXX [10.0.0.240], protocol 3.3.
DEBUG:localtuya.pytuya:Sending command status (device type: type_0a)
DEBUG:localtuya.pytuya:paylod=b'{"gwId":"XXXXX","devId":"XXXXX"}'
DEBUG:localtuya.pytuya:decode payload=b'\x85\x7f\xf6\xe2\xf1\xfe\xc1\x8cG\x9cB\x99\xe0\x94\xa8x|\\\xd5V\xd7\xd1\xb0\xc4\xa6\xdc\xeb\xb0\xc0G\xbbF'
DEBUG:localtuya.pytuya:decrypted result=''
DEBUG:localtuya.pytuya:Failed to connect to 10.0.0.240. Raising Exception.
WARNING:localtuya.pytuya:Failed to get status: Expecting value: line 1 column 1 (char 0)
INFO:localtuya:Detecting list of available DPS of device XXXXX [10.0.0.240], protocol 3.3.
DEBUG:localtuya.pytuya:Sending command status (device type: type_0a)
DEBUG:localtuya.pytuya:paylod=b'{"gwId":"XXXXX","devId":"XXXXX"}'
DEBUG:localtuya.pytuya:decode payload=b'\x85\x7f\xf6\xe2\xf1\xfe\xc1\x8cG\x9cB\x99\xe0\x94\xa8x|\\\xd5V\xd7\xd1\xb0\xc4\xa6\xdc\xeb\xb0\xc0G\xbbF'
DEBUG:localtuya.pytuya:decrypted result=''
DEBUG:localtuya.pytuya:Failed to connect to 10.0.0.240. Raising Exception.
WARNING:localtuya.pytuya:Failed to get status: Expecting value: line 1 column 1 (char 0)
INFO:localtuya:Detecting list of available DPS of device XXXXX [10.0.0.240], protocol 3.3.
DEBUG:localtuya.pytuya:Sending command status (device type: type_0a)
DEBUG:localtuya.pytuya:paylod=b'{"gwId":"XXXXX","devId":"XXXXX"}'
DEBUG:localtuya.pytuya:decode payload=b'\x85\x7f\xf6\xe2\xf1\xfe\xc1\x8cG\x9cB\x99\xe0\x94\xa8x|\\\xd5V\xd7\xd1\xb0\xc4\xa6\xdc\xeb\xb0\xc0G\xbbF'
DEBUG:localtuya.pytuya:decrypted result=''
DEBUG:localtuya.pytuya:Failed to connect to 10.0.0.240. Raising Exception.
WARNING:localtuya.pytuya:Failed to get status: Expecting value: line 1 column 1 (char 0)
INFO:localtuya:TIMEOUT: No response from device XXXXX [10.0.0.240] after 2 attempts.
No @JeffResc , you actually made it worse: when you re-pair a device, a new localKey is generated so now you are no longer able to decrypt the messages. You should now determine the new localKey and start using that. When you retry with the new key, you'd better just kill the app rather than deleting the device. Or, alternatively, disconnect your phone (s) while you run tuyadebug on your PC. Let us know if you get a better output...
@rospogrigio — Thanks for the help with my issue. In the Tuya app, I specifically chose the option to disconnect while not deleting data in hopes that the key would remain the same, that was my bad. I put my phone and apple watch completely in airplane mode and got the new key from the tuya-cli wizard. Then, I used it in the localtuya test script and the results seem similar to the ones I got the first time around.
jeff@DESKTOP-SHC2B57:~/localtuya-homeassistant/tuyadebug$ ./test.py XXXXX 10.0.0.240 YYYYY 3.3
INFO:localtuya:localtuya version 0.0.19
INFO:localtuya:Python 3.8.2 (default, Jul 16 2020, 14:00:26)
[GCC 9.3.0] on linux
INFO:localtuya:Using pytuya version '8.1.0'
INFO:localtuya:Detecting list of available DPS of device XXXXX [10.0.0.240], protocol 3.3.
DEBUG:localtuya.pytuya:Sending command status (device type: type_0a)
DEBUG:localtuya.pytuya:paylod=b'{"gwId":"XXXXX","devId":"XXXXX"}'
DEBUG:localtuya.pytuya:decode payload=b'#\xf3\xa4\x91\xca\xd8\xb4\xe9)\xcf\x94W`D\xcf\xb2g_\x04od\xc0\xc0\x92\x1f\x82@\xa4\x17\xf6%\\'
DEBUG:localtuya.pytuya:'data unvalid' error detected: switching to dev_type 'type_0d'
DEBUG:localtuya.pytuya:Re-send status due to device type change (type_0a -> type_0d)
DEBUG:localtuya.pytuya:Sending command status (device type: type_0d)
DEBUG:localtuya.pytuya:paylod=b'{"devId":"XXXXX","uid":"XXXXX","t":"1602037147","dps":{"1":null,"2":null,"3":null,"4":null,"5":null,"6":null,"7":null,"8":null,"9":null,"10":null}}'
DEBUG:localtuya.pytuya:Failed to connect to 10.0.0.240. Raising Exception.
WARNING:localtuya.pytuya:Failed to get status: timed out
INFO:localtuya:Detecting list of available DPS of device XXXXX [10.0.0.240], protocol 3.3.
DEBUG:localtuya.pytuya:Sending command status (device type: type_0a)
DEBUG:localtuya.pytuya:paylod=b'{"gwId":"XXXXX","devId":"XXXXX"}'
DEBUG:localtuya.pytuya:decode payload=b'#\xf3\xa4\x91\xca\xd8\xb4\xe9)\xcf\x94W`D\xcf\xb2g_\x04od\xc0\xc0\x92\x1f\x82@\xa4\x17\xf6%\\'
DEBUG:localtuya.pytuya:'data unvalid' error detected: switching to dev_type 'type_0d'
DEBUG:localtuya.pytuya:Re-send status due to device type change (type_0a -> type_0d)
DEBUG:localtuya.pytuya:Sending command status (device type: type_0d)
DEBUG:localtuya.pytuya:paylod=b'{"devId":"XXXXX","uid":"XXXXX","t":"1602037154","dps":{"1":null,"2":null,"3":null,"4":null,"5":null,"6":null,"7":null,"8":null,"9":null,"10":null}}'
DEBUG:localtuya.pytuya:Failed to connect to 10.0.0.240. Raising Exception.
WARNING:localtuya.pytuya:Failed to get status: timed out
INFO:localtuya:Detecting list of available DPS of device XXXXX [10.0.0.240], protocol 3.3.
DEBUG:localtuya.pytuya:Sending command status (device type: type_0a)
DEBUG:localtuya.pytuya:paylod=b'{"gwId":"XXXXX","devId":"XXXXX"}'
DEBUG:localtuya.pytuya:decode payload=b'#\xf3\xa4\x91\xca\xd8\xb4\xe9)\xcf\x94W`D\xcf\xb2g_\x04od\xc0\xc0\x92\x1f\x82@\xa4\x17\xf6%\\'
DEBUG:localtuya.pytuya:'data unvalid' error detected: switching to dev_type 'type_0d'
DEBUG:localtuya.pytuya:Re-send status due to device type change (type_0a -> type_0d)
DEBUG:localtuya.pytuya:Sending command status (device type: type_0d)
DEBUG:localtuya.pytuya:paylod=b'{"devId":"XXXXX","uid":"XXXXX","t":"1602037162","dps":{"1":null,"2":null,"3":null,"4":null,"5":null,"6":null,"7":null,"8":null,"9":null,"10":null}}'
DEBUG:localtuya.pytuya:Failed to connect to 10.0.0.240. Raising Exception.
WARNING:localtuya.pytuya:Failed to get status: timed out
INFO:localtuya:TIMEOUT: No response from device XXXXX [10.0.0.240] after 2 attempts.
Yes, the situation is unchanged. I believe you have the same issue that SmartM-ui is talking about in the forum ( https://community.home-assistant.io/t/tuya-local-with-energy-monitoring-and-without-tuya-convert/173564/248 ). I don't know if @postlund is able to debug this since it's a situation we never encountered before: a device that seems to be a type_0d device but that is not responding to the usual payload for the status request. I'm afraid that we need to try out something new, and for this either you or him give us SSH access to your system so we can try things, and I'm not even sure we can find a way. One more question: does this device work with tuya-cli? That would be a very good starting point. Let us know
Since it's quite easy to decrypt the traffic, it would be great if we could get a traffic dump. Do you think you can provide that @JeffResc? TCP port 6668 locally to the device is what is interesting, not sure how the cloud protocol works.
@rospogrigio I'm not too familiar with Tuya-cli, but I think I've tried the correct commands, but still no luck. Here's the outputs:
PS C:\Users\jeffr> tuya-cli get --ip 10.0.0.240 --id XXXXX --key YYYYY -a --protocol-version 3.1
parse data error
PS C:\Users\jeffr> tuya-cli get --ip 10.0.0.240 --id XXXXX --key YYYYY -a --protocol-version 3.3
events.js:292
throw er; // Unhandled 'error' event
^
Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('json obj data unvalid')
at TuyaDevice.emit (events.js:304:17)
at Socket.<anonymous> (C:\Users\jeffr\AppData\Roaming\npm\node_modules\@tuyapi\cli\node_modules\tuyapi\index.js:319:22)
at Socket.emit (events.js:315:20)
at addChunk (_stream_readable.js:295:12)
at readableAddChunk (_stream_readable.js:271:9)
at Socket.Readable.push (_stream_readable.js:212:10)
at TCP.onStreamRead (internal/stream_base_commons.js:186:23)
Emitted 'error' event on TuyaDevice instance at:
at Socket.<anonymous> (C:\Users\jeffr\AppData\Roaming\npm\node_modules\@tuyapi\cli\node_modules\tuyapi\index.js:335:18)
at Socket.emit (events.js:315:20)
[... lines matching original stack trace ...]
at TCP.onStreamRead (internal/stream_base_commons.js:186:23) {
code: 'ERR_UNHANDLED_ERROR',
context: 'json obj data unvalid'
}
As for SSH access, I'd feel comfortable spinning up a VM that's connected to the network to be able to diagnose this, if need be.
@postlund I'm not sure if you had a specifc program in mind, but I loaded up WireShark and filtered out traffic specifically involving the IP address of the device. About every 5 seconds, it would send a UDP packet to to 255.255.255.255, which probably just contains a basic broadcast message. I tried controlling it via the Tuya App and still no traffic came up. My phone is also jailbroken so I was able to load the network requests the Tuya App was making and it seemed that all the requests went to the cloud even though I was on the same network as the device. Not sure what to make of this...
As for SSH access, I'd feel comfortable spinning up a VM that's connected to the network to be able to diagnose this, if need be.
Yes, that's very reasonable, I'm pretty ok with this as long as it runs linux and tuyadebug scripts.
Edit: I actually would not now what to try to do at the moment, so probably it's better to follow postlund's advice and try to sniff the traffic to see what the device is expecting to receive for the request.
@JeffResc Humm, ok. I guess this would require us to force the app into not using cellular and going via local access instead. If it even does. But... maybe the cloud protocol looks similar to the local one, wouldn't be surprised. If you load up one of those dumps and look at the payload, first and foremost: which transport protocol is used to the cloud? HTTPS? In that case, you should set up mitmproxy and dump the decrypted traffic that. Otherwise we have no use for that data. All tuya messages are prefixed with 0x000055AA and suffixed with 0x0000AA55, so that is what you are looking for.
I opened Wireshark on my computer filtering out all traffic not involving the IP of my phone or the LED controller and nothing useful came up. Only some broadcasts from the controller.
I then setup the mitmproxy where I was able to see some Tuya API calls, but they turned out to only be going to the Tuya logging server.
Am I doing this right or is there something else I can try?
@JeffResc That sounds about right. Not sure what the Tuya logging server, what is that? Could you see the message content?
Yes, of course, here it is:
So I can't find any payload in the request, but I can find the response.
Request URL: https://52.35.22.129/log.json Response JSON:
{
"result" : true,
"success" : true,
"status" : "ok",
"t" : 1603197325590
}
I would like to note that this occurs on app open, not requiring any action like toggling or changing anything to make this request happen.
Hmm, that fint help much. Maybe it sends the data over cellular anyways? What if you go to airplane mode, then enable wifi and try to sniff again?
@postlund I actually used my phone’s built-in network sniffer (it was easier to get running quickly, only had a minute or two this morning) so it should’ve captured both, but I can try the more extensive method again tonight.
@JeffResc Maybe you can try #114 and see if it works? It performs a brute force "scan" by utilizing a small trick... By setting a DP to None
, it triggers the device to send a status update with current value of that DP. So I just try to do that for some common DPS. It takes a lot of time, but would still like to know if it works. Just open custom_components/localtuya/pytuya/__init__.py
, scroll to the bottom, update details to your device and run:
python custom_components/localtuya/pytuya/__init__.py
@JeffResc To get up to speed on this, would you mind installing localtuya from master, enable debug logs, try to add your device via config flow and paste the log here?
Any update on this? I have the same issue
2020-11-26 20:21:37 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for localtuya which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-11-26 20:21:37 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for alexa_media which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-11-26 20:21:49 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {'ip': '192.168.0.183', 'gwId': 'bf282edaba06af1808ohfy', 'active': 2, 'ablilty': 0, 'encrypt': True, 'productKey': 'key9u7yre98p7c4d', 'version': '3.3'}
2020-11-26 20:21:49 DEBUG (MainThread) [custom_components.localtuya.discovery] Listening to broadcasts on UDP port 6666 and 6667
2020-11-26 20:21:52 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {'ip': '192.168.0.152', 'gwId': '72118327d8bfc0079078', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key5seknqafuq9un', 'version': '3.3'}
2020-11-26 20:22:01 WARNING (MainThread) [homeassistant.components.webhook] Received message for unregistered webhook 06ade171a174f26c777acd5c98b6f7f1f44fb0a0c7abaa08f406b50fdf5aeaec from cloud
2020-11-26 20:22:35 DEBUG (MainThread) [custom_components.localtuya.light] [bf2...hfy] Adding light.device_light_2 with configuration: {'platform': 'light', 'friendly_name': 'Device Light', 'id': 1, 'color_mode': 21, 'brightness': 22, 'color': 5, 'brightness_lower': 29, 'brightness_upper': 255, 'color_temp_min_kelvin': 2700, 'music_mode': False, 'color_temp_max_kelvin': 6500}
2020-11-26 20:22:35 DEBUG (MainThread) [custom_components.localtuya.common] [bf2...hfy] Connecting to 192.168.0.183
2020-11-26 20:22:36 DEBUG (MainThread) [custom_components.localtuya.common] [bf2...hfy] Waiting 0 seconds before connecting
2020-11-26 20:22:36 DEBUG (MainThread) [custom_components.localtuya.common] [bf2...hfy] Connecting to 192.168.0.183
2020-11-26 20:22:36 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Started heartbeat loop
2020-11-26 20:22:36 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Sending command heartbeat (device type: type_0a)
2020-11-26 20:22:36 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Send payload: b'{}'
2020-11-26 20:22:36 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Waiting for sequence number -100
2020-11-26 20:22:36 DEBUG (MainThread) [custom_components.localtuya.common] [bf2...hfy] Retrieving initial state
2020-11-26 20:22:36 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Sending command status (device type: type_0a)
2020-11-26 20:22:36 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Send payload: b'{"gwId":"bf282edaba06af1808ohfy","devId":"bf282edaba06af1808ohfy"}'
2020-11-26 20:22:36 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Waiting for sequence number 1
2020-11-26 20:22:36 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Dispatching message TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211)
2020-11-26 20:22:36 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Got heartbeat response
2020-11-26 20:22:36 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Dispatching message TuyaMessage(seqno=1, cmd=10, retcode=1, payload=b"p0'5\x7f\x9c7]\xf2\x18\x97=\x1d\xa2B\n\xae|\xd7N \xa9C\xa5\xa1\xa6-\xaf\x12\xc1\x02\xe3", crc=1612451843)
2020-11-26 20:22:36 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Dispatching sequence number 1
2020-11-26 20:22:36 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Decrypted payload: {}
2020-11-26 20:22:36 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] switching to dev_type type_0d
2020-11-26 20:22:36 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Re-send status due to device type change (type_0a -> type_0d)
2020-11-26 20:22:36 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Sending command status (device type: type_0d)
2020-11-26 20:22:36 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Send payload: b'{"devId":"bf282edaba06af1808ohfy","uid":"bf282edaba06af1808ohfy","t":"1606414956","dps":{"1":null,"22":null,"21":null,"5":null}}'
2020-11-26 20:22:36 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Waiting for sequence number 2
2020-11-26 20:22:36 WARNING (MainThread) [custom_components.fasthue.sensor] sensor.hue_polling_interval: Modifying the scan_interval from 0:00:05 to 0:00:01
2020-11-26 20:22:36 WARNING (MainThread) [custom_components.fasthue.sensor] sensor.hue_polling_interval: Added to HASS with update interval: 0:00:01
2020-11-26 20:22:37 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Dispatching message TuyaMessage(seqno=0, cmd=8, retcode=0, payload=b'3.3\x00\x00\x00\x00\x00\x00\x00\x14\x00\x00\x00\x01\xd6\xbf2\xbd\xdch\xb1\xb6\xcd\xc3?\xa2\xaf\xc7t\xe5-}\x92F\xbe4|\x06\xfe\xf3=\xe4\xe5\xdfl\xa6\x8a\xaa\xe10*C\x16\xd1<\xf3?\xe7\xa1\x87{\x06', crc=4089238216)
2020-11-26 20:22:37 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Got status update
2020-11-26 20:22:37 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Decrypted payload: {"dps":{"21":"colour"},"t":1606414956}
2020-11-26 20:22:37 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Dispatching message TuyaMessage(seqno=2, cmd=13, retcode=0, payload=b'', crc=2380353348)
2020-11-26 20:22:37 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Dispatching sequence number 2
2020-11-26 20:22:37 WARNING (SyncWorker_33) [custom_components.localtuya.light] [bf2...hfy] Entity light.device_light_2 is requesting unknown DPS index 1
2020-11-26 20:22:37 WARNING (SyncWorker_33) [custom_components.localtuya.light] [bf2...hfy] Entity light.device_light_2 is requesting unknown DPS index 22
2020-11-26 20:22:37 WARNING (SyncWorker_33) [custom_components.localtuya.light] [bf2...hfy] Entity light.device_light_2 is requesting unknown DPS index 5
2020-11-26 20:22:37 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Decrypted payload: {}
2020-11-26 20:22:37 WARNING (SyncWorker_0) [custom_components.localtuya.light] [bf2...hfy] Entity light.device_light_2 is requesting unknown DPS index 1
2020-11-26 20:22:37 WARNING (SyncWorker_0) [custom_components.localtuya.light] [bf2...hfy] Entity light.device_light_2 is requesting unknown DPS index 22
2020-11-26 20:22:37 WARNING (SyncWorker_0) [custom_components.localtuya.light] [bf2...hfy] Entity light.device_light_2 is requesting unknown DPS index 5
2020-11-26 20:22:44 WARNING (MainThread) [homeassistant.components.light] Setup of light platform flux_led is taking over 10 seconds.
2020-11-26 20:22:56 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Sending command heartbeat (device type: type_0d)
2020-11-26 20:22:56 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Send payload: b'{}'
2020-11-26 20:22:56 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Waiting for sequence number -100
2020-11-26 20:22:57 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Dispatching message TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211)
2020-11-26 20:22:57 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Got heartbeat response
2020-11-26 20:22:57 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Decrypted payload: {}
2020-11-26 20:23:17 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Sending command heartbeat (device type: type_0d)
2020-11-26 20:23:17 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Send payload: b'{}'
2020-11-26 20:23:17 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Waiting for sequence number -100
2020-11-26 20:23:17 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Dispatching message TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211)
2020-11-26 20:23:17 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Got heartbeat response
2020-11-26 20:23:17 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Decrypted payload: {}
2020-11-26 20:23:37 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Sending command heartbeat (device type: type_0d)
2020-11-26 20:23:37 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Send payload: b'{}'
2020-11-26 20:23:37 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Waiting for sequence number -100
2020-11-26 20:23:37 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Dispatching message TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211)
2020-11-26 20:23:37 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Got heartbeat response
2020-11-26 20:23:37 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Decrypted payload: {}
2020-11-26 20:23:57 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Sending command heartbeat (device type: type_0d)
2020-11-26 20:23:57 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Send payload: b'{}'
2020-11-26 20:23:57 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Waiting for sequence number -100
2020-11-26 20:23:57 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Dispatching message TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211)
2020-11-26 20:23:57 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Got heartbeat response
2020-11-26 20:23:57 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Decrypted payload: {}
2020-11-26 20:24:17 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Sending command heartbeat (device type: type_0d)
2020-11-26 20:24:17 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Send payload: b'{}'
2020-11-26 20:24:17 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Waiting for sequence number -100
2020-11-26 20:24:17 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Dispatching message TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211)
2020-11-26 20:24:17 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Got heartbeat response
2020-11-26 20:24:17 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Decrypted payload: {}
2020-11-26 20:24:37 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Sending command heartbeat (device type: type_0d)
2020-11-26 20:24:37 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Send payload: b'{}'
2020-11-26 20:24:37 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Waiting for sequence number -100
2020-11-26 20:24:37 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Dispatching message TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211)
2020-11-26 20:24:37 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Got heartbeat response
2020-11-26 20:24:37 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Decrypted payload: {}
2020-11-26 20:24:57 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Sending command heartbeat (device type: type_0d)
2020-11-26 20:24:57 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Send payload: b'{}'
2020-11-26 20:24:57 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Waiting for sequence number -100
2020-11-26 20:24:57 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Dispatching message TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211)
2020-11-26 20:24:57 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Got heartbeat response
2020-11-26 20:24:57 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...hfy] Decrypted payload: {}
This is my log, I added the device using configuration.yml
This is the cli result
~ » tuya-cli get --ip 192.168.0.183 --id bf282edaba06af1808ohfy --key 2c0a2d7b5558b346 -a --protocol-version 3.3
node:events:306
throw er; // Unhandled 'error' event
^
Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('json obj data unvalid')
at new NodeError (node:internal/errors:277:15)
at TuyaDevice.emit (node:events:318:17)
at Socket.<anonymous> (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:319:22)
at Socket.emit (node:events:329:20)
at addChunk (node:internal/streams/readable:304:12)
at readableAddChunk (node:internal/streams/readable:279:9)
at Socket.Readable.push (node:internal/streams/readable:218:10)
at TCP.onStreamRead (node:internal/stream_base_commons:192:23)
Emitted 'error' event on TuyaDevice instance at:
at Socket.<anonymous> (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:335:18)
at Socket.emit (node:events:329:20)
[... lines matching original stack trace ...]
at TCP.onStreamRead (node:internal/stream_base_commons:192:23) {
code: 'ERR_UNHANDLED_ERROR',
context: 'json obj data unvalid'
}
--------------------------------------------------------------------------------
~ » tuya-cli get --ip 192.168.0.183 --id bf282edaba06af1808ohfy --key 2c0a2d7b5558b346 -a --protocol-version 3.1
parse data error
No update on this. We have a few issues open with similar issues, not sure when we will see a solution.
Same error here, novostella 1300lm works with Tuya integration, also work with home bridge but not with Tuya local
Same issue wtih Smart PIR sensor. I can't find it with the localtuya and if I try to log it using the IP it gives the same error:
Traceback (most recent call last):
File "/config/custom_components/localtuya/config_flow.py", line 279, in async_step_basic_info
self.dps_strings = await validate_input(self.hass, user_input)
File "/config/custom_components/localtuya/config_flow.py", line 192, in validate_input
detected_dps = await interface.detect_available_dps()
File "/config/custom_components/localtuya/pytuya/__init__.py", line 510, in detect_available_dps
data = await self.status()
File "/config/custom_components/localtuya/pytuya/__init__.py", line 472, in status
status = await self.exchange(STATUS)
File "/config/custom_components/localtuya/pytuya/__init__.py", line 451, in exchange
msg = await self.dispatcher.wait_for(seqno)
File "/config/custom_components/localtuya/pytuya/__init__.py", line 240, in wait_for
await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout)
File "/usr/local/lib/python3.8/asyncio/tasks.py", line 501, in wait_for
raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError
i have the same issue with two white dimmable light bulbs:
2022-02-20 15:49:51 ERROR (MainThread) [custom_components.localtuya.config_flow] Unexpected exception
Traceback (most recent call last):
File "/usr/local/lib/python3.9/asyncio/locks.py", line 413, in acquire
await fut
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/asyncio/tasks.py", line 492, in wait_for
fut.result()
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/config/custom_components/localtuya/config_flow.py", line 283, in async_step_basic_info
self.dps_strings = await validate_input(self.hass, user_input)
File "/config/custom_components/localtuya/config_flow.py", line 196, in validate_input
detected_dps = await interface.detect_available_dps()
File "/config/custom_components/localtuya/pytuya/__init__.py", line 539, in detect_available_dps
data = await self.status()
File "/config/custom_components/localtuya/pytuya/__init__.py", line 481, in status
status = await self.exchange(STATUS)
File "/config/custom_components/localtuya/pytuya/__init__.py", line 460, in exchange
msg = await self.dispatcher.wait_for(seqno)
File "/config/custom_components/localtuya/pytuya/__init__.py", line 247, in wait_for
await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout)
File "/usr/local/lib/python3.9/asyncio/tasks.py", line 494, in wait_for
raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError
It used to work perfectly fine a few weeks ago, until i accidentally reseted my light bulbs and had to add them again. Could it be a problem of re-adding devices that have already been connected?
Hello, I'm unable to add the Lumary RGBCCT LED Controller after trying to add it via config flow. On the "Add Tuya device" screen it says "An unknown error occurred. See log for details." Here's the log as well: