Play sound on Alexa using node-red

Hi
There is a possibilty using node-red to play “amzn_sfx_doorbell_chime_01” or something like that when the door switch is on. I’m able to use tts to speak “welcome home” on my Alexa, but since hours I’m trying to play sound without expected results…
Wojtek

Don’t think so. Only tts is allowed per api.

Here is the list of sounds:

https://developer.amazon.com/en-US/docs/alexa/custom-skills/ask-soundlibrary.html

Note that some of the sounds don’t seem to work.

Use a change node to set the payload to the sound name.

image

Set up a call service node:

image
For the data field:

{
    "media_content_type": "sound",
    "media_content_id": "{{ payload }}"
}

I got it to play a sound but was disappointed in the quality and have since done away with it.

It is working - thank you. I’ve got one additional question, how to convert this json to play this sound two or three times :slight_smile: ?

The simplest way would be to repeat the call service node two or three times.

How come that buzzer_pistols_01 sound is the only one I can get my echo to play? I went to the alexa website, tried at least 15 other ones, it says it was sent to my echo but i never hear anything.

Same here. Silent although it says sent.

I switched to the following palette below. Only has about 40 different sfx, but its solid and easy to use.

image

+1 with that palette, it is rock solid.

you can play the same sound as many times as you like using the Routine Node from that palette and creating a serial node whithin.

@obaldius the only thing ive noticed, and wanted to see if you have, is ill get a NO JSON error. But run it again, and it works fine.

Seems very random, no rhyme or reason. I added a catch node to catch the error and re-run the flow if it happens.

That No Json error usually is due to “too many requests”. Try spacing your requests with a 2 second delay at least, or even better, use the Node function under the Routine node as much as possible. You can chain as many actions as you like using the node under Alexa Routine node without falling into a No Json error

In that particular example, I would move the “set volume to 40…” into every “Speak Jim Home” and “Speak Jim not Home” nodes using the Node tool whithin Alexa Routine’s node as described above. I know you put the set volume command twice while you could set it just once, but by doing it this way, you’ll avoid the No Json error

Ill try that, thanks!

Thats gold @obaldius, gold!

image

1 Like

I try Initialize alexa echo dot, but when i go to ip addres with port i see blank peage, any ideas?