How to play radio stations on an Alexa devices?

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.

Yes, that’s the link I had in mind ! (" Play in Alexa groups")

What if you try a different stream with no space/no accent in it ?
Are you saying that your Dinnerparty group has groups in it ? like nested groups ? :confused:
What if you try with a “simple” group of standalone speakers ?

Yes, sure. I have three stereo groups: living room (incl. a Sub), dining room and in my office. Alexa allows to nest them in multiroom groups and everything is working fine, when played from the Alexa App or from Spotify to any of this groups.

I don’t know. Wouldn’t make sense here to only group the kitchen Echo and the Echo at the shower to a group. And as long an Echo is in a stereo group it can’t used in another group anymore.

The Alexa integration also don’t allow me to address the stereo groups directly. As described in the link, I have to address one of its member to play for example on the stereo group in my office (without mentioning the group name anywhere like you did) - echo_office2 is a member:

  - type: picture
    image: /local/images/jfk.jpg
    tap_action:
      action: call-service
      service: media_player.play_media
      target:
        entity_id: media_player.echo_office2
      data:
        media_content_type: custom
        media_content_id: Jazz Funk Soul Radio

I believe its a limitation of the integration, because as I wrote before, its different with the Spotify integration, where I can address any group directly.

Hi all, I have a similar but different problem. Up until a month or so (can’t really be exact cause I haven’t listened to that radio station) my Otvoreni radio played without issues using this:

- type: custom
name: Otvoreni
id: play Otvoreni on tunein

Now it just says “I cannot play that on TuneIn.” And weirdly, I have no problems with starting that radio station directly on my Alexa.

Does anyone know what could be the reason? Other radio stations (and I have around 30 of them all play without issues.)

Thanks

Hi,
this might be not much of help, but well: it works here.

Anyone got any suggestions. I’m using Alexa Media player to summon a radio URL through the Radio Browser Skill but am not getting the artwork at all. Any views on how I might get it? The sound works fine though.

Could you please explain how did you get alexa to play a radio station through the browser skill? I thought you can only play it through Tune in!

if you use a custom ID, it basically just sends the command as if spoken to Alexa. So I have eg:

buttons:
- type: custom
name: M80
id: tell radio browser 45
image: [link to radio logo URL]

TuneIn is too frustrating:
a) It can’t deal with foreign language station names via Alexa
b) The ads.

Radio Browser gets round that. Downside is it seems you don’t get the stream art.

Thank you very much for your time. What you stated about Tune in, is exactly what I am facing now. Could please point me where to learn more about your example and how to create all of that? Thank you.

This is the site: Alexa Skill Radio Browser - TuneIn alternative
It’s an Alexa skill. You enable it on your Alexa, then you link it; and then you go in via a browser and edit your favourites (either with URLs or using their database) and ensure each is assigned a number. Then to call it locally you say Alexa, play [number of favourite] or via this integration, you effectively send the same command.

Make sure you have Alexa Media Player enabled in HomeAssistant. Try to create a card manually on the dashboard. Edit code and put in this;

- type: custom:mini-media-player
          artwork: full-cover-fit
          entity: media_player.john_s_echo_show
          name: Home
          shortcuts:
            columns: 2
            buttons:
              - type: custom
                name: [Name of station]
                id: tell radio browser [Favourite number from Radio Browser]
                image: [link to radio logo URL]
              - type: custom

(repeat however many buttons you want)

2 Likes

I am puzzled as I don’t get this to work.
There is no problem to cast radio stations to my Chromecast devices, using Action:

```action:
  - service: media_player.play_media
    data:
      media_content_type: audio/aac
      media_content_id: >-
        http://playerservices.streamtheworld.com/api/livestream-redirect/SRGSTR15AAC.aac
    target:
      entity_id:
        - media_player.mazal
        - media_player.brun_mbr_desk_show5
  - service: notify.alexa_media_mbr_tv
My Echo devices show in the list of media player, 
but while the radio plays on Chromecast, nothing happens on 
the Echo devices (mbr_desk_show5) , 
though I do  get pop-up that automation runs succesfully.