Unable to play local mp3 to Google Home

Sorry for the late reply. I haven’t tested it as I kinda forgot about trying to fix this issue, but I’m pretty sure this will work:

      - service: media_player.play_media
        data:
          entity_id: media_player.lounge_mini
          media_content_id: https://MY_NABU_CASA_ADDRESS/local/sounds/airport.mp3
          media_content_type: 'audio/mp3'

…since I have HA Cloud enabled. I have just tested the link and I can play the MP3 from work with that address so it should play to the Google Home.

You could also play it locally via (http no SSL):

      - service: media_player.play_media
        data:
          entity_id: media_player.lounge_mini
          media_content_id: http://<LAN IP OF HA>:8123/local/sounds/airport.mp3
          media_content_type: 'audio/mp3'

I originally tried that and got nothing more than the standard Google Home chime as HA connected to it

If you’re not using SSL (HTTPS) on the LAN interface, it should work fine.

What did the trick for me was to create the structure:
config/
…www/
…audio/
…mysong.mp3

Then when using

media_content_id: http://MY_IP_ADDRESS:8123/local/audio/mysong.mp3

Works perfectly!

I don’t know why if my file is in the “media” folder (at the same level of “config”) I couldn’t make it work :confused:

Thank you very much!

1 Like

Ok, I figured out how to play content using the provided “media” folder in Home Assistant OS and Supervised.

It’s easily explained in the documentation:

In my case, I put the mp3 file directly in /media (using Samba and transferring from the PC). Then just setup like in the example:

service: media_player.play_media
data:
  entity_id: media_player.google_home
  media_content_type: music
  media_content_id: media-source://media_source/local/my_file.mp3

Because “local” is the default folder for “media_dir” (configured by default)

Hope to have helped someone!

3 Likes

Both this and your earlier suggestion worked for me. I think media-source:// is probably more elegant as you don’t need the IP address.

edit: So, actually had to revert to the http:// path because i get an authentication error after about 30 minutes otherwise (when playing a 1 hour mp3). Happens repeatedly unless i use the unauthenticated www directory method.

Sorry for stupid question, but how to play audio file on machine where webui is open? I have created automation, but it does not play audio when I hit execute. I do not use google mini neither maxi, I just want file to be played by browser in an event.

I searched for this solution for about 3hrs before stumbling upon this. Not sure why it was so difficult to find this answer, maybe just my poor searching being new to HA.

Anyways, this is the only thing that worked for me. tried local IP, remote IP, creating www folder in config, etc etc etc.

THANK YOU!

1 Like