Closed Saimond closed 1 year ago
I saw the same behaviour with my device I bought just today. It disconnected constantly and no request resulted in any response. By trial and error I found out that protocol version 3.4 fixes the issue. All communication seems to work now and no more disconnects. Unfortunately node-red-contrib-tuya-smart-device
hasn't been updated to TuyAPI version 7.5 yet which introduces support for protocol version 3.4. Hence I wasn't able to fix it in Node-RED, but my tests with tuya-cli were successful.
same behaviour:, connect, disconnect, connect... without status data
working solution for me (change to latest TuyAPI):
replaced existing node_modules/tuyapi files with latest versions from TuyAPI (copy/replacing, lib folder and index.js + package.json)
ok thanks for the answers...
after I posted it, I went after some solutions, I found tinytuya for python...
setting the device with version 3.4, it worked, so really, the problem is that you need to update to protocol 3.4...
I'm going to update node_modules/tuyapi, so I believe it will work perfectly...
Thanks!.
Issue closed to early, this nodered plugin needs to be adjusted. In the package.json file the dependency is tuyapi 7.3.0 (with exact version 7.3.0) I think it should adjusted to greater or equal 7.5.1 (>=7.5.1 for future updates in tuyapi) to provide tuya 3.4 protocol to everyone
My nodered reboot in this day has broken my copied over files to temporary fix this.
I will try to update the version asap
Hello vinodsr,
do you plan an update to the tuyapi 7.5.1? thanks br. JR
Merged the changes with PR . #110
Changes are now available with V5.1.0
@vinodsr how about update tuya api to 7.5.2 https://www.npmjs.com/package/tuyapi ??
@vinodsr I have several tuya devices. Some of them have the same problem. All of my devices have excellent wifi signal. All of my devs use protocol version 3.3. After initial connection all devices are detected and I receive data from them (e.g. voltage from sockets or humidity from HT sensor), after time (5-10-20 mins) some devices fail with this errors.
8 Jul 00:04:22 - [info] [tuya-smart-device:HOME OUTDOOR HT] Disconnected from tuyaDevice. shouldTryReconnect = true
8 Jul 00:04:23 - [info] [tuya-smart-device:Home Snaige] Retrying connection...
8 Jul 00:04:23 - [info] [tuya-smart-device:Home Snaige] Connected to device! name : Home Snaige, ip : 192.168.1.191
8 Jul 00:04:23 - [error] [tuya-smart-device:Home Snaige] Error from tuyaDevice. shouldTryReconnect = true, error = {}
8 Jul 00:04:23 - [error] [tuya-smart-device:Home Snaige] Error: Error from socket: read ECONNRESET
at Socket.<anonymous> (/Users/m/.node-red/node_modules/tuyapi/index.js:627:26)
at Socket.emit (node:events:519:28)
at emitErrorNT (node:internal/streams/destroy:169:8)
at emitErrorCloseNT (node:internal/streams/destroy:128:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
8 Jul 00:04:23 - [info] [tuya-smart-device:Home Snaige] Disconnected from tuyaDevice. shouldTryReconnect = true
8 Jul 00:04:32 - [error] [json:d2ffc2c8.f52098] Unexpected token '<', "<!DOCTYPE "... is not valid JSON
8 Jul 00:04:32 - [info] [tuya-smart-device:HOME OUTDOOR HT] Retrying connection...
8 Jul 00:04:32 - [info] [tuya-smart-device:HOME OUTDOOR HT] Connected to device! name : HOME OUTDOOR HT, ip : 192.168.1.209
8 Jul 00:04:32 - [error] [tuya-smart-device:HOME OUTDOOR HT] Error from tuyaDevice. shouldTryReconnect = true, error = {}
8 Jul 00:04:32 - [error] [tuya-smart-device:HOME OUTDOOR HT] Error: Error from socket: read ECONNRESET
at Socket.<anonymous> (/Users/m/.node-red/node_modules/tuyapi/index.js:627:26)
at Socket.emit (node:events:519:28)
at emitErrorNT (node:internal/streams/destroy:169:8)
at emitErrorCloseNT (node:internal/streams/destroy:128:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
8 Jul 00:04:32 - [info] [tuya-smart-device:HOME OUTDOOR HT] Disconnected from tuyaDevice. shouldTryReconnect = true
8 Jul 00:04:33 - [info] [tuya-smart-device:Home Snaige] Retrying connection...
8 Jul 00:04:34 - [info] [tuya-smart-device:Home Snaige] Connected to device! name : Home Snaige, ip : 192.168.1.191
8 Jul 00:04:34 - [error] [tuya-smart-device:Home Snaige] Error from tuyaDevice. shouldTryReconnect = true, error = {}
8 Jul 00:04:34 - [error] [tuya-smart-device:Home Snaige] Error: Error from socket: read ECONNRESET
at Socket.<anonymous> (/Users/m/.node-red/node_modules/tuyapi/index.js:627:26)
at Socket.emit (node:events:519:28)
at emitErrorNT (node:internal/streams/destroy:169:8)
at emitErrorCloseNT (node:internal/streams/destroy:128:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
8 Jul 00:04:34 - [info] [tuya-smart-device:Home Snaige] Disconnected from tuyaDevice. shouldTryReconnect = true
8 Jul 00:04:42 - [info] [tuya-smart-device:HOME OUTDOOR HT] Retrying connection...
8 Jul 00:04:42 - [info] [tuya-smart-device:HOME OUTDOOR HT] Connected to device! name : HOME OUTDOOR HT, ip : 192.168.1.209
8 Jul 00:04:42 - [error] [tuya-smart-device:HOME OUTDOOR HT] Error from tuyaDevice. shouldTryReconnect = true, error = {}
8 Jul 00:04:42 - [error] [tuya-smart-device:HOME OUTDOOR HT] Error: Error from socket: read ECONNRESET
at Socket.<anonymous> (/Users/m/.node-red/node_modules/tuyapi/index.js:627:26)
at Socket.emit (node:events:519:28)
at emitErrorNT (node:internal/streams/destroy:169:8)
at emitErrorCloseNT (node:internal/streams/destroy:128:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
It can reconnect them only by switching off the power or wi-fi. What to do?
"dependencies": { "tuyapi": "~7.5.1" },
patches are auto included as per the package json. a reinstall may add the latest tuya cli
Hello;
I recently purchased 10 Switch Wifi devices;
I'm linking with NodeRED, but it's generating the following situation:
Follows device information on Tuya API - Get Device Information
Here's the debug log on nodered
Device:
At the end of the configuration, I have the field of:
Versions:
NOTE: