Google Mini refuses to play via automation

this is my code and it refuses to work so im thinking it’s my syntax:

the file is located here on the HA machine:
image

where did i go wrong?

action:
  - service: media_player.media_play
    data:
      media_content_id: media-source://media_source/local/media/ding2.mp3
      media_content_type: audio/mpeg
    target:
      entity_id: media_player.basement_speaker

This is the service call you should use:

media_player.play_media

Besides the comment from Taras above you need to put the media folder under the www folder

i put in the mp3 file in the path you suggested
image

code updated to new path as seen below. still no luck. do i have to set permission to this “media” folder in www?

action:
  - service: media_player.play_media
    data:
      media_content_id: media-source://media_source/local/www/media/ding2.mp3
      media_content_type: audio/mpeg
    target:
      entity_id: media_player.basement_speaker

the Google Mini at least seems to respond this time with a tone…but still cant play that mp3 file. i can confirm that mp3 file is not corrupt because it plays fine in browser

is there an error in the logs?

yes:
Failed to cast media http://192.168.1.229:8123/media/local/www/media/ding2.mp3?authSig=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI1YTg5M2ZkOWQyZTk0MjBkYjUxZTc2YWIxNmYxZWVkYSIsInBhdGgiOiIvbWVkaWEvbG9jYWwvd3d3L21lZGlhL2RpbmcyLm1wMyIsInBhcmFtcyI6W10sImlhdCI6MTcxNTUyNzM3OSwiZXhwIjoxNzE1NjEzNzc5fQ.lofvmtIgKYAwdDjl9tPEMmYRIhigDjLrKGkPti0-uz0 from internal_url (http://192.168.1.229:8123). Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address
Failed to cast media

happy to say this works now thanks to a Reddit post.
MP3 file located in www folder as you suggested
image

action:
  - service: media_player.play_media
    data:
      media_content_id: http://192.168.1.99:8123/local/media/ding2.mp3
      media_content_type: audio/mpeg
    target:
      entity_id: media_player.basement_speaker

now, will this action always work, even when my Mini is offline? or it still needs cloud connection to work?

Then the path to the mp3 file is incorrect.

If you use media-source:// then the path should be relative to it (i.e. not relative to the www folder).

action:
  - service: media_player.play_media
    data:
      media_content_id: media-source://media_source/local/media/ding2.mp3
      media_content_type: audio/mpeg
    target:
      entity_id: media_player.basement_speaker

image

You mean, from internet. I would guess yes but I have not tried it (if I recall) since it’s locally stored. :man_shrugging: Try to disconnect internet and you will see :slight_smile:

using pfsense, i blocked it from getting online.
the Mini acknowledges it is not connected to the net.
but my automation to play the mp3 file works fine still :slight_smile: woohoooo

You need to drop Google DNS requests in whatever firewall you’re running and force the mini to use a different DNS.