Node-red-contrib-home-assistant-websocket

To whom it may concern- I was able to fix my issue by stopping the container, exporting all my flows, deleting everything in the data folder, rebuilding the container, then finally importing all of the flows. Thanks again @Kermit for your assistance and development of this awesome addon.

What kind of examples are you looking for?

How about an example of using it to populate the data of a call service node?

What I am asking is a use case example. I am not sure where or when this would be useful.

Have you used jsonata before?
I haven’t used yet the jsonata in ha nodes but I do use them quite a lot in switch and change node.
I have a flow, executes at certain time is for turning the heater in the morning. I need to first check temp, if is under a value but I wanted that temp limit to be adjustable so use an input_number. So it will only pass if temp is below that input number. Now I can do that with jsonata and the included ha function. ATM what I have is a state change node that stores the input number value in context.

@silfa718 @MizterB I broke it out into a seperate post.

@Kermit I was wondering if you had any examples of the API node? I’m trying to query /zha/devices via websockets as in the below lovelace card but I’m not having any success so far.

1 Like

Hi,

I just can’t wrap around my head about this error after a change in entity-id’s in the latest version.
I’m calling “volume up”/“Volume down” and so ne with a entity id stored in a flow. variable (called flow.lautsprecher_id)
I always just used {{flow.lautsprecher_id}} as value for entity id. This results in an API-error after changing the node.

I tried:

{
    "entity-id": "{{flow.lautsprecher_id}}"
}

in the data field, but still: API error.
What am I doing wrong?

It’s an underscore in the entity_id. You are able to enter {{flow.lautsprecher_id}} directly into the entity id field.

1 Like

yeah, it’s indeed an underscore. Strange is, that {{flow.lautsprecher_id}} did not work for the last couple of days.
Now it’s working (after reverting the changes)
Still, thank you!

I’m trying to use a template with | lower() and NR doesn’t seem to like passing it over to TG (there’s just an empty space). The below code works but the state is uppercase (which isn’t the end of the world but i’d prefer it lowercase). Any suggestions?

{ "title": "*Good morning!*", "message": "It is currently {{ states.sensor.dark_sky_temperature.state }} degrees and {{ states.sensor.dark_sky_summary.state }} outside. It feels like {{ states.sensor.dark_sky_apparent_temperature.state }} degrees with {{ states.sensor.dark_sky_humidity.state }}% humidity. The nearest storm is {{ states.sensor.dark_sky_nearest_storm_distance.state }} miles away to the {% if states('sensor.dark_sky_nearest_storm_bearing') | float >= 315 or states('sensor.dark_sky_nearest_storm_bearing') | float < 45 %}north. {% elif states('sensor.dark_sky_nearest_storm_bearing') | float >= 45 or states('sensor.dark_sky_nearest_storm_bearing') | float < 135 %}east. {% elif states('sensor.dark_sky_nearest_storm_bearing') | float >= 135 or states('sensor.dark_sky_nearest_storm_bearing') | float < 225 %}south. {% elif states('sensor.dark_sky_nearest_storm_bearing') | float >= 225 or states('sensor.dark_sky_nearest_storm_bearing') | float < 315 %}west. {%endif %}" }

NR doesn’t do anything with jinja2 templates other than pass them to HA. Does it work inside the template editor in HA?

Yep. It worked as an automation just fine and works in the template editor.

New Release v0.15.0

Bug Fixes

  • get-entities: error when property value was not set for jsonata (5125821)

  • trigger-state: Attribute of other entity undefined in trigger (a45366f), closes #148

Features

  • get-entities: timeSinceChangedMs is now a filterable property (adfd0dc), closes #147

Full Changelog


Buy me a coffee For those that enjoy my work.

3 Likes

@Kermit if you have a spare minute could you please explain what the api node would be used for? Is it for some more advanced use cases?

I use the API node to grab camera images to feed them to telegram

1 Like

I am trying to understand what websocket calls are possible and what the json looks like. There just isn’t much in the docs.
I can use

{“id”:3,“type”:“get_states”}

to get all states, but can I get the state for a single entity_id. What would the json be in that case?
I can turn on a thermostat with

{“id”:24,“type”:“call_service”,“service”:“turn_on”,“domain”:“climate”,“service_data”:{“entity_id”:“climate.therm”}}

but I don’t have a clue what the json would look like to change the temperature.
Any help would be appreciated.

Seems like it’s just a way to make custom API calls for things that aren’t already exposed as their own nodes.

@Kermit do you plan on supporting the new Device Triggers/Conditions/Actions? Would be super helpful for ZHA (zigbee)!