Echo Devices (Alexa) as Media Player - Testers Needed

Hi Guys,

I received a email from Amazon:

The 12-month Free Tier period for your AWS account 60<SNIP>84 will expire on July 31, 2022. **If no action is taken, your resources will continue to run, and you’ll be automatically billed for any active resources when the 12-month Free Tier period ends** .

all usage statistics are 0

Is this has do something with using the services we use for Alexa integration?
Or is this something else?

This worked for me. I was able to complete the install.

Thanks

I have a card with horizontal stacked button cards. When you press one of the buttons it starts streaming from Pandora. Thanks to alandtse’s latest media player update (4.1.0) it now works. :slight_smile: The stop button turns the stream off.

 - entity: media_player.echo_spot
   icon: mdi:drama-masks
   name: Lewis Black
   show_state: false
   tap_action:
     action: call-service
     entity: media_player.echo_spot
     service: media_player.play_media
     service_data:
       entity_id: media_player.echo_spot
       media_content_id: Lewis Black Radio
       media_content_type: PANDORA
   type: button
 - entity: media_player.echo_spot
   icon: mdi:stop
   name: Stop
   show_state: false
   tap_action:
     action: call-service
     entity: media_player.echo_spot
     service: media_player.media_stop
     service_data:
       entity_id: media_player.echo_spot
   type: button

Essentially you need to do a call service with the service being media_player.play_media with service data what you want to stream. To stop is another call service this time the service is media_player.media stop

Hope this helps.

Can I directly play a url stream https://19993.live.streamtheworld.com/SKYRADIO.mp3 ??

The simple answer to this is no, you can’t play mp3 with a caveat. The mp3 must be at 48kb/s which is OK for speech but not for music. And the mp3 must be less than 240 seconds. So essentially playing mp3s is pretty well limited to sound effects and short voice prompts/responses.

To stream music requires a skill installed through you Alexa app you want to stream from.

A search on Amazon for a skill, I found “Dutch Radio” as the one you probably will need to install. If you do, I think the follow should work to stream Sky Radio based on how I set up Pandora:

