Echo Devices (Alexa) as Media Player - Testers Needed

+1 same for me too

When I re-authenticate I get the following confusing message.

alexaaborted

I get to this step…Change the url to https://alexa.amazon.com/api/behaviors/automations (or region specific url). This is the page showing your automations.

I get this response.

This alexa.amazon.com page can’t be found

No webpage was found for the web address: https://alexa.amazon.com/api/behaviors/automations

HTTP ERROR 404

I have multiple routines,so I don’t know why.

How to stop, in an automation, a routine previously activated? I tried with the media_player.media_stop service but unsuccesfully.

My automation is:

  action:
  - service: media_player.play_media
    data:
      entity_id: media_player.echo_plus
      media_content_type: routine
      media_content_id: Caccia i ladri

ignore “aborted” everything’s fine when alexa works

maybe simply like this:

- service: media_player.play_media
              data_template:
                entity_id: "media_player.echo_plus"
                media_content_id: "stop"
                media_content_type: custom or routine

Yes, that’s a very good solution… i’ll try it asap… Thanks!
EDIT: Why u use data_template and not only data?

hmm…I had issues with data: some weeks ago.
I was too lazy, to try it only with data again :blush:
But you’re right, there is no template, so data ist the right way!

Since several versions (0.115 I think) service and data accept templates

Hey guys,

Looking at the git hub and trying to work out of this is possible or not.

When temp sensor reaches 27", check to see if door and windows are closed, if not send a TTS event to all media players every 15m with X message.
Once doors and or windows are shut, turn on AC

Is anyone running something like that?

Hi, that’s not a topic for this thread imo.
But I would approach this request with a wait for trigger and repeat.
You find documentation about that here: https://www.home-assistant.io/docs/scripts/#repeat-a-group-of-actions

Thanks. Fixed the wiki to reference the right url. If you’re seeing this in the app, make sure you’re on the latest version.

Is there code for this layout anywhere? I use amazon music rather than spotify, but would love to implement something like this. I found using the media player card, just allows stopping music, and changing volume, but not able to specify what is played.

The music_groups have to be configured in your alexa app.
Playing music works like this example:

- service: media_player.play_media
              data:
                entity_id: media_player.receiver
                media_content_id:  "shuffle my playlist xxxx auf receiver" or "play bbc auf receiver"
                media_content_type: custom

The content_id is exacly what you would say to alexa.
The entity_id is the echo you virtually speaking to.

I created a ui in order to control my amazon music:


But it is still a little bit shaky due to unexpected behavior of the echos sometimes.
It’s at this point nothing I would share

Go into the developer tools and play a little bit around with the right commands.
Interestingly the wording differs a little when calling radio stations.
For playlists, the command is always the same - that’s my experience.

Edit: By the way: I created all music groups myself and to not use the amazon pre configured groups.
I have groups for music playing and groups for announcements.
At least I always keep one echo out of playing music in order to alwasy be able to set up commands.
This music groups have a strange behavior sometimes here in Germany.

Thanks, but i’m wondering how you managed to have the drop box’s for the playlists, and device selection, it looks like you can choose the devices you want to play on, then select what you want to play, and just press play selection. or tap on the pre-selected items at the bottom and it will play on the chosen devices, is that no the case?

The dropboxes are simple input_selects:

music_sources:
  name: Music Player/Gruppe
  options:
    - "alle_etagen"
    - "erdgeschoss"
    - "haus"
    - "homeoffice"
    - "unten"
    - "receiver"
  initial: "erdgeschoss"
  icon: mdi:speaker-wireless
amazon_playlists:
  name: "Amazon playlists"
  options:
    - "keine Auswahl"
    - "Akustischer Winter"
    - "Chillout-Lounge"
    - "Chillen am Strand"
    - "Entspannter Sommer"
    - "FFH Lounge"
    - "Hits von heute"
    - "Lounge und Bar"
    - "Musik für ruhige Wintertage"
    - "Mein Discovery Mix"
    - "Nicht stressen lassen!"
    - "Pop für ruhige Wintertage"
    - "Pop Lounge Cafe"
    - "Puro Reggaeton"
    - "Radio Entspannter Pop und Weihnachten"
    - "Radio Best of Party"
    - "Radio Young Pop"
    - "Radio Entspannter Pop"
  initial: "keine Auswahl"

