Play a song on a raspberry pi speaker by node red

Hello !

I’m searching for a solution to play a set of specifique song that should be located on the raspy memory. I can’t find a node red module that can play a song on the raspy speaker. I would like to do so to make anounce base on certain event such like weather change or trafic change and so on. I have actually a TTS working with Alexa but the integration in HACS is not stable enough. It requiert to be reconfigured and re-enter password multiple time a years even if the Amazon account password and I’d doesn’t change.

Does anyone have a solution or experience in that field ?

Thank for the help !

Did you set it up as a media player inside home assistant first?

I do this. I set up ssh and just have node red run a shell script.
shell script then ssh to RPI, plays song or pre-recorded Alexa announcements.
time for bed, garage door is open, washer is finished… etc etc.
you can play music to if you wanted.

That’s exactly what I want to do ! Are you avaible anytime soon to go into the detail about how to set this up in detail ? Like for exemple the audio output of the raspy is working straight out if I plug the jack wire ? What screip do you run ? And how do you accès to the OS of the raspy via SSH from the home assistant container ? I know this is a lot but it would be amazing if we would discuss it on discord or anything else !

It look like it’s doing the work ! I will look into it and let you know if I manage to make it work :slight_smile:
Thank for the answer ! Very appreciate !

I bought a usb sound card and usb speakers (search on amazon)
they are cheap, like 5-10$ for the sound adapter, and 10-30$ for the speaker
depending on how you have the RPI setup, if it has an desktop on it, you should be able to remote in and configure it all. if you are using headless CLI, you may have to google for the packages needed to make the sound stuff work. it’s not hard. just depends on how familiar you are with linux. once you have that working and can generate sounds/music, you are ready to automate. I use automation that will SSH from my HA box to my RPI’s and run a bash script remotely., the script then runs and plays the sound or music.

I completely over looked the audio jack on my pi, so thanks for the post. I had a pair of powered speakers, so Iinstalled mpd and was able to use google say and play media with this flow.

[{"id":"4f46c634e3a9a04b","type":"api-call-service","z":"f80b6c338afd5483","name":"","server":"","version":5,"debugenabled":false,"domain":"media_player","service":"play_media","areaId":[],"deviceId":[],"entityId":["media_player.mpd"],"data":"{\"media_content_id\":\"media-source://media_source/local/Lasgo - Alone.mp3\",\"media_content_type\":\"music\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2550,"y":420,"wires":[[]]},{"id":"6621d4db1e630f90","type":"inject","z":"f80b6c338afd5483","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":2300,"y":420,"wires":[["4f46c634e3a9a04b"]]}]

great ! how do you send the output of google say into the media player node? i supposed you have to use the regular expression containing the {{ payload }} out of google say? i will have a look into it today and let you know how it worked for me

I use google say, you have to add the service in config.yaml

tts:
  - platform: google_translate
    service_name: google_say 

and this is the data, use triple 's if sending an address {{{payload}}}

{
    "message": "My name is {{payload}}",
    "language": "en"
}