Giter VIP home page Giter VIP logo

Comments (8)

DarkerChild avatar DarkerChild commented on July 1, 2024 1

I am also having this issue. I have 8 Tuya smart lights (3 different types). If any of them are turned off Node-Red crashes. And it constantly crashes every hour or so even if they are all turned on. The same error is given. I have a catch node in the flows. I'm running V4.0.2 on NR v1.3.4.

9 May 13:22:56 - [red] Uncaught Exception:
9 May 13:22:56 - Error: connection timed out
    at Socket.<anonymous> (C:\Users\wkc41\.node-red\node_modules\tuyapi\index.js:442:18)
    at Object.onceWrapper (node:events:471:28)
    at Socket.emit (node:events:365:28)
    at Socket._onTimeout (node:net:475:8)
    at listOnTimeout (node:internal/timers:557:17)
    at processTimers (node:internal/timers:500:7)

Edit:
I have moved my Node-Red to the version you listed above and it has not crashed since.

from node-red-contrib-tuya-smart-device.

vinodsr avatar vinodsr commented on July 1, 2024

I am unable to replicate the error in my setup with node-red version 1.2.3

Can you please share the steps to create this error. In my case if the device is powered off, then the following message is logged

18 Apr 19:31:51 - [error] [tuya-smart-device:Monitor Plug] find() timed out. Is the device powered on and the ID or IP correct?
18 Apr 19:31:51 - [info] [tuya-smart-device:Monitor Plug] Cannot find the device, re-trying...

How to create the socket error ?

from node-red-contrib-tuya-smart-device.

MichalPolanik avatar MichalPolanik commented on July 1, 2024

In my case disconnecting the device from the power supply ends with an uncaught exception every time:

kwi 21 09:46:23 DietPi node-red[10502]: 21 Apr 09:46:23 - [info] [tuya-smart-device:xxx] initiating the find command
kwi 21 09:46:27 DietPi node-red[10502]: 21 Apr 09:46:27 - [info] [tuya-smart-device:xxx] Connected to device! 4780123456f520f448b4
kwi 21 09:46:29 DietPi node-red[10502]: 21 Apr 09:46:29 - [info] [tuya-smart-device:xxx] Data from device: {"devId":"4780123456f520f448b4","dps":{"4":23,"5":57},"t":1618991188}
kwi 21 09:46:34 DietPi node-red[10502]: 21 Apr 09:46:34 - [info] [tuya-smart-device:xxx] Data from device: {"devId":"4780123456f520f448b4","dps":{"6":2379},"t":1618991193}
kwi 21 09:46:39 DietPi node-red[10502]: 21 Apr 09:46:39 - [info] [tuya-smart-device:xxx] Data from device: {"devId":"4780123456f520f448b4","dps":{"6":2376},"t":1618991198}
~~ I PULLED THE PLUG FROM THE SOCKET ~~
kwi 21 09:49:09 DietPi node-red[10502]: 21 Apr 09:49:09 - [info] [tuya-smart-device:xxx] Disconnected from tuyaDevice.
kwi 21 09:49:15 DietPi node-red[10502]: 21 Apr 09:49:15 - [red] Uncaught Exception:
kwi 21 09:49:15 DietPi node-red[10502]: 21 Apr 09:49:15 - Error: connection timed out
kwi 21 09:49:15 DietPi node-red[10502]:     at Socket.<anonymous> (/mnt/dietpi_userdata/node-red/node_modules/tuyapi/index.js:442:18)
kwi 21 09:49:15 DietPi node-red[10502]:     at Object.onceWrapper (node:events:435:28)
kwi 21 09:49:15 DietPi node-red[10502]:     at Socket.emit (node:events:329:20)
kwi 21 09:49:15 DietPi systemd[1]: node-red.service: Main process exited, code=exited, status=1/FAILURE
kwi 21 09:49:15 DietPi systemd[1]: node-red.service: Unit entered failed state.
kwi 21 09:49:15 DietPi systemd[1]: node-red.service: Failed with result 'exit-code'.

The problem also occurs when the device has access to power but there is a connection problem for some reason.

from node-red-contrib-tuya-smart-device.

vinodsr avatar vinodsr commented on July 1, 2024

Request you to try the following scenario as well.

1 .Add a catch node to the same flow.
2. Unplug the device .

Is it still crashing node red

from node-red-contrib-tuya-smart-device.

MichalPolanik avatar MichalPolanik commented on July 1, 2024

1 .Add a catch node to the same flow.
2. Unplug the device .
Is it still crashing node red

Actually I had this node all the time. It doesn't matter whether I have catch node in this flow or not - after unplug device from the socket, Node-Red crashes literally every time.

But I have noticed, that when I start Node-Red service before plugging the device into the socket, the messages appear, thant you mentioned before:

  • message in the debug section of the application
