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

**URL:** <https://discourse.nodered.org/t/cant-connect-to-my-home-assistant-with-node-red-contrib-home-assistant-websocket/73317>\
**Category:** General\
**Tags:** docker, home-assistant\
**Created:** [7 January 2023 07:07 UTC](https://discourse.nodered.org/t/cant-connect-to-my-home-assistant-with-node-red-contrib-home-assistant-websocket/73317 "2023-01-07T07:07:23Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![tpbillund](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tpbillund/32/37410_2.png) [@tpbillund](https://discourse.nodered.org/u/tpbillund)\
**Post date:** [7 January 2023 07:07 UTC](https://discourse.nodered.org/t/cant-connect-to-my-home-assistant-with-node-red-contrib-home-assistant-websocket/73317/1 "2023-01-07T07:07:23Z")

</div>

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 080507](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/a/8a335a541a4f884bd356838f1da5c50920f0e24f.jpeg)  
 ![Screenshot 2023-01-07 080535](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/d/4dfb549b8f35b82384920748a755eb83e3c55098.jpeg)

```auto
[
    {
        "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
    }
]

```

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [7 January 2023 08:34 UTC](https://discourse.nodered.org/t/cant-connect-to-my-home-assistant-with-node-red-contrib-home-assistant-websocket/73317/2 "2023-01-07T08:34:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [7 January 2023 09:05 UTC](https://discourse.nodered.org/t/cant-connect-to-my-home-assistant-with-node-red-contrib-home-assistant-websocket/73317/3 "2023-01-07T09:05:06Z")

</div>

> [@tpbillund](#):
>
> 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.

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.

---

<div class="post-metadata">

**Author:** ![greengolfer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/greengolfer/32/28276_2.png) [@greengolfer](https://discourse.nodered.org/u/greengolfer)\
**Post date:** [7 January 2023 14:27 UTC](https://discourse.nodered.org/t/cant-connect-to-my-home-assistant-with-node-red-contrib-home-assistant-websocket/73317/4 "2023-01-07T14:27:35Z")

</div>

> [@Colin](#):
>
> I may be talking rubbish though.

I wouldn't be that blunt, but kinda 😉

> [@Colin](#):
>
> I thought that HA installed its own version of node red.

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

> [@tpbillund](#):
>
> 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.

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.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [7 January 2023 16:50 UTC](https://discourse.nodered.org/t/cant-connect-to-my-home-assistant-with-node-red-contrib-home-assistant-websocket/73317/5 "2023-01-07T16:50:49Z")

</div>

> [@greengolfer](#):
>
> > [@Colin](#):
> >
> > I may be talking rubbish though.
> 
> I wouldn't be that blunt, but kinda 😉

Well yes, I was talking rubbish apparently.

> [@greengolfer](#):
>
> If you install docker version then HA doesn't come with NodeRed as an add-on.

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

---

<div class="post-metadata">

**Author:** ![tpbillund](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tpbillund/32/37410_2.png) [@tpbillund](https://discourse.nodered.org/u/tpbillund)\
**Post date:** [7 January 2023 17:49 UTC](https://discourse.nodered.org/t/cant-connect-to-my-home-assistant-with-node-red-contrib-home-assistant-websocket/73317/6 "2023-01-07T17:49:23Z")

</div>

> 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 🙂

> 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.

```auto
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

```

---

<div class="post-metadata">

**Author:** ![greengolfer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/greengolfer/32/28276_2.png) [@greengolfer](https://discourse.nodered.org/u/greengolfer)\
**Post date:** [7 January 2023 18:19 UTC](https://discourse.nodered.org/t/cant-connect-to-my-home-assistant-with-node-red-contrib-home-assistant-websocket/73317/7 "2023-01-07T18:19:36Z")

</div>

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

```auto
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.

> [@tpbillund](#):
>
> ```auto
> ports:
> - "172.25.100.199:58123:8123"
> 
> ```

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [8 March 2023 18:20 UTC](https://discourse.nodered.org/t/cant-connect-to-my-home-assistant-with-node-red-contrib-home-assistant-websocket/73317/8 "2023-03-08T18:20:05Z")

</div>

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