Can't connect to my Home Assistant with node-red-contrib-home-assistant-websocket

Hi
I have a HA running on 172.25.100.199:58123 and then I have a Node-RED running on 172.25.100.199:51880 - both on docker.

I have installed the node-red-contrib-home-assistant-websocket node inside NodeRED and have installed the Node-RED Companion integrations inside HA.

I have got an "livetime token" from HA.
But my status on a "State_Changed" is "Connecting". why can't I get it to connect and then search my entitie id's?


Screenshot 2023-01-07 080535

[
    {
        "id": "a6f1796037e10f7e",
        "type": "server-state-changed",
        "z": "811e72d22026148f",
        "name": "",
        "server": "a21f7f80ac58b9b8",
        "version": 4,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 1,
        "output_only_on_state_change": true,
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": false,
        "ignoreCurrentStateUnavailable": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "",
                "valueType": "triggerId"
            }
        ],
        "x": 130,
        "y": 200,
        "wires": [
            [
                "33bb490ade388af6"
            ]
        ]
    },
    {
        "id": "33bb490ade388af6",
        "type": "api-call-service",
        "z": "811e72d22026148f",
        "name": "",
        "server": "a21f7f80ac58b9b8",
        "version": 5,
        "debugenabled": false,
        "domain": "",
        "service": "",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "sensor.temperature_3"
        ],
        "data": "",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [
            {
                "property": "temp",
                "propertyType": "msg",
                "value": "",
                "valueType": "num"
            }
        ],
        "queue": "none",
        "x": 370,
        "y": 200,
        "wires": [
            [
                "45d492a13b1f79af"
            ]
        ]
    },
    {
        "id": "45d492a13b1f79af",
        "type": "debug",
        "z": "811e72d22026148f",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 570,
        "y": 200,
        "wires": []
    },
    {
        "id": "a21f7f80ac58b9b8",
        "type": "server",
        "name": "Home Assistant",
        "version": 5,
        "addon": false,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": false,
        "heartbeatInterval": "30",
        "areaSelector": "friendlyName",
        "deviceSelector": "friendlyName",
        "entitySelector": "friendlyName",
        "statusSeparator": ": ",
        "statusYear": "hidden",
        "statusMonth": "short",
        "statusDay": "numeric",
        "statusHourCycle": "h23",
        "statusTimeFormat": "h:m",
        "enableGlobalContextStore": false
    }
]

Unfortunately, you will probably need to ask on a home assistant forum. Few here use HA, preferring to do everything in node red.

1 Like

Do you mean that you have installed a standalone instance of node red and also the node red integrations in HA? Like most others here I know little about HA, but I thought that HA installed its own version of node red. If that is correct then perhaps you have node-red running twice. I may be talking rubbish though.

I wouldn't be that blunt, but kinda :wink:

Not always. If you install docker version then HA doesn't come with NodeRed as an add-on.

You would need to describe the way you launched your containers (network config, docker-compose,...).

I guess you mean that HA as something like 58123:8123 in the port mapping?

Depending on you network configuration in docker 172.25.100.199:8123 (no 5 in the port number) may work...
And by the way, HA should be installed as "host" in docker configuration.

Well yes, I was talking rubbish apparently.

OK, understood, I hadn't realised that. Thanks.

I guess you mean that HA as something like 58123:8123 in the port mapping?

Yes its mapped to the "privat" range of the ports :slight_smile:

Depending on you network configuration in docker 172.25.100.199:8123 (no 5 in the port number) may work

No same yellow "connecting" message, as showed on image, with the ip/port.

And by the way, HA should be installed as "host" in docker configuration.

My docker is installed by this Docker composer script.

version: '3.7'
services:
  homeassistant:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    ports:
      - "172.25.100.199:58123:8123"
    environment:
      - TZ=Europe/Copenhagen
    volumes:
      - /share/homeassistant/config:/config
      - /etc/localtime:/etc/localtime:ro
    restart: always
    privileged: true
    devices:
      - /dev/ttyACM0:/dev/ttyACM0

This compose is IMHO better (and compliant with the doc)...

version: '3.7'
services:
  homeassistant:
    container_name: homeassistant
    image: "homeassistant/home-assistant:stable"
    network_mode: host
    environment:
      - TZ=Europe/Copenhagen
    volumes:
      - /share/homeassistant/config:/config
      - /etc/localtime:/etc/localtime:ro
    restart: always
    privileged: true
    devices:
      - /dev/ttyACM0:/dev/ttyACM0

With this HA is reachable using host IP and port 8123 and your nodered config should be updated accordingly.

Never seen such a syntax with the IP and then port... It may work, but, HA needs definitely host networking mode in docker.

1 Like

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