vinodsr / node-red-contrib-tuya-smart-device

a node-red module for managing tuya smart devices
https://flows.nodered.org/node/node-red-contrib-tuya-smart-device
MIT License
47 stars 15 forks source link

Issue connecting to Tuya light under 4.1.1 #73

Closed ratsputin closed 3 years ago

ratsputin commented 3 years ago

I'm consistently getting the following error:

find() timed out. Is the device powered on and the ID or IP correct?

Here are the steps I followed:

I retrieved all of the keys using tuya-cli wizard:

root@ha:/var/log# tuya-cli wizard
? Do you want to use these saved API credentials? xxxxxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy us Yes
? Provide a 'virtual ID' of a device currently registered in the app: 805..............aad
[ { name: 'Light #7',
    id: '805..............aad',
    key: '9cb..........57a' },
            :
            :
            :
  { name: 'Light #1',
    id: '....................',
    key: '................' } ]

I then deployed a tuya - smart - device node and filled in:

Device Name: Light #7
Device Virutal ID: 805..............aad
Device IP (Static):
Device Key: 9cb..........57a

I deploy it and the node cycles between connecting and Can't find device.

I have verified these values in the Tuya IoT Platform; the device id is definitely correct.

Any suggestions as to what might not be working?

ratsputin commented 3 years ago

Okay. I did just dig through the syslog. This is what I'm seeing:

Sep 24 19:35:52 ha Node-RED[745605]: 24 Sep 19:35:52 - [info] [tuya-smart-device:Light #7] startComm(): Connecting to Tuya with params {"id":"805..............aad","key":"9cb..........57a","ip":"","issueGetOnConnect":false,"nullPayloadOnJSONError":false,"version":"3.1"} , findTimeout :  10000 , retryTimeout:  10000
Sep 24 19:35:52 ha Node-RED[745605]: 24 Sep 19:35:52 - [info] [tuya-smart-device:Light #7] findDevice(): Initiating the find command
Sep 24 19:36:02 ha Node-RED[745605]: 24 Sep 19:36:02 - [error] [tuya-smart-device:Light #7] find() timed out. Is the device powered on and the ID or IP correct?

Not really very helpful... Anything else I can check?

ratsputin commented 3 years ago

This is a TuyAPI issue--I was able to reproduce the issue using the sample code from there. Sorry to be a bother.

ratsputin commented 3 years ago

I was able to resolve the issue, although not in the way I wanted to.

I had to specify the IP address of the device as well as the device ID. This was the local IP address (not the public one specified on the Tuya site). Additionally, I had to specify the protocol version of 3.3.

This was a suggestion made in a ticket that had been closed on TuyAPI.