rospogrigio / localtuya

local handling for Tuya devices
GNU General Public License v3.0
2.84k stars 545 forks source link

Uncaught exception causes crash of node red #1551

Closed tamueller closed 10 months ago

tamueller commented 10 months ago

I have four tuya thermostats and with one of them there seems to be a problem and I can't connect properly to the devide. This is causing an exception whenever I try to communicate with it. The problem is, that the exception is not handeld and caused Node Red to crash completely. The fact that it can crash NR is also a NR bug, but I think every exception should be handled within LocalTuya itself as well. It only happens when the device is powered though, if it's completely offline it does not happen.

But again, this issue is not about the connection issue itself, but about the fact that the exception is unhandled in LocalTuya and causes crashes of NodeRed.

Environment

Steps to reproduce

1.

Provide Home Assistant traceback/logs

put your log output between these markers

6 Nov 12:10:46 - [error] Error: No connection has been made to the device. at TuyaDevice._send (/config/node-red/node_modules/node-red-contrib-tuya-local/node_modules/tuyapi/index.js:235:13) at /config/node-red/node_modules/node-red-contrib-tuya-local/node_modules/tuyapi/index.js:215:14 at new Promise (<anonymous>) at TuyaDevice.set (/config/node-red/node_modules/node-red-contrib-tuya-local/node_modules/tuyapi/index.js:212:12) at setDevice (/config/node-red/node_modules/node-red-contrib-tuya-local/tuya-local.js:59:12) at TuyaNode._inputCallback (/config/node-red/node_modules/node-red-contrib-tuya-local/tuya-local.js:122:4) at /opt/node_modules/@node-red/runtime/lib/nodes/Node.js:210:26 at Object.trigger (/opt/node_modules/@node-red/util/lib/hooks.js:166:13) at TuyaNode.Node._emitInput (/opt/node_modules/@node-red/runtime/lib/nodes/Node.js:202:11) at TuyaNode.Node.emit (/opt/node_modules/@node-red/runtime/lib/nodes/Node.js:186:25)

I added the above mentioned loglevels to the file, but can't find any more verbose logs in the normal HA logs. Are they stored in a different place?

Additional information

tamueller commented 10 months ago

I just realised that this is a bug of node-red-contrib-tuya-local, not of localtuya, sorry!