Node-Red cannot connect to Home Assistant

Hi,

I restarted my HA yesterday and since then Node-Red has not been able to connect back to HA.

I have multiple repeating logs in NR:

11 Jul 10:24:55 - [info] [server:Home Assistant (auto)] Connecting to http://supervisor/core
11 Jul 10:24:55 - [info] [server:Home Assistant (auto)] Connected to http://supervisor/core
11 Jul 10:24:56 - [info] [server:Home Assistant (auto)] Connection closed to http://supervisor/core

“Home Assistant (auto)” is the name of my sever connection, its using the “I use the Home Assistant Add-on” option.

I believe the corresponding logs in Supervisor are:

22-07-11 10:29:05 INFO (MainThread) [supervisor.api.proxy] WebSocket access from a0d7b954_nodered
22-07-11 10:29:05 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request running
22-07-11 10:29:05 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API error: Received message 258:WebSocketError(<WSCloseCode.MESSAGE_TOO_BIG: 1009>, 'Message size 4322971 exceeds limit 4194304') is not str
22-07-11 10:29:05 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API connection is closed

NR was showing nodes with “running” text underneath, every few seconds showing “connecting” for a split second. After selecting a server on a node, entities aren’t available for selection, sometimes I see the “deploy a valid server config for autocomplete to show results” toast message.

I’ve tried the “backup, rename folder, uninstall, restart, reinstall” option but didn’t change anything. Have also tried to connect to HA with username/access_token, instead of using the “I use the Home Assistant Add-on” option.

I’ve tried NR without importing any flows and, after importing, I’ve disabled all flows and restarted multiple times, both NR and HA.

Node-RED: 12.0.2
Home Assistant 2022.7.3
Supervisor 2022.07.0
Operating System 8.2

Please let me know if there is any more information I can share. Am really not sure what has changed, or how to debug the issue any further.

Regards,

Mike

How did you restart HA?
Just the Core, through Developer Tools → Yaml, and if so did you also restart the Node Red Addon?
Did you try a restart of the entire host, through Settings → Ssytem → Hardware → 3 dots in upper right corner?

All the above!

I tried Settings>Sytem>Restart a few times before uninstalling NR, evening pulling the power once. Since reinstalling NR i’ve restarted the addon twice. None of them helped.

2022.7.3 update became available while trying to debug the issue, so HA has even gone through an update and restart since.

This is not an error with the connection to HA, but rather that the received input to a node is too big.
I got that one a few times when trying to pull a SNMP subtree from a device and it simple sent too much to the node.
The solution is to limit the input to the node by narrowing your filter down.

I’ve disabled every flow in NR thinking something I created has caused this, but error persists. If all my flows are disabled, what could be causing this?

FWIW, I don’t pull any information from anywhere but HA. The automations were all working fine before the restart.

What does the node red logs say?

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/00-banner.sh
-----------------------------------------------------------
 Add-on: Node-RED
 Flow-based programming for the Internet of Things
-----------------------------------------------------------
 Add-on version: 12.0.2
 You are running the latest version of this add-on.
 System: Home Assistant OS 8.2  (aarch64 / raspberrypi4-64)
 Home Assistant Core: 2022.7.3
 Home Assistant Supervisor: 2022.07.0
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
cont-init: info: /etc/cont-init.d/00-banner.sh exited 0
cont-init: info: running /etc/cont-init.d/01-log-level.sh
cont-init: info: /etc/cont-init.d/01-log-level.sh exited 0
cont-init: info: running /etc/cont-init.d/customizations.sh
cont-init: info: /etc/cont-init.d/customizations.sh exited 0
cont-init: info: running /etc/cont-init.d/nginx.sh
cont-init: info: /etc/cont-init.d/nginx.sh exited 0
cont-init: info: running /etc/cont-init.d/node-red.sh
patching file nodes/ui_base.html
Hunk #1 succeeded at 1164 (offset 633 lines).
up to date, audited 123 packages in 4s
6 packages are looking for funding
  run `npm fund` for details
6 high severity vulnerabilities
To address all issues (including breaking changes), run:
  npm audit fix --force
