Node-RED Stops working every few hours / days

Hi all. I’ve been running Node-Red for about 2 months, but in the past few weeks it keeps failing, requiring me to restart it from HassIO. It will then run for another day / few hours before failing again.

My setup is this:
HassIO running on Raspberry Pi3
DuckDNS running with LetsEncrypt
Dnsmasq to make requests to my DuckDNS url to resolve to the local IP of my Pi3

As I type this, it’s currently in the ‘failed’ state, where none of my home automations are working. If I go in to Node-RED web interface, the HA nodes still say connected. And from looking at the log, it is still connected to HA in some way because it is triggering events, but for some reason, is unable to act on them. Here is the most recent log which was detecting movement on my hallway sensor, and trying to turn on a scene:

8 Oct 13:00:06 - [warn] [api-call-service:Upstairs Hallway Lights On (Bright)] Error calling service, home assistant api error
8 Oct 13:00:06 - [error] [api-call-service:Upstairs Hallway Lights On (Bright)] Error calling service, home assistant api error

I’ve just clicked Restart, and suddenly, everything is working again. At least for a few hours. Given that this is not a constant issue i.e. it is still connected to Home Assistant, and does work some of the time, I’m not sure how to debug this. Any ideas?

This is known issue with the node that comes with the addon “node-red-contrib-home-assistant”.
I would suggest trying the fork “node-red-contrib-home-assistant-websocket”

I’ve installed the package “node-red-contrib-home-assistant-websocket”, but I can’t seem to disable the default one. How do I make sure I’m using the new nodes instead?

I never was able to uninstall the default HA node. Instead I exported all of my flows unistalled Node-Red and used the https://github.com/notoriousbdg/hassio-addons version which allows you to choose which node you want to use.

I’m using node-red-contrib-home-assistant-websocket and I also had this issue happen twice in a month. Node-RED continues to be able to call services on HA, but does not react to events from HA. Probably some websocket issue.
It always happen after rebooting HA a few times.

I am also experiencing the same issue. It stops working after a few days. Using“node-red-contrib-home-assistant”

Only start working again after I do a “Restart Workflows” in the Deploy button

No error logs in node-red but tons of error in home-assistant.log. Not sure if it is related to the websocket.

ERROR (MainThread) [homeassistant] Error doing job: Fatal read error on socket transport
Traceback (most recent call last):
  File "/usr/lib/python3.7/asyncio/selector_events.py", line 801, in _read_ready__data_received
    data = self._sock.recv(self.max_size)
TimeoutError: [Errno 110] Connection timed out

Been loving node-red due to the simplicity of configuring scripts. With this issue, seem like it is a better idea to move to native automations in HA

Usually this happens if you restart HA a lot OR if you are flooding the websocket connection using nodes like “events:all” and such. How many flows/nodes are you using in NR to HA?