For Music control i use a dynamic script:

command_play_music:
  sequence:
    - choose:
        - conditions:
            - "{{ states('sensor.active_harmony_scene') != 'Blutooth Music' and states('input_select.music_sources') in('receiver','erdgeschoss','alle_etagen','homeoffice') }}"
          sequence:
            - service: switch.turn_on
              entity_id: switch.lounge_bluetooth
            - service: media_player.play_media
              data_template:
                entity_id: media_player.receiver
                media_content_id: >
                  {% set player = states('input_select.music_sources') %}
                  {% if player == 'erdgeschoss' %}
                    {{media_content}} auf erdgeschoss
                  {% elif player == 'alle_etagen' %}
                    {{media_content}} auf alle etagen
                  {% elif player == 'homeoffice' %}
                    {{media_content}} im home office
                  {% else %}
                    {{media_content}} auf receiver
                  {% endif %}
                media_content_type: custom
            - condition: template
              value_template: "{{ states('input_select.music_sources') in('erdgeschoss','alle_etagen','homeoffice') }}"
            - service: media_player.volume_set
              data:
                entity_id:
                  - media_player.kuche
                  - media_player.office
                  - media_player.schlafzimmer
                volume_level: 0.2
        - conditions:
            - "{{ states('sensor.active_harmony_scene') == 'Blutooth Music' or states('input_select.music_sources') not in('receiver','erdgeschoss','alle_etagen','homeoffice') }}"
          sequence:
            - service: media_player.play_media
              data_template:
                entity_id: >
                  {% set player = states('input_text.last_alexa_music_source') %} # set in trigger of input_select
                  {% if player in('receiver','erdgeschoss','alle_etagen','homeoffice') %}
                     media_player.receiver
                  {% elif player in('unten','haus') %}
                     media_player.wohnzimmer
                  {% else %}
                     media_player.{{ states.input_select.music_sources.state }}
                  {% endif %}
                media_content_id: "stop"
                media_content_type: custom
            - delay: "00:00:01"
            - service: media_player.play_media
              data_template:
                entity_id: >
                  {% set player = states('input_select.music_sources') %}
                  {% if player in('receiver','erdgeschoss','alle_etagen','homeoffice') %}
                     media_player.receiver
                  {% elif player in('unten','haus') %}
                     media_player.wohnzimmer
                  {% else %}
                     media_player.{{ states.input_select.music_sources.state }}
                  {% endif %}
                media_content_id: >
                  {% set player = states('input_select.music_sources') %}
                  {% if player == 'erdgeschoss' %}
                    {{media_content}} auf erdgeschoss
                  {% elif player == 'alle_etagen' %}
                    {{media_content}} auf alle etagen
                  {% elif player == 'homeoffice' %}
                    {{media_content}} im home office
                  {% else %}
                    {{media_content}}
                  {% endif %}
                media_content_type: custom
            - condition: template
              value_template: "{{ states('input_select.music_sources') in('erdgeschoss','alle_etagen','haus','unten','homeoffice') }}"
            - service: media_player.volume_set
              data:
                entity_id:
                  - media_player.kuche
                  - media_player.office
                  - media_player.schlafzimmer
                volume_level: 0.2
    - service: script.turn_on
      entity_id: script.add_log
      data:
        variables:
          name: "{{media_content}} auf {{ states.input_select.music_sources.state }}  - Type: {{media_type}}"
          message: "has been triggered"
    - service: input_text.set_value
      data_template:
        entity_id: input_text.last_alexa_music_command
        value: "{{media_content}}"
    - service: input_boolean.turn_on
      entity_id: input_boolean.music_playing
    - delay: "00:00:02"
    - service: script.turn_on
      entity_id: script.command_connect_blutooth