Run `npm audit` for details.
cont-init: info: /etc/cont-init.d/node-red.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun nginx (no readiness notification)
services-up: info: copying legacy longrun nodered (no readiness notification)
s6-rc: info: service legacy-services successfully started
[15:41:38] INFO: Starting Node-RED...
> start
> node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"
11 Jul 15:41:42 - [info] 
Welcome to Node-RED
===================
11 Jul 15:41:42 - [info] Node-RED version: v2.2.2
11 Jul 15:41:42 - [info] Node.js  version: v16.15.0
11 Jul 15:41:42 - [info] Linux 5.15.32-v8 arm64 LE
11 Jul 15:41:44 - [info] Loading palette nodes
11 Jul 15:41:50 - [info] Settings file  : /etc/node-red/config.js
11 Jul 15:41:50 - [info] Context store  : 'default' [module=memory]
11 Jul 15:41:50 - [info] User directory : /config/node-red/
11 Jul 15:41:50 - [warn] Projects disabled : editorTheme.projects.enabled=false
11 Jul 15:41:50 - [info] Flows file     : /config/node-red/flows.json
11 Jul 15:41:50 - [info] Server now running at http://127.0.0.1:46836/
[15:41:50] INFO: Starting NGinx...
11 Jul 15:41:50 - [info] Starting flows
11 Jul 15:41:50 - [info] [hue-bridge:Philips hue] Initializing the bridge (192.168.20.166)…
11 Jul 15:41:51 - [info] Started flows
11 Jul 15:41:51 - [info] [server:Home Assistant] Connecting to http://localhost:8123
11 Jul 15:41:51 - [info] [hue-bridge:Philips hue] Connected to bridge
11 Jul 15:41:51 - [info] [server:Home Assistant] Connected to http://localhost:8123
11 Jul 15:41:52 - [info] [hue-bridge:Philips hue] Processing bridge resources…
11 Jul 15:41:52 - [info] [hue-bridge:Philips hue] Initial emit of resource states…
11 Jul 15:41:53 - [info] [hue-bridge:Philips hue] Keeping nodes up-to-date…
11 Jul 15:41:53 - [info] [hue-bridge:Philips hue] Subscribing to bridge events…
11 Jul 15:41:53 - [info] [mqtt-broker:mqtt] Connected to broker: mqtt://localhost:1883
11 Jul 15:41:55 - [info] [server:Home Assistant (auto)] Connecting to http://supervisor/core
11 Jul 15:41:55 - [info] [server:Home Assistant (auto)] Connected to http://supervisor/core
11 Jul 15:41:56 - [info] [server:Home Assistant (auto)] Connection closed to http://supervisor/core
11 Jul 15:42:01 - [info] [server:Home Assistant (auto)] Connecting to http://supervisor/core
11 Jul 15:42:01 - [info] [server:Home Assistant (auto)] Connected to http://supervisor/core
11 Jul 15:42:01 - [info] [server:Home Assistant (auto)] Connection closed to http://supervisor/core
11 Jul 15:42:06 - [info] [server:Home Assistant (auto)] Connecting to http://supervisor/core
11 Jul 15:42:06 - [info] [server:Home Assistant (auto)] Connected to http://supervisor/core
11 Jul 15:42:06 - [info] [server:Home Assistant (auto)] Connection closed to http://supervisor/core

The last 3 logs just keep on repeating.

Maybe some of the nodes have a breaking change.
It mentions 6 packages with issues.
Not sure how you get it started in safe mode so you can update the packages.

I’ve tried a fresh install of NR, no flows, just whatever comes out of the box.

  1. uninstalled NR
  2. renamed folder
  3. restarted (System>Hardware)
  4. installed NR
  5. set to “auto start on boot” and restarted as above
  6. started NR
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/00-banner.sh
-----------------------------------------------------------
 Add-on: Node-RED
 Flow-based programming for the Internet of Things
