Harmony websocket crashing node-red

Been using "node-red-contrib-harmony-websocket" for years. Today it caused node-red crash while in use. When I tried to restart node-red this error in the log...

$ Start Node-RED

Once Node-RED has started, point a browser at http://192.168.1.4:1880
On Pi Node-RED works better with the Firefox or Chrome browser

Use node-red-stop to stop Node-RED
Use node-red-start to start Node-RED again
Use node-red-log to view the recent log output
Use sudo systemctl enable nodered.service to autostart Node-RED at every boot
Use sudo systemctl disable nodered.service to disable autostart on boot

To find more nodes and example flows - go to http://flows.nodered.org

Starting as a systemd service.
nodered.service: Referenced but unset environment variable evaluates to an empty string: NODE_RED_OPTIONS
18 Jun 23:41:32 - [info]
Welcome to Node-RED

18 Jun 23:41:32 - [info] Node-RED version: v4.0.9
18 Jun 23:41:32 - [info] Node.js version: v20.19.2
18 Jun 23:41:32 - [info] Linux 6.8.0-60-generic x64 LE
18 Jun 23:41:32 - [info] Loading palette nodes
18 Jun 23:41:33 - [info] node-red-contrib-shelly version: v11.6.1
18 Jun 23:41:33 - [info] Dashboard version 3.6.5 started at /ui
18 Jun 23:41:33 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
18 Jun 23:41:34 - [info] Settings file : /home/mark/.node-red/settings.js
18 Jun 23:41:34 - [info] Context store : 'default' [module=memory]
18 Jun 23:41:34 - [info] User directory : /home/mark/.node-red
18 Jun 23:41:34 - [warn] Projects disabled : editorTheme.projects.enabled=false
18 Jun 23:41:34 - [info] Flows file : /home/mark/.node-red/flows.json
18 Jun 23:41:34 - [info] Server now running at http://127.0.0.1:1880/
18 Jun 23:41:34 - [warn] Using unencrypted credentials
18 Jun 23:41:34 - [info] Starting flows
18 Jun 23:41:34 - [error] [e-mail:xxxxxxxxxx@vtext.com] No e-mail userid set
18 Jun 23:41:34 - [info] Started flows
Shelly gen2 server is listening on port 10001
18 Jun 23:41:34 - [info] [mqtt-broker:MQTT] Connected to broker: mqtt://192.168.1.4:1883
18 Jun 23:41:34 - [red] Uncaught Exception:
18 Jun 23:41:34 - [error] TypeError: Cannot read properties of null (reading 'open') at Harmony.sendCommand (/home/mark/.node-red/node_modules/harmony-websocket/lib/harmony-websocket.js:411:29)
at /home/mark/.node-red/node_modules/bad-node-red-contrib-harmony-websocket/lib/hub.js:258:46
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at runNextTicks (node:internal/process/task_queues:64:3)
at processImmediate (node:internal/timers:454:9)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.
nodered.service: Consumed 3.899s CPU time.

No idea why this is happening now,,,,,

At this point I need some advice how to get back into node-red to understand why Harmony node is causing the crash...
The Harmony hub is working fine I can access the it via Logitech app on my phone....

Read this from the node's Github issues page .. seems related

You can start Node-red in "safe mode" with node-red --safe
Your flows don't run but the editor is available, so hopefully you can investigate or delete any nodes causing a crash.
A deploy then restarts Node-red normally.

1 Like

Thank you that allow me to get back in. Now to understand why harmony nodes causing the crash

First thanks "node-red --safe" which has help in working this problem. I thought I had correct issue by removing all flows using the "node-red-contrib-harmony-websocket" Then removing/reinstalling "node-red-contrib-harmony-websocket", Then importing the flows and redeploying. Things have been fine for 5 days then again the issues has occurred.

After some days of watching the node-red logs I captured the following.. (see log attached below.) concerning "HarmonyWS" closing and opening, finally closing at HarmonyWS at 14:18:55... Node red then crashed at 14:23:36, that is when I request HarmonyWS to switch the on stereo.

After that the log contains cycling of node-red restarts and crashs. The only fix I have found is again remove flows using HarmonyWS, then remove/reinstall "node-red-contrib-harmony-websocket"...

