Node RED Docker not connecting to HA, logs empty, no autocomplete

I haven't been successful trying to get Node RED (node-red-contrib-home-assistant-websocket) to connect to Home Assistant for a while now.

I'm running HA 2022.12.6 and Node RED 3.0.2 with node-red-contrib-home-assistant-websocket 0.47.1.

Running the node-red container in bridge mode with port 1880 forwarded results in not finding the HA instance in the web UI. Adding the server manually nets: "Deploy a valid server config for autocomplete to show results."

When running it in host mode, the HA instance is found. Adding it still nets the above-mentioned message and no autocomplete results.

Running

sudo docker exec -it nodered bash
ping *homeassistant*
echo < /dev/tcp/*homeassistant*/8123

works both in host mode and in bridge mode.

Configuring the logging output in data/settings.js to

    logging: {
        console: {
            level: "trace",

does not help either.

docker compose logs -f nodered

does not yield any info regarding the home assistant integration.

Docker is running on a single host machine. Using one compose file versus two separate ones does not change the outcome.

compose.yaml for node-red

services:
  nodered:
    container_name: nodered
    image: nodered/node-red:latest
    restart: unless-stopped
    volumes:
      - ./data:/data
    ports:
      - "1880:1880"

compose.yaml for Home Assistant

services:
  homeassistant:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    restart: unless-stopped
    volumes:
      - ./homeassistant:/config
    network_mode: host

Hello,
I'm not a pro, but here is my docker compose.yaml file.
Node red is functioning with this. (on a pi4 with raspios 64bit).
Working from de base directory /opt.
I followed this tutorial to install and configure the all of my stuffs : http://sequr.be/blog/

file :

services:
  portainer:
    container_name: portainer
    image: portainer/portainer-ce:latest
    restart: unless-stopped
    ports:
      - "9000:9000/tcp"
      - "9443:9443/tcp"
    environment:
      - TZ=Europe/Brussels
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock
      - /opt/portainer/data:/data

  homeassistant:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    restart: unless-stopped
    environment:
      - TZ=Europe/Brussels
    volumes:
      - /opt/homeassistant/config:/config
      - /etc/localtime:/etc/localtime:ro
      - /run/dbus:/run/dbus:ro # <-- Bluetooth adapter

    privileged: true
    network_mode: host
    depends_on:
      - mariadb
      - influxdb
      - mosquitto
    
  mariadb:
    container_name: mariadb
    image: mariadb
    restart: unless-stopped
    ports:
      - "3306:3306/tcp"
    environment:
      - TZ=Europe/Brussels
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
      - MYSQL_DATABASE=${MYSQL_HA_DATABASE}
      - MYSQL_USER=${MYSQL_HA_USER}
      - MYSQL_PASSWORD=${MYSQL_HA_PASSWORD}
    volumes:
      - /opt/mariadb/data:/var/lib/mysql
      - /opt/mariadb/config/:/etc/mysql/conf.d
  
  influxdb:
    container_name: influxdb
    image: influxdb
    restart: unless-stopped
    ports:
      - "8086:8086/tcp"   # So we can access the WebUI
    environment:
      - TZ=Europe/Brussels
      - DOCKER_INFLUXDB_INIT_MODE=setup
      - DOCKER_INFLUXDB_INIT_USERNAME=${INFLUXDB_USER}
      - DOCKER_INFLUXDB_INIT_PASSWORD=${INFLUXDB_PASSWORD}
      - DOCKER_INFLUXDB_INIT_ORG=${INFLUXDB_ORG}
      - DOCKER_INFLUXDB_INIT_BUCKET=${INFLUXDB_BUCKET}
    volumes:
      - /opt/influxdb/data:/var/lib/influxdb2
      - /opt/influxdb/config/:/etc/influxdb2
    ulimits:
      nofile:
        soft: 32768
        hard: 32768

  hass-configurator:
    container_name: hassconf
    image: causticlab/hass-configurator-docker
    restart: unless-stopped
    ports:
      - "3218:3218/tcp"
    volumes:
      - /opt/hassconf/config:/config
      - /opt/homeassistant/config:/hass-config
    depends_on:
      - homeassistant

  adminer:
    container_name: adminer
    image: adminer
    restart: unless-stopped
    ports:
      - "8080:8080/tcp"
    depends_on:
      - mariadb

  mosquitto:
    container_name: mosquitto
    image: eclipse-mosquitto
    restart: unless-stopped
    ports:
      - "1883:1883/tcp"
    environment:
      - TZ=Europe/Brussels
    volumes:
      - /opt/mosquitto/config:/mosquitto/config
      - /opt/mosquitto/data:/mosquitto/data
      - /opt/mosquitto/log:/mosquitto/log
    stdin_open: true
    tty: true

  nodered:
    container_name: nodered
    image: nodered/node-red
    restart: unless-stopped
    ports:
      - "1880:1880/tcp"
    environment:
      - TZ=Europe/Brussels
    volumes:
      - /opt/nodered/data:/data
    depends_on:
      - homeassistant
      - mosquitto

  duplicati:
    container_name: duplicati
    image: duplicati/duplicati
    restart: unless-stopped
    ports:
      - "8200:8200/tcp"
    environment:
      - TZ=Europe/Brussels
    volumes:
      - /opt/duplicati/data:/data
      - /mnt/backup/duplicati:/backups
      - /opt:/source

  esphome:
    container_name: esphome
    image: esphome/esphome
    restart: unless-stopped
    ports:
      - "6052:6052/tcp"
    environment:
      - TZ=Europe/Brussels
    # mDNS doesn't work across VLANs, use static IP for devices when disabling mDNS
    #   - ESPHOME_DASHBOARD_USE_PING=true
    volumes:
      - /opt/esphome/config:/config
      - /etc/localtime:/etc/localtime:ro
    # devices:
    #   - /dev/ttyUSB0:/dev/ttyUSB0
    network_mode: host

  zigbee2mqtt:
    container_name: zigbee2mqtt
    image: koenkk/zigbee2mqtt
    restart: unless-stopped
    ports:
      - "8099:8099/tcp"
    environment:
      - TZ=Europe/Brussels
    volumes:
      - /opt/zigbee2mqtt/data:/app/data
      - /run/udev:/run/udev:ro
    devices:
      - /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0:/dev/ttyACM0

I've forgotten :
to access HA with nodered , when launched, install the "node-red-contrib-home-assistant-websocket" palette, and use don't thick the "Using the Home Assistant Add-on" box. Just create a long term Access token in HA and use it when creating the HA server in nodered. (and install nodered companion in ha too)
This is functional for me.

Hi and thanks for replying.
Your compose file (at least the parts concerning HA and node red) matches mine except for the TZ env variable which I added now. Still no bueno :frowning:

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