Automation for playing music from media browser

Hi!

Ive just started to play with the media browser and am having some difficulties getting an automation to work.

It is a simple automation where a motion detector triggers music to be played from the local media storage (/media). I have access to the media, and can play the mp3 through home assistant. But i think im doing something wrong with regards to assigning the right path to the folder.

- alias: Music Master Bathroom
  description: ''
  trigger:
    - entity_id: binary_sensor.motion_sensor
      platform: state
      to: "on"
  condition: []
  action:
    - service: media_player.play_media
      entity_id: media_player.A_speaker
      data:
        media_content_id: source://media_source/media/1.mp3
        media_content_type: music/mp3

Its most likely a simple thing that will feel very obvious…

Thankful for input!


Also, is there a way to link music instead of putting a copy of it in the media folder and thus saving space on the hard drive by eliminating duplicates? Im using virtualbox on a windows host.

You fail to provide all the info for a “good question” (view the sticky on this forum, first of the threads) so whilst you read that (!) you might try: media_content_type: 'music' and make sure you can play the mp3 using a stream player like VLC using the url , so in your example: source://media_source/media/1.mp3

but read the helpful sticky and put some useful info in your posts such as: flavour of home assistant, version, execution model (core, supervised, docker), host os/platform, hardware , so on and so on.

Hi, im not sure what you mean by that.
This is a pretty simple question.
How do i make an automation where music is played on a media player. That is all.
None of the other information is relevant. If someone has made this kind of info, they can share it.
“flavour of home assistant, version, execution model (core, supervised, docker), host os/platform, hardware , so on and so on.”
Sorry, but this is not relevant to making a simple automation.

Hi, I’m with the same doubt.
I can choose one mp3 sound at media and i hear it from browser - it’s ok.
Now I want to make a automation that choose a mp3 from media and play it on the browser - just this.
When I’m at automation I cannot see option to play in browser.
Can someone help me on this?
Thanks

Im still not able to select “Play in Web Browser” when creating an automation to play music. Im running 2022.11.02

I can play to one of my playback enabled security cameras (not that thats much use), but I cant select playback in the browser. When I select the file to play manually, all is fine with the world.

Any thoughts or pointers?

Thx
Jon

Hi, did you solve it?

Hello, i’m having the same “chalange”. I there a solution already. I tried the add-on “browser_mod”, but that doens’t works good. Thanks

You ever find a solution to this? How does one play a sound either on a browser or companion app? Seems so simple but no info anywhere.