-----------------------------------------------------------
 Add-on version: 12.0.2
 You are running the latest version of this add-on.
 System: Home Assistant OS 8.2  (aarch64 / raspberrypi4-64)
 Home Assistant Core: 2022.7.3
 Home Assistant Supervisor: 2022.07.0
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
cont-init: info: /etc/cont-init.d/00-banner.sh exited 0
cont-init: info: running /etc/cont-init.d/01-log-level.sh
cont-init: info: /etc/cont-init.d/01-log-level.sh exited 0
cont-init: info: running /etc/cont-init.d/customizations.sh
cont-init: info: /etc/cont-init.d/customizations.sh exited 0
cont-init: info: running /etc/cont-init.d/nginx.sh
cont-init: info: /etc/cont-init.d/nginx.sh exited 0
cont-init: info: running /etc/cont-init.d/node-red.sh
patching file nodes/ui_base.html
Hunk #1 succeeded at 1164 (offset 633 lines).
up to date, audited 1 package in 709ms
found 0 vulnerabilities
cont-init: info: /etc/cont-init.d/node-red.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun nginx (no readiness notification)
services-up: info: copying legacy longrun nodered (no readiness notification)
s6-rc: info: service legacy-services successfully started
[12:06:08] INFO: Starting Node-RED...
> start
> node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"
12 Jul 12:06:12 - [info] 
Welcome to Node-RED
===================
12 Jul 12:06:12 - [info] Node-RED version: v2.2.2
12 Jul 12:06:12 - [info] Node.js  version: v16.15.0
12 Jul 12:06:12 - [info] Linux 5.15.32-v8 arm64 LE
12 Jul 12:06:14 - [info] Loading palette nodes
12 Jul 12:06:19 - [info] Dashboard version 3.1.7 started at /endpoint/ui
12 Jul 12:06:21 - [info] Settings file  : /etc/node-red/config.js
12 Jul 12:06:21 - [info] Context store  : 'default' [module=memory]
12 Jul 12:06:21 - [info] User directory : /config/node-red/
12 Jul 12:06:21 - [warn] Projects disabled : editorTheme.projects.enabled=false
12 Jul 12:06:21 - [info] Flows file     : /config/node-red/flows.json
12 Jul 12:06:21 - [info] Server now running at http://127.0.0.1:46836/
12 Jul 12:06:21 - [info] Starting flows
12 Jul 12:06:21 - [info] Started flows
[12:06:21] INFO: Starting NGinx...
12 Jul 12:06:26 - [info] [server:Home Assistant] Connecting to http://supervisor/core
12 Jul 12:06:26 - [info] [server:Home Assistant] Connected to http://supervisor/core
12 Jul 12:06:27 - [info] [server:Home Assistant] Connection closed to http://supervisor/core
12 Jul 12:06:32 - [info] [server:Home Assistant] Connecting to http://supervisor/core
12 Jul 12:06:32 - [info] [server:Home Assistant] Connected to http://supervisor/core
12 Jul 12:06:32 - [info] [server:Home Assistant] Connection closed to http://supervisor/core

Supervisor still complains:

22-07-12 12:09:37 INFO (MainThread) [supervisor.api.proxy] WebSocket access from a0d7b954_nodered
22-07-12 12:09:37 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request running
22-07-12 12:09:38 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API error: Received message 258:WebSocketError(<WSCloseCode.MESSAGE_TOO_BIG: 1009>, 'Message size 4385986 exceeds limit 4194304') is not str
22-07-12 12:09:38 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API connection is closed

Any ideas? I’m not even sure how to debug this issue any further.

For anyone having the same issue that finds this thread, the issue was caused by another integration. I had a Unifi connection bringing data into HA and the alerts were sending huge volume of information all of a sudden and caused failures on HA.

I only saw this by accident, after switching logs to debug level, and saw a ton of json coming through.

After removing this integration and restart of HA, NodeRed started working immediately.

Issue Resolved.

I solved the problem for my installation:
The “problem” is that ALL entities are sent in a single websocket call.

  • I hence looked at my entities under “Developer Tools/States”. I had A LOT of device tracker entities with an unknown state. Probably left overs from a previously used BLE tracker.
  • I then went to my /config directory, and looked at “known_devices” file. It was blown up to 3.8kb with A LOT of entries. As I don’t really need the know_devices file I made a copy of it and deleted the original file.
  • After a restart of HA the error was gone, and Node Red worked fine again
2 Likes

Hey, just wanted to say thanks for this. I had exactly the same problem and really didn’t think about looking at the BLE tracker entities!

Now resolved thanks to you.

1 Like

this doesnt seems to help me at all… I’ve disabled all nodes and I’m still seeing it… I’ve removed the unifi and ble tracker integrations… no change at all

I’ve also wiped the Node red, the config/node-red folder, and done a fresh install… Still getting the error with only a single getState node… so pretty sure this is not an issue with a specific node within node-red itself…

Make a new post with a description of your problem and post logs from both HA core and the addons own logs.