Not sure specifically with HA automations, as I use Node-RED, but posting a solution here for that in case anyone comes looking (and it may help lead you down finding the right code)
The problem is that user_id
is likely going to be some hash, so TTS is going to have a hard time saying that one. For me, I have to look up person
by user_id
attribute using the Get Entities node. I don’t have a button, so I’m triggering it by light change right now, but this should work as an example:
[{"id":"f4217b3a.d81098","type":"server-state-changed","z":"c4746402.779148","name":"Light changed","server":"74d5538b.e0092c","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"light.office_backlight","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":200,"y":680,"wires":[["3028c8a0.ca8938"]]},{"id":"f636095e.a66d08","type":"debug","z":"c4746402.779148","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":750,"y":680,"wires":[]},{"id":"3028c8a0.ca8938","type":"ha-get-entities","z":"c4746402.779148","server":"74d5538b.e0092c","name":"Get people","rules":[{"property":"attributes.user_id","logic":"is","value":"data.new_state.context.user_id","valueType":"msg"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":390,"y":680,"wires":[["c70a40d0.2c8d5"]]},{"id":"c70a40d0.2c8d5","type":"function","z":"c4746402.779148","name":"","func":"return { payload: `Ola, ${msg.payload[0].attributes.friendly_name} is asking you to come downstairs` };","outputs":1,"noerr":0,"initialize":"","finalize":"","x":560,"y":680,"wires":[["f636095e.a66d08"]]},{"id":"74d5538b.e0092c","type":"server","name":"Home Assistant","legacy":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]