Using NodeRed and Alex Media Player to play random messages in my flows. Took me a while to figure out how to update the nodes after using the previous version of Alexa media player, but now the items below work a treat, hope it helps someone.
Replace the text on lines 10 to 15 with your own messages.
On line 21 change to your own media player device
Change Service to your own media player device (make sure its the same as you put into line 21 in the function node above).
Below is the NodeRed nodes to copy / paste into your flows.
[
{
"id": "f68b51c6.9a1a1",
"type": "api-call-service",
"z": "40ebc6d9.fa1168",
"name": "New Multiple setup -- alexa voice",
"server": "62d7bb2f.196044",
"version": 1,
"service_domain": "notify",
"service": "alexa_media_annaka_s_echo_dot",
"entityId": "",
"data": "",
"dataType": "json",
"mergecontext": "",
"output_location": "payload",
"output_location_type": "msg",
"mustacheAltTags": false,
"x": 960,
"y": 1240,
"wires": [
[]
]
},
{
"id": "772300e.754d7",
"type": "function",
"z": "40ebc6d9.fa1168",
"name": "NEW Alexa random messages",
"func": "msg.payload = {};\nmsg.payload.domain = {};\nmsg.payload.service = {};\nmsg.payload.data = {};\nmsg.payload.data.data = {};\nmsg.payload.data.data.type = {};\nmsg.payload.data.message = {};\n\nvar myArray = [\n \"this is test one \",\n \"this is test two\",\n \"this is test three\",\n \"this is test four\",\n \"this is test five, \",\n \"hey you guessed it, this is test six\"\n];\n\nvar randomItem = myArray[Math.floor(Math.random()*myArray.length)];\n\nmsg.payload.domain = \"notify\"\nmsg.payload.service = \"alexa_media_annaka_s_echo_dot\"\nmsg.payload.data.data.type = \"announce\"\nmsg.payload.data.message = randomItem\n\n\n\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"x": 670,
"y": 1240,
"wires": [
[
"f68b51c6.9a1a1"
]
]
},
{
"id": "193820b6.1ddc5f",
"type": "inject",
"z": "40ebc6d9.fa1168",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 460,
"y": 1160,
"wires": [
[
"772300e.754d7"
]
]
},
{
"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
}
]