Own playlists often used and therefore have a button.
Two examples

command_play_alltime_best:
  sequence:
    - service: script.turn_on
      entity_id: script.command_play_music
      data:
        variables:
          media_content: "Shuffle meine alltime best playlist"
          media_type: custom
    - service: input_select.select_option
      data:
        entity_id: input_select.amazon_playlists
        option: "keine Auswahl"

Radio station:

command_play_pop_lounge_cafe:
  sequence:
    - service: script.turn_on
      entity_id: script.command_play_music
      data:
        variables:
          media_content: "tunein Pop Lounge Cafe"
          media_type: custom
    - service: input_select.select_option
      data:
        entity_id: input_select.amazon_playlists
        option: "keine Auswahl"

Play music text or playlist selection:

command_play_input_select:
  sequence:
    - service: script.turn_on
      entity_id: script.command_play_music
      data:
        variables:
          media_content: "spiele {{ states('input_select.amazon_playlists')|lower |replace('radio ', '') }}"
          media_type: custom

command_play_last_music:
  sequence:
    - service: script.turn_on
      entity_id: script.command_play_music
      data:
        variables:
          media_content: "{{ states('input_text.last_alexa_music_command') }}"
          media_type: custom

Stop music:

command_stop_music:
  sequence:
    - service: script.turn_on
      entity_id: script.add_log
      data:
        variables:
          name: "stop music"
          message: "has been triggered"
    - service: input_boolean.turn_off
      entity_id: input_boolean.music_playing
    - service: media_player.play_media
      data_template:
        entity_id: >
          {% set player = states('input_select.music_sources') %}
          {% if player in('receiver','erdgeschoss','alle_etagen','homeoffice') %}
              media_player.receiver
          {% elif player in('unten','haus') %}
              media_player.wohnzimmer
          {% else %}
              media_player.{{ states.input_select.music_sources.state }}
          {% endif %}
        media_content_id: "stop"
        media_content_type: custom
    - service: input_select.select_option
      data:
        entity_id: input_select.amazon_playlists
        option: "keine Auswahl"
    - service: media_player.play_media
      data_template:
        entity_id: media_player.receiver
        media_content_id: "trenne bluetooth"
        media_content_type: custom
    - service: automation.trigger
      entity_id: automation.set_volume_level
    - condition: template
      value_template: "{{ states('sensor.active_harmony_scene') == 'Blutooth Music' }}"
    - service: switch.turn_on
      entity_id: switch.toggle

Connect bluetoth is for my receiver.
I have one (old) echo, which is only for playing music via pioneer receiver`.
I have to desconnect the echo because its making noises when stays connected without playing music.
That’s annoying.

command_connect_blutooth:
  sequence:
    - condition: template
      value_template: "{{ state_attr('media_player.receiver','connected_bluetooth') != 'PhilipsBT' }}"
    - service: media_player.play_media
      data_template:
        entity_id: media_player.receiver
        media_content_id: "Verbinde bluetooth"
        media_content_type: custom
``
1 Like

That’s great. Thank you. I’ll take a look at this in the next couple of days.

Ok, as I wrote before. This code is still under construction.
At least it can be optimized when understanding the echos behavior better.
Basically it works.

(1) Anyone know why I can’t see the captcha? I’ve tried with Chrome, Incognito, Edge, HA mobile app (android), & mobile chrome.

(2) Also, is it normal to have to reenter the 2FA code every time it needs to reauthenticate? (3) Just to confirm, the ‘2FA code’ refers to that static/does-not-change-every-minute code created when we set up this up with Alexa, correct? ‘2FA code’ does NOT mean the number that DOES change every minute, right?

Out of curiosity, how often are you guys being forced to reauthenticate with 2FA?

(1) This happens to me as well. I just enter in dummy information, hit submit, and of course it fails, but it refreshes this popup and the captcha should now appear.
(2) For me yes.
(3) For me, this IS the code that changes every 1 minute.