Can HA play a "local" MP3 file to a media player?

service: media_player.play_media
data:
  media_content_id: /config/media/alarm.mp3
  announce: true
  media_content_type: audio/mp3
target:
  entity_id:
    - media_player.speaker_some_speaker

Service call in mind like this, notice the file placement media_content_id: /config/media/alarm.mp3 instead of a link. It doesn’t play anything. My installation is docker.

Is this even possible or did I miss something? Thanks!

1 Like

I am no expert but if you can achieve this through the front end (using media-menu) then yes…with me it works

I uploaded a file through “Browse Media->Local Media” and it played. Not sure how to replicate that click through a yaml. Hoping to put this into an automation to prevent my speaking from falling into the sleep mode.

can you maybe explain what you want to achieve as using a manually configured service to do the same as manual via the menu seems a bit ‘odd’
Automation in mind?

Yes. Automation. Playing a junk clip every hour to prevent my silly speaker falling into the power saving mode. Prefer playing as an announcement because otherwise it kicks up the music play in the queue (IDKY).

Looks like I need to do something like this, but still messes up the Music Assistant play (IDKY):

service: media_player.play_media
data:
  media_content_id: media-source://media_source/local/alarm.mp3
  announce: true
  media_content_type: audio/mpeg
target:
  entity_id:
    - media_player.speaker_some_speaker

Here they try to acomplish something similar:

I did it. I defeated the horrible Google Home “cast-start” prompt sound!

For my samsung tv, configured as media player, this works

service: media_player.play_media
target:
  entity_id: media_player.tv_samsung_9_series_65
data:
  media_content_id: media-source://media_source/local/music/list1/1.mp3
  media_content_type: audio/mpeg
1 Like

maybe your ‘some speaker’ has an issue

I need to replace this part media_content_id: https://hassio.local:8123/local/1sec.mp3 and somehow I achieved it. Now wrestling with the interaction between HA and MASS. Will report back once I had some success.

Yes this piece is the key: media_content_id: media-source://media_source/local/
Thanks!

1 Like

Not really. I found it’s because when I hit play for the alarm it also triggers the play in MASS. I have to do something a little sub-optimal: reversing back to the beginning of the song and hit pause. Works though not perfect. Still observing if there is any ill effect.