jjlawren / sonos_cloud

Sonos cloud API integration for Home Assistant with improved TTS/alerts handling
121 stars 5 forks source link

Playing an MP3 over Sonos #48

Open pwcutajar opened 12 months ago

pwcutajar commented 12 months ago

Hi

I have the following working#

image

but i can get the following to work any help I would be grateful

image

I dont get an error just nothing plays

pwcutajar commented 11 months ago

Anybody?

jjlawren commented 11 months ago

When playing local media, it's easier to get the URL correct by using the script/automation UI and selecting the your media that way. You can then copy the media_content_id & type to other automations.

pwcutajar commented 11 months ago

jjlawren thanks for coming back to me

Im a bit confused by your answer, ive followed the example in the documentation but to no avail. Can you get it to work at your end and paste a screen shot of the setup?

image

ive also tried

media_content_id: media-source://local/doorbell-1/mp3

neither play. ( its a shame but im working remotely HA reports success but i cant get to any sonos log files)

jjlawren commented 11 months ago
  1. Create a new automation or script (you won't need to save it).
  2. Choose the "Play media" action.
  3. Select your Sonos device and choose your file using the UI media browser.
  4. Switch to YAML for the service call it generates, which you can copy & paste into other automations. The important data will look like this:
    service: media_player.play_media
    target:
    entity_id: media_player.sonos_basement
    data:
    media_content_id: media-source://media_source/sound_files/doorbell-front.mp3
    media_content_type: audio/mpeg

    image

pwcutajar commented 11 months ago

Thanks I can follow that vastly different to the documentation will this bring the volume down and not interrupt any current playlist?

pwcutajar commented 11 months ago

or are you saying cut and paste the line to my original automation

jjlawren commented 11 months ago

This is just to determine the correct media-source ID.

For the audio overlay, you can continue to use this integration or simply use the built-in Sonos integration with the announce feature (recommended). The features from this custom integration have been (mostly) ported back.