How to play radio stations on an Alexa devices?

You’re welcome. I like the buttons also better than the dropdown list.

I’d like to make this work. Created with picture card. No results so far. If anyone managed to make full size buttons work playing audio on a Echo device I’d love to see the solution.

type: vertical-stack
cards:

  • type: horizontal-stack
    cards:
    • type: picture
      image: /local/radio/skyradio.jpg
      tap_action:
      action: call-service
      service: media_player.play_media
      service_data:
      media_content_id: https://19993.live.streamtheworld.com/SKYRADIO.mp3
      media_content_type: url
      target:
      device_id: c3e9a08e8f5796271ce56e5adc0bcff9
      entity_id: media_player.echo_dot
      hold_action:
      action: none
    • type: picture
      image: /local/radio/100-NL.png
      tap_action:
      action: call-service
      service: media_player.play_media
      service_data:
      media_content_id: http://stream.100p.nl/100pctnl.mp3
      media_content_type: url
      target:
      device_id: c3e9a08e8f5796271ce56e5adc0bcff9
      hold_action:
      action: none
1 Like

Here you go. Instead of using their stream, play it via tunein:

type: custom:layout-card
layout: vertical
cards:
  - type: picture
    image: >-
      https://www.milanolounge.net/wp-content/uploads/cropped-Milano-Lounge-2021-300x300-1.png
    tap_action:
      action: call-service
      service: media_player.play_media
      service_data:
        media_content_type: custom
        media_content_id: play Milano Lounge on tunein
      target:
        entity_id: media_player.echo_office2
    hold_action:
      action: none
  - type: picture
    image: >-
      https://www.pureibizaradio.com/wp-content/uploads/2020/05/cropped-LETRAS-PURE-180x180.png
    tap_action:
      action: call-service
      service: media_player.play_media
      service_data:
        media_content_type: custom
        media_content_id: play PURE IBIZA RADIO on tunein
      target:
        entity_id: media_player.echo_office2
    hold_action:
      action: none

and so on.

4 Likes

Does anyone know how to do this with say NFC tags? I like how you can just issue the command directly and this would be super handy for telling Alexa what album to play as well. I"ve been messing around with this with other automations but this is a cool card.

Nevermind figured it out with the service call thank you so much

service: media_player.play_media
data: 
  media_content_type: custom
  media_content_id: play The Album The Wall by Pink Floyd
target:
  entity_id: media_player.office_alexa

Little late to the party but as a ‘newer’ guy I’ve struggled. This post was VERY helpful with examples.
Here’s what I came up with and it’s working great!!! Thank you all and I hope this helps another ‘new’ guy.

- type: custom:mini-media-player
          entity: media_player.john_s_echo_show
          name: Home
          shortcuts:
            columns: 2
            buttons:
              - type: SIRIUSXM
                name: Ozzy's Boneyard
                id: play ozzy's boneyard
                icon: mdi:radio
              - type: SIRIUSXM
                name: Octane
                id: play octane
                icon: mdi:radio
              - type: SIRIUSXM
                name: Turbo
                id: play Turbo
                icon: mdi:radio
              - type: SIRIUSXM
                name: RockBar 313
                id: play rockbar 313
                icon: mdi:radio
              - type: SIRIUSXM
                name: Hair Nation
                id: play hair nation
                icon: mdi:radio
              - type: SIRIUSXM
                name: Classic Rewind
                id: play classic rewind
                icon: mdi:radio
              - type: SIRIUSXM
                name: Classic Vinyl
                id: play classic vinyl
                icon: mdi:radio
              - type: SIRIUSXM
                name: Liquid Metal
                id: play liquid metal
                icon: mdi:radio
            artwork: full-cover-fit
            hide:
              volume: true
              power: true
              source: true
              name: true
              info: false
              controls: false
              progress: true
              icon: true
              state_label: true

It doesn’t show what song is playing and the progress doesn’t work but it does work and it’s a start :slight_smile:

sirius

I have this…

service: media_player.play_media
data_template:
  entity_id: media_player.office
  media_content_id: 'Fly FM'
  media_content_type: TUNEIN