"context": {
    "message": "Error: find() timed out. So is the device powered on and the ID or IP correct?",
(...)
  "error": {
    "message": "find() timed out. Is the device powered on and the ID or IP correct?",
(...)
  • and message in system logs
kwi 24 22:59:17 DietPi node-red[23057]: 24 Apr 22:59:17 - [info] [tuya-smart-device:xxx] Cannot find the device, re-trying...
kwi 24 22:59:17 DietPi node-red[23057]: 24 Apr 22:59:17 - [info] [debug:eaa19fd6.6522d]
kwi 24 22:59:17 DietPi node-red[23057]: {
kwi 24 22:59:17 DietPi node-red[23057]:   context: {
kwi 24 22:59:17 DietPi node-red[23057]:     message: Error: find() timed out. Is the device powered on and the ID or IP correct?
kwi 24 22:59:17 DietPi node-red[23057]:         at /mnt/dietpi_userdata/node-red/node_modules/tuyapi/index.js:801:13
kwi 24 22:59:17 DietPi node-red[23057]:         at Timeout._onTimeout (/mnt/dietpi_userdata/node-red/node_modules/p-timeout/index.js:25:13)
kwi 24 22:59:17 DietPi node-red[23057]:         at listOnTimeout (node:internal/timers:556:17)
kwi 24 22:59:17 DietPi node-red[23057]:         at processTimers (node:internal/timers:499:7),
kwi 24 22:59:17 DietPi node-red[23057]:     deviceVirtualId: '4780123456f520f448b4',
kwi 24 22:59:17 DietPi node-red[23057]:     deviceIp: '',
kwi 24 22:59:17 DietPi node-red[23057]:     deviceKey: 'xxxxxxxxxxxxxxxx'
kwi 24 22:59:17 DietPi node-red[23057]:   },
kwi 24 22:59:17 DietPi node-red[23057]:   error: {
kwi 24 22:59:17 DietPi node-red[23057]:     message: 'find() timed out. Is the device powered on and the ID or IP correct?',
kwi 24 22:59:17 DietPi node-red[23057]:     source: {
kwi 24 22:59:17 DietPi node-red[23057]:       id: '5948abe7.720de4',
kwi 24 22:59:17 DietPi node-red[23057]:       type: 'tuya-smart-device',
kwi 24 22:59:17 DietPi node-red[23057]:       name: 'xxx',
kwi 24 22:59:17 DietPi node-red[23057]:       count: 1
kwi 24 22:59:17 DietPi node-red[23057]:     }
kwi 24 22:59:17 DietPi node-red[23057]:   },
kwi 24 22:59:17 DietPi node-red[23057]:   _msgid: 'c3b9823f.680a7'
kwi 24 22:59:17 DietPi node-red[23057]: }
kwi 24 22:59:18 DietPi node-red[23057]: 24 Apr 22:59:18 - [info] [tuya-smart-device:xxx] initiating the find command

I will also mention, that I have three the same devices (SP111) in different rooms, so I have three tuya-smart-device nodes in one flow. Of course every device have different virtual ID, IP address and key.

All this time, I performed tests on the 1st device, which I marked as xxx in the logs, so in order to eliminate the defectiveness of the device itself, I decided to check whether the 2nd device (let's call it yyy) would have the same problems. Immediately after unplug the yyy device, Node-Red crashed.

from node-red-contrib-tuya-smart-device.

fah avatar fah commented on July 1, 2024

Same problem here.
I have one device that is connected via a wifi-repeater. This connection is sometimes not stable.

NR 2.3.0. in ioBroker 5.1.4 on an Rpi4
[email protected]

/opt/iobroker/log/iobroker.2021-06-04.log :

2021-06-04 00:00:35.857  - ^[[31merror^[[39m: node-red.0 (1756) 4 Jun 00:00:35 - [error] [tuya-smart-device:WP] Error: Error from socket: connect EHOSTUNREACH 192.168.10.191:6668
    at Socket.<anonymous> (/opt/iobroker/node_modules/node-red-contrib-tuya-smart-device/node_modules/tuyapi/index.js:492:30)
    at Socket.emit (events.js:314:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)

2021-06-04 00:00:35.860  - ^[[31merror^[[39m: node-red.0 (24670) Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, o$
2021-06-04 00:00:35.865  - ^[[31merror^[[39m: node-red.0 (24670) unhandled promise rejection: connect EHOSTUNREACH 192.168.10.191:6668
2021-06-04 00:00:35.867  - ^[[31merror^[[39m: node-red.0 (24670) Error: connect EHOSTUNREACH 192.168.10.191:6668
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16)
2021-06-04 00:00:35.868  - ^[[31merror^[[39m: node-red.0 (24670) Exception-Code: EHOSTUNREACH: connect EHOSTUNREACH 192.168.10.191:6668
2021-06-04 00:00:36.395  - ^[[33mwarn^[[39m: node-red.0 (24670) Terminated (UNCAUGHT_EXCEPTION): Without reason

I have no clue about node.js. But maybe this helps:

A search for

emitErrorNT (internal/streams/destroy.js:92:8)

yielded https://stackoverflow.com/questions/62416274/econnreset-error-crashing-nodejs-application

Other idea was promise and crashes:
https://stackoverflow.com/questions/21800010/how-do-i-handle-errors-with-promises

from node-red-contrib-tuya-smart-device.

stale avatar stale commented on July 1, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from node-red-contrib-tuya-smart-device.

stale avatar stale commented on July 1, 2024

Auto closing the issue

from node-red-contrib-tuya-smart-device.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.