action: call-service
entity: <the echo media player you want to play the stream>
service: media_player.play_media
service_data:
  entity_id: <again the echo media player (haven't tested if both entries are needed)>
  media_content_id: Sky Radio
  media_content_type: Dutch Radio

I haven’t tested this, but if it works the same as Pandora, it should. As for the skill, you might want to read the comments about it before you decide for yourself whether to install or not on your Alexa app.

Good luck

I have this to let it work on my 2 Alexa’s and FKB:

  - type: vertical-stack
    title: Radio station selector
    cards:
      - type: entities
        entities:
          - entity: input_select.helpers_radio_selector
          - entity: input_select.helpers_radio_station
          - entity: script.stream_radio
            icon: mdi:play
            secondary_info: none
            name: Start selection
stream_radio:
  alias: "Control - Play Radio"
  icon: mdi:play
  description: "Radio - Here all channels can be selected and turn them on or off on Tablet or Alexa"
  sequence:
    - service: media_player.play_media
      data:
        entity_id: >-
          {% if is_state('input_select.helpers_radio_selector', 'Bedroom') %} 
            media_player.bedroom
          {% elif is_state('input_select.helpers_radio_selector', 'Livingroom') %} 
            media_player.livingroom
          {% elif is_state('input_select.helpers_radio_selector', 'Kitchen') %} 
            media_player.browser_mod_ae1b43e7_eb57c683
          {% endif %}
        media_content_id: >-
          {% if is_state('input_select.helpers_radio_station', 'Radio 538') and states('input_select.helpers_radio_selector') in ['Bedroom', 'Livingroom'] %} 
            play Radio538 on TUNEIN
          {% elif is_state('input_select.helpers_radio_station', 'Q-Music') and states('input_select.helpers_radio_selector') in ['Bedroom', 'Livingroom'] %} 
            play Qmusic on TUNEIN
          {% elif is_state('input_select.helpers_radio_station', '3FM') and states('input_select.helpers_radio_selector') in ['Bedroom', 'Livingroom'] %} 
            play 3FM on TUNEIN
          {% elif is_state('input_select.helpers_radio_station', '100% NL') and states('input_select.helpers_radio_selector') in ['Bedroom', 'Livingroom'] %} 
            play 100%NL on TUNEIN
          {% elif is_state('input_select.helpers_radio_station', 'Veronica') and states('input_select.helpers_radio_selector') in ['Bedroom', 'Livingroom'] %} 
            play Radio Veronica on TUNEIN
          {% elif is_state('input_select.helpers_radio_station', 'Sky Radio') and states('input_select.helpers_radio_selector') in ['Bedroom', 'Livingroom'] %} 
            play Sky Radio on TUNEIN
          {% elif is_state('input_select.helpers_radio_station', 'Sky Radio Christmas') and states('input_select.helpers_radio_selector') in ['Bedroom', 'Livingroom'] %} 
            play Sky Radio Christmas on TUNEIN
          {% elif is_state('input_select.helpers_radio_station', 'SLAM! Hardstyle') and states('input_select.helpers_radio_selector') in ['Bedroom', 'Livingroom'] %} 
            play Slam! Hardstyle TUNEIN
          {% elif is_state('input_select.helpers_radio_station', 'SLAM!') and states('input_select.helpers_radio_selector') in ['Bedroom', 'Livingroom'] %} 
            play SLAM! on TUNEIN

          {% elif is_state('input_select.helpers_radio_station', 'Radio 538') and is_state('input_select.helpers_radio_selector', 'Kitchen') %} 
            https://21253.live.streamtheworld.com/RADIO538.mp3
          {% elif is_state('input_select.helpers_radio_station', 'Q-Music') and is_state('input_select.helpers_radio_selector', 'Kitchen') %} 
            https://stream.qmusic.nl/qmusic/aachigh
          {% elif is_state('input_select.helpers_radio_station', '3FM') and is_state('input_select.helpers_radio_selector', 'Kitchen')  %} 
            http://icecast.omroep.nl/3fm-bb-mp3
          {% elif is_state('input_select.helpers_radio_station', '100% NL') and is_state('input_select.helpers_radio_selector', 'Kitchen') %}
            https://stream.100p.nl/100pctnl.mp3
          {% elif is_state('input_select.helpers_radio_station', 'Veronica') and is_state('input_select.helpers_radio_selector', 'Kitchen') %} 
            https://20723.live.streamtheworld.com/VERONICA.mp3 
          {% elif is_state('input_select.helpers_radio_station', 'Sky Radio') and is_state('input_select.helpers_radio_selector', 'Kitchen') %} 
            https://19993.live.streamtheworld.com/SKYRADIO.mp3
          {% elif is_state('input_select.helpers_radio_station', 'Sky Radio Christmas') and is_state('input_select.helpers_radio_selector', 'Kitchen') %} 
            https://20853.live.streamtheworld.com/SRGSTR08.mp3
          {% elif is_state('input_select.helpers_radio_station', 'SLAM! Hardstyle') and is_state('input_select.helpers_radio_selector', 'Kitchen') %} 
            https://stream.slam.nl/web11_mp3
          {% elif is_state('input_select.helpers_radio_station', 'SLAM!') and is_state('input_select.helpers_radio_selector', 'Kitchen') %} 
            https://stream.slam.nl/web14_mp3
          {% endif %}
        media_content_type: >-
          {% if is_state('input_select.helpers_radio_selector', 'Kitchen') %} audio/mp3
          {% elif states('input_select.helpers_radio_selector') in ['Bedroom', 'Livingroom'] %} custom
          {% endif %}

###########################################################################################
# RADIO STOP COMMAND
###########################################################################################
stream_radio_stop:
  alias: "Stop Radio"
  icon: mdi:stop
  sequence:
    - service:  >-
        {% if is_state('input_select.helpers_radio_selector', 'Kitchen') %} media_player.media_stop
        {% elif states('input_select.helpers_radio_selector') in ['Bedroom', 'Livingroom'] %} media_player.media_pause
        {% endif %}
      data:
        entity_id: >-
          {% if is_state('input_select.helpers_radio_selector', 'Livingroom') %} media_player.livingroom
          {% elif is_state('input_select.helpers_radio_selector', 'Bedroom') %} media_player.bedroom
          {% elif is_state('input_select.helpers_radio_selector', 'Kitchen') %} media_player.browser_mod_ae1b43e7_eb57c683
          {% endif %}

1 Like

Really thank you for the help… I am using a nest mini and url stream can be easily played via it. I was hoping to do the same with alexa but unfortunately it seems it’s not possible.

Which device are you using in kitchen ?

Alexa Livingroom, Alexa Bedroom and Fully Kiosk Browser on a tablet on the wall in the kitchen :slight_smile:

Ok thanks for the help…

FWIW, you can make your script easier to edit and more efficient by using variables instead of all those if/elifs:

stream_radio:
  alias: "Control - Play Radio"
  icon: mdi:play
  description: "Radio - Here all channels can be selected and turn them on or off on Tablet or Alexa"
  sequence:
    - variables:
        select: "{{ states('input_select.helpers_radio_selector') }}"
        entity:
          Bedroom: media_player.bedroom
          Livingroom: media_player.livingroom
          Kitchen: media_player.browser_mod_ae1b43e7_eb57c683
        entity_id: "{{ entity.get(select) }}"
        content:
          Radio 538: ['Radio538', 'https://21253.live.streamtheworld.com/RADIO538.mp3']
          Q-Music: ['Qmusic', 'https://stream.qmusic.nl/qmusic/aachigh']
          3FM: ['3FM', 'http://icecast.omroep.nl/3fm-bb-mp3']
          100% NL: ['100%NL', 'https://stream.100p.nl/100pctnl.mp3']
          Veronica: ['Veronica', 'https://20723.live.streamtheworld.com/VERONICA.mp3']
          Sky Radio: ['Sky Radio', 'https://19993.live.streamtheworld.com/SKYRADIO.mp3']
          Sky Radio Christmas: ['Sky Radio Christmas', 'https://20853.live.streamtheworld.com/SRGSTR08.mp3']
          SLAM! Hardstyle: ['SLAM! Hardstyle', 'https://stream.slam.nl/web11_mp3']
          SLAM!: ['SLAM!', 'https://stream.slam.nl/web14_mp3']
        content_id_list: "{{ content.get(states('input_select.helpers_radio_station')) }}"
    - service: media_player.play_media
      data:
        entity_id: "{{ entity_id }}"  
        media_content_id: >-
          {% if select in ['Bedroom', 'Livingroom'] %} 
            play {{ content_id_list[0] }} on TUNEIN
          {% else %}
            {{ content_id_list[1] }}
          {% endif %}
        media_content_type: "{{ iif(select == 'Kitchen', 'audio/mp3', 'custom') }}"
4 Likes

Wow. that’s a nice code. Im not that good. But with this kind of support I will learn more and more.
Do you know a good website to learn YAML code?

YAML coding on its own is simple.
most of the coding from HA is jinja and code that is interpreted by the python backend, so its not plain YAML making that code work.

everything between {{ and {% isnt YAML

2 Likes

It is possible to play a stream but unfortunately it currently requires setting up a dummy skill, I did this recently using this link Dabble Lab and set it up to stream audio from Music Assistant - amazingly this allowed music to stream to Alexa devices locally from my nas without leaving my network (apart from to get the initial playlist).
If it’s a static address you are hoping to play then you could create the dummy skill with the URL saved in it, and then use Alexa Media Player to start the skill.

I hope that one day Alexa Media player will work directly with Music Assistant, which may hopefully make things a little less cumbersome :grinning:

I’m struggling with this too. Some mp3 play other do not.

Does this integration support multiple amazon accounts now? I was skimming through old release notes and there were some fixes mentioning of secondary accounts, but I didn’t find a solid clue if it does support multiple accounts.

Yes although you should exclude shared devices (from one account) so they don’t appear twice.

Thanks for pointing to the skill

I have read through the wiki and this thread but I haven’t found a solution to having the media player card update its artwork and status when music is requested by voice to Alexa. Is this possible? I get an update but only if I hit the power button on the card. It will not update dynamically. Thanks in advance for any help! I appreciate everyone’s time!

Hello,

I am in your same situation, have you had any progress?
Has anyone done any tests with Echo Auto? (TTS)