I expect it to play the station of the left, but it keeps on playing the one on the right.

This is the station URL that I want it to play; Fly FM, 95.8 FM, Kuala Lumpur, Malaysia | Free Internet Radio | TuneIn

I have tried the station ID; 54528 as well but failed. Any suggestion on how to fix this?

This works for me.

service: media_player.play_media
data:
  media_content_type: custom
  media_content_id: play fly fm on tunein
target:
  entity_id: media_player.echo_office
2 Likes

thanks for your reply. but it is still playing Fly 92.3 instead of Fly FM.

Sorry to hear. I can easily switch between them, here via picture cards:

type: custom:layout-card
layout: vertical
cards:
  - type: picture
    image: /local/images/93790flyfm.jpg
    tap_action:
      action: call-service
      service: media_player.play_media
      service_data:
        media_content_type: custom
        media_content_id: play Fly FM Radio on TUNEIN
      target:
        entity_id: media_player.echo_office2
  - type: picture
    image: /local/images/331a23e27388d2869ed81e7480474b53.jpg
    tap_action:
      action: call-service
      service: media_player.play_media
      service_data:
        media_content_type: custom
        media_content_id: play Fly 92.3 Radio on TUNEIN
      target:
        entity_id: media_player.echo_office2

or play them at different locations:

Not sure, but can it be a cache issue?

Can we play a stream url using Alexa as media player ??? I have tried like shown below but it isnt working… Kindly guide…

service: media_player.play_media
data:
  media_content_id: https://19993.live.streamtheworld.com/SKYRADIO.mp3
  media_content_type: url
target:
  entity_id: media_player.echo_dot

Here is code for SiriusXM radio, Tune-in, and iHeartRadio…

- type: SIRIUSXM
  name: Kiki Lounge
  id: play kiki lounge
  icon: mdi:radio-tower
- type: TUNEIN
  name: Fly FM
  id: play fly fm
  icon: mdi:radio
- type: custom
  name: 93.3 The Wolf
  id: play the wolf on iheartradio
  icon: mdi:radio

The problem with Alexa and the methods shown in this thread is that it replicates what a vocal command would trigger.
In my case, if I say “Alex, play Frequence 3 on Tunein”, it’s going to play “Frequence 3 Urban”, not the “regular” Frequence 3 (Frequence 3 has different streams)
So this method is not precise enough I’m afraid.

