At night time, id like to announce on our google homes which door contact sensors are still open. Ideally, I’d like to query all of the contact sensors (or a group of contact sensors) identify which ones are open, and pass that to a google tts message that says something like. The following doors are still open, front door, garage door etc. Any guidance would be appreciated
list is stored under payload.attributes.friendly_name
[{"id":"f300d288.ac63a","type":"ha-get-entities","z":"428d9dba.39a924","name":"","server":"9405c3fe.d0a6c","version":0,"rules":[{"property":"entity_id","logic":"includes","value":"$globalContext(\"homeassistant.homeAssistant.states['group.YOUR_GROUP'].attributes.entity_id\")","valueType":"jsonata"},{"property":"state","logic":"is","value":"on","valueType":"str"}],"output_type":"split","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":310,"y":740,"wires":[["fbc32732.530468"]]},{"id":"91e4a724.2b8fe8","type":"inject","z":"428d9dba.39a924","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":740,"wires":[["f300d288.ac63a"]]},{"id":"fbc32732.530468","type":"join","z":"428d9dba.39a924","name":"","mode":"custom","build":"string","property":"payload.attributes.friendly_name","propertyType":"msg","key":"topic","joiner":",","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":470,"y":740,"wires":[["df3f476a.52a558"]]},{"id":"df3f476a.52a558","type":"debug","z":"428d9dba.39a924","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":620,"y":740,"wires":[]},{"id":"9405c3fe.d0a6c","type":"server","name":"Home Assistant","version":1,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
Thanks. Im getting two entities returned which is appropriate. How do I tie this to a google home announcement. Something like, "The following doors are still open, " & ex. front door, rear door.
you should set the data field of your google tts service call to JSONata experssion and then (“message” or whatever field the tts announcement should go in):
“message”: "The following doors are still open, " & payload.attributes.friendly_name