Examples for using the new Get Entities node

Maybe I’ve mis-understood example #1 but I’m having issues with the output to including what’s in msg.payload.

Here is my service node {"message":"The {{payload}} are open.","title": "Left Open"}

But I get the following "The {{payload}} are open."

[{"id":"6d0d44d40889d014","type":"inject","z":"0c7ea54a78e4f73f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":75,"y":160,"wires":[["e8a5dc398d617a2b"]],"l":false},{"id":"e8a5dc398d617a2b","type":"ha-get-entities","z":"0c7ea54a78e4f73f","name":"","server":"b77dc5f84903af5d","version":1,"rules":[{"property":"entity_id","logic":"is","value":".*contact*","valueType":"re"},{"property":"state","logic":"is","value":"on","valueType":"str"}],"outputType":"split","outputEmptyResults":false,"outputLocationType":"msg","outputLocation":"payload","outputResultsCount":1,"x":210,"y":160,"wires":[["c738626a3cc39a41","e19f4740b6d68a6e"]]},{"id":"c738626a3cc39a41","type":"template","z":"0c7ea54a78e4f73f","name":"Format Friendly Name","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload.attributes.friendly_name}}","output":"str","x":440,"y":160,"wires":[["298a83564e352ff5","0b11022889bf1d95"]]},{"id":"298a83564e352ff5","type":"join","z":"0c7ea54a78e4f73f","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":",","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":630,"y":160,"wires":[["a7db00a05178e65b","10a3e4235e76303f"]]},{"id":"10a3e4235e76303f","type":"api-call-service","z":"0c7ea54a78e4f73f","name":"Notify","server":"b77dc5f84903af5d","version":5,"debugenabled":true,"domain":"notify","service":"bot","areaId":[],"deviceId":[],"entityId":[],"data":"{\"message\":\"The {{payload}} are open.\",\"title\": \"Left Open\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","output_location":"payload","output_location_type":"msg","x":830,"y":160,"wires":[["17f17dbeba54a359"]]},{"id":"b77dc5f84903af5d","type":"server","name":"https://ha.ha.co.uk","version":5,"addon":false,"rejectUnauthorizedCerts":false,"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}]

image

What am I doing wrong here?

When using mustache templates {{ something }} set the data field to JSON not j expression/jsonata

1 Like

@Mikefila That worked thanks.

@Kermit Example #1 might want updating as it’s using j expression/jsonata instead of JSON

How do I create that I want to see all the lights that are on when I leave the house?

I have something that works for door/window sensors that if open I get an alert

https://zachowj.github.io/node-red-contrib-home-assistant-websocket/cookbook/jsonata/call-service.html#notification-of-lights-left-on-when-leaving-home

Code is example flow 1c

https://zachowj.github.io/node-red-contrib-home-assistant-websocket/cookbook/jsonata/call-service.html#jsonata-and-the-call-service-node

1 Like

is there any possibility to find all devices by integration? i want to filter all esp devices and find offline

@Kermit have there been any changes here?
I just discovered that what worked for me for several years no longer works…

Looks to be a bug. Fix will be in the next release.