Examples for using the new Get Entities node

thanks for the reply. I want to try this but it looks like I have a other current state node?
don’t have the output properties.

Putting nodes in serie won’t get what I wanted
I have found my soloution.
Only the entities - funciton - telegram nodes.
Entities I read out and with the function I made the message with the right value’s and information combined with the text I want.

In the funciton node the follow codes

msg.payload = {
    "chatId": "xxxxxxxx", 
    "type":"message", 
    "content":
    "**WEERBERICHT** \n" +
    "Weerbericht Morgen =  \n" + msg.payload[101].state +
    "\n \n Temparatuur Morgen = " + msg.payload[26].state +
    " °C\n Regenhoeveelheid morgen = " + msg.payload[36].state +
	"mm\n Regenverwachting morgen = " + msg.payload[51].state +
	"%\n WindKracht morgen = " + msg.payload[61].state +
    " Bft\n \n Weerbericht OverMorgen =  \n" + msg.payload[102].state +
    "\n \n Temparatuur OverMorgen = " + msg.payload[27].state +
    " °C\n Regenhoeveelheid Overmorgen = " + msg.payload[37].state +
	"mm\n Regenverwachting Overmorgen = " + msg.payload[52].state +
	"%\n WindKracht Overmorgen = " + msg.payload[62].state +" Bft"
};
return msg;

Is there an equivalent tigger node similar to this “get entities node” that can use regex on attribute? See below screenshot, how can I get trigger node with these condition? Thanks.

1 Like

image

[{"id":"fc0f30a1625cdb45","type":"server-state-changed","z":"ffbd7f06.4a014","name":"","server":"","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":".*","entityidfiltertype":"regex","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"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":"eventData"}],"x":816,"y":304,"wires":[["c16934adedc4a6a8"],[]]},{"id":"6a06ddeb482437a8","type":"debug","z":"ffbd7f06.4a014","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1160,"y":304,"wires":[]},{"id":"c16934adedc4a6a8","type":"switch","z":"ffbd7f06.4a014","name":"","property":"payload.new_state.attributes.friendly_name","propertyType":"msg","rules":[{"t":"regex","v":"wyze","vt":"str","case":false}],"checkall":"true","repair":false,"outputs":1,"x":996,"y":304,"wires":[["6a06ddeb482437a8"]]}]

that’s smart usage. thanks!

Ok. But anyone can tell me how to use it to send some message to people who are actually in “home” i use get entity node, it work well but have no idea how to send notification to that one entity.
i mean. i left home, and 3 more person still in home. then something happend and wont to that 3 person get notification about that, without me cuz im not “home”

[{"id":"0c0ac1bad0f3dd34","type":"inject","z":"894a6b3077af9604","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":282,"y":784,"wires":[["6804063ea0604dc8"]]},{"id":"6804063ea0604dc8","type":"ha-get-entities","z":"894a6b3077af9604","name":"","server":"","version":0,"rules":[{"property":"entity_id","logic":"starts_with","value":"device_tracker.","valueType":"str"},{"property":"state","logic":"is","value":"home","valueType":"str"}],"output_type":"split","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":454,"y":784,"wires":[["d801a3b8a45754cc"]]},{"id":"d801a3b8a45754cc","type":"function","z":"894a6b3077af9604","name":"","func":"const userMap = {\n    \"device_tracker.homer\":  \"mobile_app_homer\",\n    \"device_tracker.marge\":  \"mobile_app_marge\",\n    \"device_tracker.bart\":  \"mobile_app_bart\",\n    \"device_tracker.lisa\":  \"mobile_app_lisa\"\n};\n\n\nif(userMap[msg.payload.entity_id]) {\n    msg.payload = {\n        service: userMap[msg.payload.entity_id]\n    };\n    \n    return msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":620,"y":784,"wires":[["ce38aaf1ee9ee9ec"]]},{"id":"ce38aaf1ee9ee9ec","type":"api-call-service","z":"894a6b3077af9604","name":"","server":"","version":3,"debugenabled":false,"service_domain":"notify","service":"","entityId":"","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":790,"y":784,"wires":[[]]}]
2 Likes

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.