Send random messages to google home?

Has anyone setup sending random messages or quotes to the google home?

Right now I have a message sent to one of my google homes when my daughter gets home saying “welcome home”. But it gets boring after awhile. Is there a way to have a data base of messages and Node red would pick a random one every time it was triggered?

Yes i currently have this set up with Node Red. In the “announce” section i utilize the HomeAssistant “template” with the below snippet.

{{ [
"Welcome Home Domenic",
"Domenic you are home, we missed you so much!",
"Welcome home Master",
"Hey there Domenic Welcome Home!",
"Domenic can not hide from the system. Welcome home.",
"Just a quick announcement. Domenic has arrived!",
"My systems are picking up the presence of additional humans. Domenic has been identified as home."
 ] | random }}

1 Like

Thanks so much. Going to have so much fun with this. lol

1 Like
[{"id":"7589f533.bcd29c","type":"function","z":"e5243fcc.3bd4d","name":"Alexa random messages","func":"msg.payload = {};\ = {};\ = {};\ ={};\n\nvar myArray = [\n  \"The entertainment system has been primed, and is ready to go... Enjoy yourself, and don't forget the snacks \",\n  \"hey sunshine, go put your feet up and watch a good movie\",\n  \"Marmalade will hold the fort, you go and enjoy yourself\",\n  \"See ya soon\",\n  \"Go on then bugger off, I'll sit and mumble to myself \",\n  \"The entertainment system is all set up, go have fun\"\n];\n\nvar randomItem = myArray[Math.floor(Math.random()*myArray.length)];\n\ = \"media_player.annaka_s_echo_dot\";\ = randomItem;\n\n\nreturn msg;\n","outputs":1,"noerr":0,"x":611,"y":96,"wires":[[]]}]

This is a function node I use for Alexa to say random quotes

I’m using the Alexa as a Media Player component setup and I’m trying to get your function working. How do you get the message to play from a particular Alexa? I changed your media player to the media player that I want to say the message. Also when I manually run the function the debugger will give me a random message showing it works but I cant seem to get it to flow to the Alexa device.


Have you made sure the Entity ID’s match in the function node (line 17) and the Alexa Service node.

I double checked line 17 and it’s correct what is the Alexa Service node?

Here is my simple setup which you can try, you’re need to change the Alexa service node ‘call service node’ to match your setup.

[{"id":"aaf052d2.caa5f","type":"api-call-service","z":"e5243fcc.3bd4d","name":"alexa voice","server":"62d7bb2f.196044","service_domain":"media_player","service":"alexa_tts","data":"{\"entity_id\":\"media_player.annaka_s_echo_dot\"}","mergecontext":"","output_location":"payload","output_location_type":"msg","x":630,"y":200,"wires":[[]]},{"id":"5de7a88f.3a4e38","type":"function","z":"e5243fcc.3bd4d","name":"Alexa random messages","func":"msg.payload = {};\ = {};\ = {};\ ={};\n\nvar myArray = [\n  \"ok, i've turned off all the lights, so go and enjoy yourself\",\n  \"go on then bugger off, leave me by myself won't you\",\n  \"catch ya later\",\n  \"don't be long\",\n  \"see ya soon\",\n  \"yippee, time for a party, she's going out\"\n];\n\nvar randomItem = myArray[Math.floor(Math.random()*myArray.length)];\n\ = \"media_player.annaka_s_echo_dot\";\ = randomItem;\n\n\nreturn msg;\n","outputs":1,"noerr":0,"x":430,"y":200,"wires":[["aaf052d2.caa5f"]]},{"id":"9c29fb7e.4a8528","type":"inject","z":"e5243fcc.3bd4d","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":200,"wires":[["5de7a88f.3a4e38"]]},{"id":"62d7bb2f.196044","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]