Node-red-contrib-home-assistant-websocket

Boy, I’m having a hell of time with this. I recently updated from 10.2 and I can no longer connect to HA. Nothing else has changed. I’ve done all the standard troubleshooting and even rebuilt the entire node-red container, started w/o importing any of my flows, etc. I’m currently running node-red-contrib-home-assistant-websocket v0.12.3, Node-RED v0.20.5 (I’m using the v10 container), Node.js v12.4.0, HA v0.94.3. I’ve also rebuilt the LLAT (several times), restarted both HA and Node-RED containers in every order possible. I’m dying here.

Debug shows “connecting” and then an instant “disconnected”… over and over and over again. The only flow I have is an events:all running to a msg.payload debug.

Any thoughts? I’m out of things to try!

Happened to me once. I regenerated the long lived access token and it started working again.

Done that more times than I can count. :frowning:

So, this just happened: If I set the Base URL to my HTTPS DuckDNS URL for HA it works. Thing is, I don’t want to route every little thing through the internet, not least of which because if my connection goes down, so will all of my automations. This is not behavior that occurred before. Any thoughts?

I’m starting to think I have something misconfigured in HA that’s now allowing unsecured local connections. Haven’t changed anything in there either. Maybe I updated HA the same time I updated this pallet and just forgot? And that HA update had a breaking change here? I’ll have to dig in there.

New Release v0.13.0

Features

  • current-state: Templates are rendered in the entity id field (aed4579)

  • wait-until: Allow overriding of config value (c4d3081)

Full Changelog


Buy me a coffee For those that enjoy my work.

3 Likes

Thanks, just updated from v0.12.x and so far so good, as it everything is still working :slight_smile:

Hi, could anyone advise on how to fix this? I’m running in docker.
An uninstall, docker restart, npm install does not fix it.
thanks
image

Nine posts above or any of the following links

1 Like

Thanks kermit, that worked. I can indeed do things like turn on a light from NR now.
But, autofill doesn’t seem to work for domain, service, entity id. This is vital to me since I’m just starting to use NR. Do you have any suggestions on how to fix this? thanks
EDIT: A full restart of the box solved this for me

Am I doing something wrong?

I have many sequences where I have a certain value in the payload. Then I do a ‘current state’ node that checks the state of an entity in HA. Only if it has a certain value, I want to continue in the sequence with the original payload value. This used to work perfectly in the past, I was able to configure that the ‘current state’ node would not overwrite the payload value. But now I can’t seem to prevent that from happening.

I can only guess how about an example flow?

Here is a very basic example. Is it possible to retain ‘hello’ in the payload at the debug node? So have the current state node basically just act like a switch node? (only proceed the sequence with existing message if the HA entity has a certain value)?

Yes

Don’t write the state to msg.payload.

Thanks! I was still running 0.12.2, I now understand there was a bug in that version, which was fixed in 0.12.3. I now upgraded to 0.13.1 and it is working correctly again.

I’m using docker compose:

    container_name: node-red
    image: raymondmm/node-red
    user: "1000"
    ports:
      - 1880:1880
    volumes:
      - /opt/node-red:/data
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
    restart: "no" # because the exit code(s) are wrong
    depends_on:
      mosquitto:
        condition: service_started

I used to use image: nodered/node-red-docker:rpi, but switched as advised above to fix the “object” error, however I’m now getting an error:
image

Please advise.

Thanks in advance

Hi,
Thanks for all your work! I can’t seem to get the wait-until overriding of the entityId working properly, using version 0.13.1. I setup a simple test with a node that explicitly fills in the entityId and one that uses the payload.entityId input, but am getting 2 different results. They both execute without error but one outputs true to a given state and the other times out. Let me know if I am doing something wrong.

[{"id":"577b5382.4b34dc","type":"inject","z":"fad5f76e.8e12b8","name":"","topic":"","payload":"{\"entityId\":\"binary_sensor.aq1_wleak_kitchen\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1010,"y":1140,"wires":[["16093a2f.500d36"]]},{"id":"39891ead.4922b2","type":"inject","z":"fad5f76e.8e12b8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1020,"y":1080,"wires":[["fbaf9218.1eb6c"]]},{"id":"fbaf9218.1eb6c","type":"ha-wait-until","z":"fad5f76e.8e12b8","name":"","server":"d209e4bb.aa93f","outputs":2,"entityId":"binary_sensor.aq1_wleak_kitchen","property":"state","comparator":"is","value":"off","valueType":"str","timeout":"20","timeoutUnits":"seconds","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":1220,"y":1080,"wires":[[],[]]},{"id":"16093a2f.500d36","type":"ha-wait-until","z":"fad5f76e.8e12b8","name":"","server":"d209e4bb.aa93f","outputs":2,"entityId":"","property":"state","comparator":"is","value":"off","valueType":"str","timeout":"20","timeoutUnits":"seconds","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":1220,"y":1140,"wires":[[],[]]},{"id":"d209e4bb.aa93f","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]

Capture

uncheck if you want to allow overrides

npm didn’t install the @hapi/joi package when it installed the rest of the dependencies. You can uninstall it and try and reinstall it and watch the build log to see why it failed or manly log into to docker container and in the node-red folder use npm install @hapi/joi.

Thanks, that was simple. I never thought twice to think what that checkbox does. Given that, it might be a bit confusing that the current_state and wait_until behave a bit differently. The wait_until defaults with the ‘Block Input Override’ enabled and the current_state is default to disabled. Also, the input parameters for entityId are different between the two. wait_until uses ‘payload.entityId’ and current_state uses ‘payload.entity_id’

Thanks for the advice @Kermit! However, I’m still having some issues. It’s probably something I did. any good ideas?

image

I have also tried removing node-red-contrib-home-assistant-websocket and reinstalling it.

Thanks again!

What are you running docker on? What do the npm logs say when installing it via the palette? There should be a view install log button next to the right side when installing it.