I use the node-red-contrib-tuya-smart-device
node to connect to my Tuya devices and up until a few days ago everything was fine. However, the node now no longer connects to the devices.
I do not think that it is either the node or Node-Red that is the direct cause of the problem because I loaded the node into another instance of Node-Red and it works OK.
The only difference in the two instances is that the one failing runs on a Pi 3 using a wireless connection to the network and the other is on a Pi 4 using ethernet. The Node-Red log of each instance is below.
Failing Log
Starting as a systemd service.
15 Apr 15:52:13 - [info]
Welcome to Node-RED
===================
15 Apr 15:52:13 - [info] Node-RED version: v1.3.2
15 Apr 15:52:13 - [info] Node.js version: v14.16.1
15 Apr 15:52:13 - [info] Linux 5.10.17-v7+ arm LE
15 Apr 15:52:14 - [info] Loading palette nodes
15 Apr 15:52:22 - [info] +-----------------------------------------------------
15 Apr 15:52:22 - [info] | uibuilder initialised:
15 Apr 15:52:22 - [info] | root folder: /home/pi/.node-red/uibuilder
15 Apr 15:52:22 - [info] | version . .: 3.2.1
15 Apr 15:52:22 - [info] | packages . : socket.io,jquery,vue,bootstrap,bootstrap-vue
15 Apr 15:52:22 - [info] +-----------------------------------------------------
15 Apr 15:52:23 - [info] Worldmap version 2.13.1
15 Apr 15:52:23 - [info] Dashboard version 2.28.2 started at /ui
15 Apr 15:52:24 - [info] Settings file : /home/pi/.node-red/settings.js
15 Apr 15:52:24 - [info] HTTP Static : /home/pi/.node-red/public
15 Apr 15:52:24 - [info] Context store : 'memoryOnly' [module=memory]
15 Apr 15:52:24 - [info] Context store : 'file' [module=localfilesystem]
15 Apr 15:52:24 - [info] User directory : /home/pi/.node-red
15 Apr 15:52:24 - [warn] Projects disabled : editorTheme.projects.enabled=false
15 Apr 15:52:24 - [info] Flows file : /home/pi/.node-red/flows.json
15 Apr 15:52:24 - [info] Server now running at http://127.0.0.1:1880/
15 Apr 15:52:24 - [info] Starting flows
15 Apr 15:52:26 - [info] Started flows
15 Apr 15:52:26 - [info] [sqlitedb:22bc96f2.863d0a] opened /media/usbDrive/HomeAutomation.db ok
15 Apr 15:52:26 - [info] [mqtt-broker:MQTT 21] Connected to broker: mqtt://192.168.1.21:1883
15 Apr 15:52:26 - [info] [mqtt-broker:MQTT 20] Connected to broker: mqtt://192.168.1.20:1883
15 Apr 15:53:56 - [info] Stopping modified nodes
15 Apr 15:53:57 - [info] Stopped modified nodes
15 Apr 15:53:57 - [info] Starting modified nodes
15 Apr 15:53:57 - [info] [tuya-smart-device:Study Light] Recieved the config {"id":"2bb98158.7e48be","type":"tuya-smart-device","z":"2be5023b.9f1aee","deviceName":"Study Light","deviceId":"xx","deviceKey":"xx","deviceIp":"","retryTimeout":1000,"findTimeout":1000,"tuyaVersion":"3.1","x":1360,"y":860,"wires":[[]]}
15 Apr 15:53:57 - [info] [tuya-smart-device:Study Light] Connecting to Tuya with params {"id":"xx","key":"xx","ip":"","issueGetOnConnect":false,"nullPayloadOnJSONError":false,"version":"3.1"} , findTimeout : 1000 , retryTimeout: 1000
15 Apr 15:53:57 - [info] Started modified nodes
15 Apr 15:53:58 - [info] [tuya-smart-device:Study Light] initiating the find command
15 Apr 15:54:01 - [error] [tuya-smart-device:Study Light] Error: Error from socket
(node:7559) UnhandledPromiseRejectionWarning: Error: connect EHOSTUNREACH 192.168.1.153:6668
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:7559) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:7559) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
15 Apr 15:54:01 - [info] [tuya-smart-device:Study Light] Disconnected from tuyaDevice.
15 Apr 15:54:04 - [error] [tuya-smart-device:Study Light] Error: Error from socket
(node:7559) UnhandledPromiseRejectionWarning: Error: connect EHOSTUNREACH 192.168.1.153:6668
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
(node:7559) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
15 Apr 15:54:05 - [info] [tuya-smart-device:Study Light] Disconnected from tuyaDevice.
Successful Log.
15 Apr 18:37:48 - [info]
Welcome to Node-RED
===================
15 Apr 18:37:48 - [info] Node-RED version: v1.3.1
15 Apr 18:37:48 - [info] Node.js version: v14.16.1
15 Apr 18:37:48 - [info] Linux 5.10.17-v7l+ arm LE
15 Apr 18:37:48 - [info] Loading palette nodes
15 Apr 18:37:54 - [info] +-----------------------------------------------------
15 Apr 18:37:54 - [info] | uibuilder initialised:
15 Apr 18:37:54 - [info] | root folder: /home/pi/.node-red/uibuilder
15 Apr 18:37:54 - [info] | version . .: 3.2.1
15 Apr 18:37:54 - [info] | packages . : jquery,socket.io,vue,bootstrap,bootstrap-vue
15 Apr 18:37:54 - [info] +-----------------------------------------------------
15 Apr 18:37:54 - [info] Worldmap version 2.13.0
15 Apr 18:37:54 - [info] Dashboard version 2.28.2 started at /ui
15 Apr 18:37:55 - [info] Settings file : /home/pi/.node-red/settings.js
15 Apr 18:37:55 - [info] HTTP Static : /home/pi/.node-red/public
15 Apr 18:37:55 - [info] Context store : 'memoryOnly' [module=memory]
15 Apr 18:37:55 - [info] Context store : 'file' [module=localfilesystem]
15 Apr 18:37:55 - [info] User directory : /home/pi/.node-red
15 Apr 18:37:55 - [warn] Projects disabled : editorTheme.projects.enabled=false
15 Apr 18:37:55 - [info] Flows file : /home/pi/.node-red/flows.json
15 Apr 18:37:55 - [info] Server now running at http://127.0.0.1:1880/
15 Apr 18:37:55 - [info] Starting flows
15 Apr 18:37:56 - [info] [tuya-smart-device:Study Light] Recieved the config {"id":"d14f0d82.934d1","type":"tuya-smart-device","z":"4f112ad7.fccf94","deviceName":"Study Light","deviceId":"xx","deviceKey":"xx","deviceIp":"","retryTimeout":1000,"findTimeout":1000,"tuyaVersion":"3.1","x":780,"y":1300,"wires":[[]]}
15 Apr 18:37:56 - [info] [tuya-smart-device:Study Light] Connecting to Tuya with params {"id":"xx","key":"xx","ip":"","issueGetOnConnect":false,"nullPayloadOnJSONError":false,"version":"3.1"} , findTimeout : 1000 , retryTimeout: 1000
15 Apr 18:37:56 - [info] Started flows
15 Apr 18:37:56 - [info] [sqlitedb:7ef7e7da.8bc2b8] opened /media/usbDrive/HomeAutomation.db ok
15 Apr 18:37:56 - [info] [zigbee2mqtt-server:83162ab9.755208] MQTT Connected
15 Apr 18:37:56 - [info] [zigbee2mqtt-server:83162ab9.755208] Refreshing devices
15 Apr 18:37:56 - [info] [mqtt-broker:MQTT 20] Connected to broker: mqtt://192.168.1.20:1883
15 Apr 18:37:56 - [info] [mqtt-broker:MQTT 21] Connected to broker: mqtt://192.168.1.21:1883
15 Apr 18:37:56 - [error] zigbee2mqtt: bridge status: offline
15 Apr 18:37:56 - [info] [zigbee2mqtt-server:83162ab9.755208] MQTT Subscribed to: "zigbee2mqtt/#
15 Apr 18:37:57 - [info] [tuya-smart-device:Study Light] initiating the find command
15 Apr 18:38:01 - [info] [tuya-smart-device:Study Light] Connected to device! xx
I have tried upgrading the node-red-contrib-tuya-smart-device
from v3.10 to 4.06 but it did not make any difference. Both logs above are using v3.10. v4.06 generates the same error message.
If anyone has any ideas as to what might be causing the problem I would love to hear from you.
(If of interest the Tuya devices work with both Google Home and Smartlife app both before and after the problem occurred)