Examples for using the new Get Entities node

Ty @Kermit
Its work well. I just adjust it to my needs.

@Kermit im trying to get work smthg like this… so far no success… is it possible at all this way?

(?:^switch\.laund_toide$|binary_sensor\.akenlwc_.+)

i love you :slight_smile:

One more thing.
How to get notify about battery lever of entities by friendly name?
I mean i have 23 “battery” sensors. how to use get entity to make me know what of them are low than 20% for example, bu using firndly name in notification?

I would love to have something like this too!

This was perfect, and exactly what I was looking for. Thanks heaps!!

isn’t friendly name one of entity attributes? If so having access to entity object you should be able to use obj.attributes.friendly_name

Possibly it’s passed with a message too.

That is exactly what I use to check my battery devices. I use the device class property to get all the devices and friendly name property to exclude the specific devices I am not interested in (phones, tablets and Roomba). Works great.

@Kermit how to get this working?
image

https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/jsonata.html

$entity().attributes.current_temperature
1 Like

Am I missing something with the get entities and getting the contents of a group?

Nevermind, looks like I choose the wrong time to play with the code as there was a bug which was just resolved with the latest companion update.

Hi there!
Im ok with the Get entities node, its working well, but now i want to do this:
Get “water_leak” entities that are “wet” and then send me a notification like this: "Attention theres a leak on “device x”.
I need help in the notification “expression” data part, to tell me exactly whats the device that detected water.
Can someone help?
Thank you!

example 1 shows you how to combine the friendly names

https://zachowj.github.io/node-red-contrib-home-assistant-websocket/node/get-entities.html#examples

3 Likes

Hi,
I want to use the “get entities” node to identify the entity that was last changed in a given (binary sensor) group. Is that possible?

Hi

const globalHomeAssistant = global.get('homeassistant');

const ha = globalHomeAssistant.homeAssistant;

const groupEntity = ha.states['group.person_home_away'];

Hey,
I’m trying to do the following (someone shared the code here in the forum) I’m trying to make an adjustment to my system,

I’m trying to make Boolean receive an update who is at home,

Of course I have the group set, and also the Boolean of each person.

can you help

image

1 Like

How do I get the same result as the template below in a function on node red?

{{states
| selectattr('entity_id', 'search', 'quarto') 
| map(attribute='entity_id') 
| reject('search', 'wifi') 
| reject('search', 'ssid') 
| list }}

1 Like

regex: ^(?!.*wifi|.*ssid).*quarto.*

2 Likes

This! found this looking for a way to turn off all lights that are on. And of course, at the center of any higher level Node Red question, there is Kermit, spitting out answers like Ninja stars HAHA :wink:

Though I guess something has changed? Im getting this error with the “turn off light” node

“HomeAssistantError: not a valid value for dictionary value @ data[‘entity_id’]” I was using the one that has {{payload.entity_id}}

EDIT

This worked

{"entity_id": $join(payload.entity_id, ",")}

Kermit the Node Red Ninja :black_heart: :rofl:

For anyone looking to get all lights that are on and turn them, off, this the one that works;

[{"id":"cd6fc2911452f914","type":"api-call-service","z":"4f47f2fd.a611fc","name":"Turn off Light","server":"d272ac3c.e0735","version":5,"debugenabled":true,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":[],"data":"{\"entity_id\": $join(payload.entity_id, \",\")}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","output_location":"","output_location_type":"none","x":630,"y":2740,"wires":[["571ea2756d3975fc"]]},{"id":"571ea2756d3975fc","type":"debug","z":"4f47f2fd.a611fc","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":780,"y":2580,"wires":[]},{"id":"25835b72.64f7a4","type":"ha-get-entities","z":"4f47f2fd.a611fc","name":"","server":"d272ac3c.e0735","version":1,"rules":[{"property":"entity_id","logic":"starts_with","value":"light.","valueType":"str"},{"property":"state","logic":"is","value":"on","valueType":"str"}],"outputType":"array","outputEmptyResults":false,"outputLocationType":"msg","outputLocation":"payload","outputResultsCount":1,"x":374,"y":2580,"wires":[["cd6fc2911452f914"]]},{"id":"295c21dc.5cb70e","type":"inject","z":"4f47f2fd.a611fc","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":220,"y":2580,"wires":[["25835b72.64f7a4"]]},{"id":"d272ac3c.e0735","type":"server","name":"Home Assistant","version":5,"addon":true,"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":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]