I just got my Home Assistant Voice device yesterday. I have been playing with it and decided to start using testing it instead one of my Alexas for TTS. I only use Node Red for my automatons and not the native automation engine. Below are two different methods to pass a message to the voice device.
I haven’t tried using the Piper integration yet but eventually I will get that to work.
NOTE: This assumes you are subscribed to HA cloud so you can use the cloud.say service. I am in no way a master of Node Red but know enough to get by. This is the resource i used to learn how to pass messages in Node Red: node-red-contrib-home-assistant-websocket
There are two flows included:
[{"id":"60b3bdc76ad96855","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"211131d4278bed55","type":"api-call-service","z":"60b3bdc76ad96855","name":"family room ha voice","server":"c234f9a6c5d8f09c","version":7,"debugenabled":false,"action":"tts.speak","floorId":[],"areaId":[],"deviceId":[],"entityId":["tts.home_assistant_cloud"],"labelId":[],"data":"{\"media_player_entity_id\":\"media_player.family_room_voice_assistant_media_player\",\"message\":\"testing\",\"options\":{\"voice\":\"en_GB-aru-medium\"}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","blockInputOverrides":false,"domain":"tts","service":"speak","x":580,"y":60,"wires":[[]]},{"id":"7de36c32bebc0923","type":"inject","z":"60b3bdc76ad96855","name":"","props":[{"p":"topic","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"testing","payloadType":"str","x":310,"y":60,"wires":[["211131d4278bed55"]]},{"id":"6f524ff3fd1d8606","type":"api-call-service","z":"60b3bdc76ad96855","name":"family room ha voice in coing payload","server":"c234f9a6c5d8f09c","version":7,"debugenabled":false,"action":"tts.speak","floorId":[],"areaId":[],"deviceId":[],"entityId":["tts.home_assistant_cloud"],"labelId":[],"data":"{\"media_player_entity_id\":\"media_player.family_room_voice_assistant_media_player\",\"message\":\"{{payload}}\",\"options\":{\"voice\":\"en_GB-aru-medium\"}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","blockInputOverrides":false,"domain":"tts","service":"speak","x":850,"y":180,"wires":[[]]},{"id":"a1450f2ff6195505","type":"function","z":"60b3bdc76ad96855","name":"testing this speach stuff","func":"msg.payload =\n\n \"Testing this speech stuff\"\n\nreturn msg","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":530,"y":180,"wires":[["6f524ff3fd1d8606"]]},{"id":"38d7e44d4e8a5a68","type":"inject","z":"60b3bdc76ad96855","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":320,"y":180,"wires":[["a1450f2ff6195505"]]},{"id":"c234f9a6c5d8f09c","type":"server","name":"Home Assistant","version":5,"addon":false,"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":": ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"default","statusTimeFormat":"h:m","enableGlobalContextStore":false}]
The first one is to just use an inject node and put the message in and send it in the flow. The msg.payload is what you want to say through the speaker.
The second flow uses a function node to pass the message into the call service. Just change the message in the " " to what you want to say. I use the function node method more often so I can just write a bunch of functions with different messages and only one call service.
I am next working on how to use an alert sound or sounds for different types of alerts but I am not quite there yet. I hope this helps my fellow Node Red users. If you have another method or anything to add let me know.