Home Assistant Community

Node-Red (Docker) 'Losing' Connection

#1

I’m having an issue with Node-Red (V8 tag) in Docker appearing to lose connection to Home-Assistant, yet the Node-Red window only ever says it is connected.

  • I am using Home-Assistant 0.67.1 in Docker (host networking)
  • I am using Node-Red (V8) in Docker (bridge networking)
  • The automations I am testing in Node-Red use Xiaomi switches and Milight bulbs - these devices are all working correctly.
  • If I simply attach a debug node to an events node I can see all of the HA events after deploying. The automations also work after deploying.
  • After a period of time (not particularly long although I don’t know exactly) the automations stop working and the debug messages stop also.
  • Moving a node and redeploying will bring all of the automations back up and the debug messages start again.

I’ve checked the Home-Assistant and Node-Red logs (in portainer) but there is nothing obvious in there about why this might be happening. The fact Node-Red says ‘connected’ when it doesn’t appear to be makes me think that it is sleeping/hibernating or doing something in the background.

Obviously this is annoying, but the main thing i’m struggling with is where further to look for any issues that might be happening. Are there other log files that might help or any Docker commands that i’ve missed (i’ve used the recommended setups with volumes mounted from local filesystem).

0 Likes

Node-red-contrib-home-assistant-websocket
#2

Hi,

I’m facing the same problem, did you find a fix?

0 Likes

#3

I’m not sure what the actual problem was but I just changed the docker image network to host (the same as Home Assistant) and it worked fine.

0 Likes

#4

Ah oki that wil not work for me
I have hass.io on a raspberry pi and the node red on a windows pc with docker

0 Likes

#5

I have had the same problem for a long time. I recently rebuilt my whole system and put a watch dog in HA that will restart Node-Red if it becomes unresponsive. I did this following The Hook Up’s video on youtube but as I was already run HADockermon (and if you are not already you should 1000% start) I used that to restart Node-Red as I don’t run Hass.IO

So far I have seen the system works well and since I did this my Node-Red is running great.

Side note, once you get HADockermon deployed and the switches set up in HA, you can then quickly restart docker containers without firing up Portainer or a CLI. I even use it in an automation to occasionally reset the whole house (I also have containers for MQTT, Smartthings Bridge, MariaDB, and Grafana)

0 Likes

#6

I had the same problem with hass.io and running Node-Red in Docker from an external machine (being a Synology NAS and not a Windows machine). It ran great for a small amount of time and then it would lose it’s connection and the motion sensor for example wasn’t picked up anymore in Node-Red until making a small change of the automation or restart Node-Red alltogether.

So I changed the network configuration from bridge to host (using the switch –network host) and that fixed my problem. Now I have a constant connection from Node-Red to hass.io.

0 Likes

#7

I had this issue if they weren’t on the same internal Docker network (I don’t use the ‘host’ networking).

0 Likes

#8

https://github.com/hassio-addons/addon-node-red/issues/17 - it is not docker trouble, it is [node-red-contrib-home-assistant] bug. Author dont merge commits, and I think he leave this nodes.
I try to migrate to node-red-contrib-home-assistant-websocket

0 Likes

#9

You can read my reply here why this is occuring.

1 Like