As before the Harmony Hub is online, and the Harmony app on my phone can access the hub and control all devices.

Again at a point on how to precede in trouble shooting this issue.

mark@OptiPlex9020M:/var/log/mosquitto$ node-red-log

26 Jun 04:12:31 - [info] Node-RED version: v4.0.9
26 Jun 04:12:31 - [info] Node.js  version: v20.19.2
26 Jun 04:12:31 - [info] Linux 6.8.0-60-generic x64 LE
26 Jun 04:12:31 - [info] Loading palette nodes
26 Jun 04:12:33 - [info] node-red-contrib-shelly version: v11.6.1
26 Jun 04:12:34 - [info] Dashboard version 3.6.5 started at /ui
26 Jun 04:12:34 - [info] Settings file  : /home/mark/.node-red/settings.js
26 Jun 04:12:34 - [info] Context store  : 'default' [module=memory]
26 Jun 04:12:34 - [info] User directory : /home/mark/.node-red
26 Jun 04:12:34 - [warn] Projects disabled : editorTheme.projects.enabled=false
26 Jun 04:12:34 - [info] Flows file     : /home/mark/.node-red/flows.json
26 Jun 04:12:34 - [info] Server now running at http://127.0.0.1:1880/
26 Jun 04:12:34 - [warn] Using unencrypted credentials
26 Jun 04:12:35 - [info] Starting flows
26 Jun 04:12:35 - [error] [e-mail:xxxxxxxxxxxx] No e-mail userid set
26 Jun 04:12:35 - [info] Started flows
Shelly gen2 server is listening on port 10001
26 Jun 04:12:35 - [info] [mqtt-broker:MQTT] Connection failed to broker: mqtt://192.168.1.4:1883
26 Jun 04:12:35 - [info] HarmonyWS open (192.168.1.244)
26 Jun 04:12:50 - [info] [mqtt-broker:MQTT] Connected to broker: mqtt://192.168.1.4:1883
26 Jun 02:27:07 - [info] HarmonyWS close (192.168.1.244)
26 Jun 02:27:07 - [info] HarmonyWS open (192.168.1.244)
26 Jun 08:17:49 - [error] [http request:GEt Venstar status] RequestError: connect EHOSTUNREACH 192.168.1.245:80
26 Jun 12:50:15 - [info] HarmonyWS close (192.168.1.244)
26 Jun 12:50:15 - [info] HarmonyWS open (192.168.1.244)
26 Jun 14:15:25 - [info] HarmonyWS close (192.168.1.244)
26 Jun 14:15:25 - [info] HarmonyWS open (192.168.1.244)
26 Jun 14:15:56 - [warn] [shelly-gen2:e938fd258c4f87a6] Error in executeCommand2: /rpc/Shelly.GetStatus  --> Error: getaddrinfo ENOTFOUND shellyplus1-b8d61a8a8b48.local
26 Jun 14:18:51 - [warn] [shelly-gen2:d3d9917014d7dbc7] Error in executeCommand2: /rpc/Shelly.GetStatus  --> AxiosError: timeout of 5022ms exceeded
26 Jun 14:18:55 - [info] HarmonyWS close (192.168.1.244)
26 Jun 14:23:36 - [red] Uncaught Exception:
26 Jun 14:23:36 - [error] TypeError: Cannot read properties of null (reading 'open')
    at Harmony.sendCommand (/home/mark/.node-red/node_modules/harmony-websocket/lib/harmony-websocket.js:411:29)
    at /home/mark/.node-red/node_modules/node-red-contrib-harmony-websocket/lib/hub.js:258:46
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at runNextTicks (node:internal/process/task_queues:64:3)
    at processImmediate (node:internal/timers:454:9)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.

There is an open issue from 2023: crashed node-red · Issue #27 · lopelex/node-red-contrib-harmony · GitHub

I don't hood much faith in it being fixed any time soon. You could try adding a me too to see if the owner responds?

Looking at the output, it is not just the harmony websocket, but the mqtt broker, 'shelly-gen2', 'GEt Venstar status' all fail, do you have network connectivity ?

Yes, I know they all show a failure. During my testing I have found that as soon as flows using "HarmonyWS " are removed, these he other failures stopped. I will be watching the logs the next few days to see if these errors reoccur

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.