Play one radio stream by pushing one button

Hello
I would like to play only a single radio stream to a media player with one single button.

I have tried many but everything is too extensive.
So no selectors but just one button that plays one stream one media player.
Who can help me on my way.

So please no links to all the difficult script i tried them all and they are too much.

I understand i have to give more input

The radios station for example is https://stream.100p.nl/100pctnl.mp3

the media player is media_player.audio

1 Like

Hi Ernst,
without knowing which stream you would like to play on which device, it is difficult to give you hints.
For example, my SONOS behaves different to my ā€˜frontier siliconā€™-speakers.
Maybe you take the time to read this topic https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371

I use this to play radio Wales on chromecast

alias: Play Radio Wales (HG)
description: ''
trigger:
  - platform: state
    entity_id: input_boolean.radio_wales
    to: 'on'
condition: []
action:
  - service: media_player.play_media
    target:
      entity_id: media_player.home_group
    data:
      media_content_id: >-
        http://stream.live.vc.bbcmedia.co.uk/bbc_radio_wales_fm?s=1641199659&e=1641214059&h=c0da96092edbdc9142733a3e69aad041
      media_content_type: audio/mp4
mode: single

With an input boolean triggering it.

2 Likes

Nice i understand much but iā€™m such a beginner i donā€™t know how to go further whit the input boolean
I understand i have to trigger it there it stops for me.

Create toggle helper in configuration / automations and scenes / helpers and use that as the button and automation trigger.

1 Like

And itā€™s working Thanks .

You can also use this one. I have edited it on my own purposes with the radio stations and icons.

Playing webradio (and other audio) from Lovelace dashboard :: Sequr

Hi Besiktas.
Iā€™ve been trying to build that radioplayer as well. I didnā€™t use the packages option. However, I have an issue with the scripts. I have no error message, but in the script.yaml file, this is all I see:

'1699459792302':
  alias: Media_URL
  sequence: []
'1699459942893':
  alias: Webradio
  sequence: []

Where is the script itself? As in:

media_url:
  script:
    play_media_url:
      alias: Play media from URL
      mode: single
      icon: mdi:music-box-multiple-outline
      sequence:
        - service: media_player.media_stop
          target:
            entity_id: media_player.livingroom
        - service: media_player.volume_set
          data:
            entity_id: media_player.livingroom
            volume_level: 0.10
        - service: media_extractor.play_media
          data:
            media_content_type: MUSIC
            media_content_id: "{{ states('input_text.url') }}"
          target:
            entity_id: media_player.livingroom
  
  input_text:
    url:
      name: URL
      min: 10
      max: 255
      icon: mdi:web
      mode: text
```

I think thats because you didnā€™t use the option for the package one.
Because the whole thing is forwarding to that place and if you didnā€™t made your changes good to not use the ā€˜ā€˜package optionā€™ā€™, then that will be your issue.

Just throws up an error saying ā€œMessage malformed: extra keys not allowed @ data[ā€˜triggerā€™]ā€.

Of all the things Iā€™ve set up in Home assistant this is easily the hardest, it is absolutely ridiculous how difficult it is to push a button and turn on the radio when itā€™s so simple to do so much more complicated things.

Unless you have entities named exactly like mine it is not going to work.

We will need to know your entity names and what your yaml is. You canā€™t just copy mine, it was just an example. Oh and it works every day here, except that URL is now long out of date.

Oh and its not at all difficult these days, just use radio browser, set an automation triggered by an input boolean, action play media, pick a player and then choose the media using radio browser.

1 Like

I appreciate the response, I did update the entity names though.

I think we must be on different versions of Home Assistant, there is no way to select the media like this, you have to manually enter the content ID and there is seemingly no way to find that ID from the Radio Browser.

1 Like

This was the solution, downloading an add on.

An automation can pick a radio browser station easily. For action just call service, play media and pick the player then pick.the media using radio browserā€¦ No need for any content id.
Music assistant is also a good way of doing it.