In this video, the guy shows how to play a stream (taken from https://www.radio-browser.info/) but on a Chromecast, not on Alexa.

So I’m still looking for a way to :

  • play a stream
  • on group of Alexa speakers

Well, to 98% it works and is reliable.
When I replied to masterkenobi and tried the station he mentioned, it immediately worked for me, but not for him. I believe it is/was more or less a cache (or other) problem on his side, this sometimes happens and can’t be solved within HA or an integration.

Shortly after that I myself had problems with playing some of my stations via Tunein. Alexa claimed it don’t know what to do. So I waited a couple of days and all was fine again. But sometimes problems won’t get solved at all by waiting.
There can be lots of reasons outside HA why things sometime aren’t working as expected.

Anyway, I gave it a quick try with your three stations: by using picture cards its just a copy & paste of the code and adjusting the station names and icons - it worked immediately without a problem here:


Aside from the icons in the upper controls (Badges), you can see from the descriptions that the right stations are playing.
But you may need to try different approaches.
For Fréquence 3 it works here with simple using

media_content_type: TUNEIN
media_content_id: Fréquence 3

for Fréquence 3 Dance or Fréquence 3 World I need to use

media_content_type: custom
media_content_id: play Fréquence 3 World on tunein

First off, thank you for your long answer.
I am aware that the problem may lie somewhere between Alexa and TuneIn and not on HA’s side.
I had a funky behavior a few months ago when I requested the French RTL radio and that Alexa suddenly started playing a German radio also called RTL something with no changes on my side and after months if not years of success. It came back to the French station a few weeks later out of the blue (this behavior was confirmed by other French Alexa users with no clear explanation)

Hence my need to try play a stream rather than the name of the station :wink:

I tried your code a couple posts above and the more recent one to obtain this :

type: custom:layout-card
layout: vertical
cards:
  - type: picture
    image: https://demo.home-assistant.io/stub_config/t-shirt-promo.png
    tap_action:
      action: call-service
      service: media_player.play_media
      service_data:
        media_content_type: custom
        media_content_id: play Fréquence 3 on TUNEIN
      target:
        entity_id: media_player.office
  - type: picture
    image: https://demo.home-assistant.io/stub_config/t-shirt-promo.png
    tap_action:
      action: call-service
      service: media_player.play_media
      service_data:
        media_content_type: TUNEIN
        media_content_id: play Frequence3
      target:
        entity_id: media_player.office

The results are baffling to the least…

With media_content_type: custom , HA would play randomly either the Dance stream or the Urban stream after I hit the button a couple times ! (never the regular one that I am hoping)

With media_content_type: TUNEIN , it never works even after trying different syntaxes.

  • with Fréquence3 or Frequence3 (no space, with oor without the accent) : Alexa responds “I cannot play that on TuneIn”
  • with Frequence 3 (with a space) : Alexa responds “What do you want to hear ?”

I’m not sure how you made it work with media_content_type: TUNEIN :confused:

If I replace the radio name like so, it works like a charm :

media_content_type: TUNEIN
media_content_id: play RTL

proving that the problem comes from that specific Frequence 3 radio (not sure the space in the name is the culprit)

So still no dice for me to play the regular Frequence 3 radio :crying_cat_face:

Hi Jerome,

if you use media_content_type: TUNEIN
don’t use play
if you use media_content_type: custom
use the whole string: play station_name on TUNEIN

Always use the syntax as it is shown in Tunein, for example, if you search for Frequence3 in Tunein you’ll get this (all station names):


because it is seems not to be a clear search phrase.
But if you search for Frequence 3 you got exactly one station only with this name:

I also found Fréquence 3 FM → there and using this as name works as expected too.

Anyway, sometimes the results are not to understand. If I use Fréquence 3 WORLD I got this:

Regarding the group playing: different from the Spotify integration, playing on Alexa multiroom groups is not working. You need to use a stereo group and address a member of the group or use the APP.

I would make a view with all possible methods and wait a week or two if none is working. As said sometimes it solves problems.
Good luck.

1 Like

Thank you !

media_content_type: TUNEIN
media_content_id: Fréquence 3 FM

did the trick and does play the original Frequence 3 stream ! :tada:

You’re welcome & good to hear.
Enjoy!

I got my TuneIn stream working on an Alexa group based on what we discussed above !

Here is a script :

alias: "Media : play Frequence 3 on Downstairs"
sequence:
  - service: media_player.play_media
    data:
      media_content_type: TUNEIN
      media_content_id: Fréquence 3 FM on Downstairs # <= I have a group of a couple Alexa speakers called Downstairs
      enqueue: replace
    target:
      entity_id: media_player.living # <= this Alexa speaker exists but will be ignored !
mode: single
icon: mdi:play

(this trick above is explained on a documentation and I read a few days ago but cannot put my hands on)

I can launch it from this card :

type: custom:mini-media-player
entity: media_player.downstairs
tts:
  platform: alexa
  entity_id: media_player.downstairs
shortcuts:
  buttons:
    - type: script
      name: Fréquence 3
      id: script.media_play_frequence3_on_downstairs
  columns: 2
show_source: icon
sound_mode: icon
source: icon
artwork: material
info: scroll
toggle_power: true
volume_stateless: false
group: false

Thanks for sharing, but no luck here.

You might got it from there?
I have three stereo groups and one multiroom group (called Dinnerparty) which incl. all three stereo groups and three standalone Alexas.

The idea of it IMO is to address one of the standalone Alexa to play on the multiroom group Dinnerparty, like

data:
      media_content_type: TUNEIN
      media_content_id: Fréquence 3 FM on Dinnerparty
      enqueue: replace
    target:
      entity_id: media_player.echo_show_5

But as expected (I tried something similar before) it don’t work. The answer is “I didn’t find any station with the name Fréquence 3 FM on Dinnerparty on TUNEIN” - the whole string of media_content_id is transferred as the station name.