Node-red-contrib-home-assistant-websocket

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.

New Release v0.14.0

Features

  • JSONata everywhere (6424235)
  • api: Add option for data field to be a JSONata Expr (37b54ce)
  • call-service: Add JSONata option to data field (8e91f42)
  • fire-event: Add option for data field to be a JSONata Expr (526d083)
  • get-entities: Allow overriding of config values from payload (a0fdb96), closes #133

JSONata

  • There are three functions added for JSONata expressions within the Home Assistant nodes
    • $entity() returns the entity that triggered the node
    • $prevEntity() returns the previous state entity if the node is an event node
    • $entities() returns all entities in the cache
    • $entities(entity_id) returns a single entity from cache matching passed in entity_id

When JSONata appears in the conditional dropdown it expects the expression to return a boolean, true or false.

image

When it is chosen with a conditional, not JSONata it will return a value of the evaluated expression that will be checked against the conditional chosen.

image

Call-Service Node Changes

  • Entity ids are no longer merged with the data property on the front end
  • The data field does not have to be valid JSON until after templates are rendered. This change will allow you to assign numbers to properties as an actual number and not a string using templates.
  • entity_id in the data property will supersede the entity id field
  • Flows exported from version 0.14.0 will lose the entity id when imported into a previous version

Notice: Just because the text is yellow on a node doesn’t mean you need to go update it. It will continue to function just as it is and the next time you modify the node it will be upgraded then.

Full Changelog


Buy me a coffee For those that enjoy my work.

5 Likes