Echo Devices (Alexa) as Media Player - Testers Needed

alexa
Tags: #<Tag:0x00007f1b9b9d8cb8>

#1186

nope.
not in the uk, or the usa or germany.
or at least not with this component.

the stop command can be created with the script earlier mentiond in this topic


#1187

i’m getting this error when i try to check my config after implementing the addon :frowning:
INFO:homeassistant.util.package:Attempting install of colorlog==3.1.4
Testing configuration at /config
ERROR:homeassistant.scripts.check_config:BURB
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/scripts/check_config.py”, line 207, in check
res[‘components’] = check_ha_config_file(hass)
File “/usr/local/lib/python3.6/site-packages/homeassistant/scripts/check_config.py”, line 372, in check_ha_config_file
platform = loader.get_platform(hass, domain, p_name)
File “/usr/local/lib/python3.6/site-packages/homeassistant/loader.py”, line 60, in get_platform
return get_component(hass, PLATFORM_FORMAT.format(domain, platform))
File “/usr/local/lib/python3.6/site-packages/homeassistant/loader.py”, line 92, in get_component
module = importlib.import_module(path)
File “/usr/local/lib/python3.6/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 994, in _gcd_import
File “”, line 971, in _find_and_load
File “”, line 955, in _find_and_load_unlocked
File “”, line 665, in _load_unlocked
File “”, line 674, in exec_module
File “”, line 781, in get_code
File “”, line 741, in source_to_code
File “”, line 219, in _call_with_frames_removed
File “/config/custom_components/media_player/alexa.py”, line 7

^
SyntaxError: invalid syntax
Fatal error while loading config: invalid syntax (alexa.py, line 7)
Failed config
General Errors:
- invalid syntax (alexa.py, line 7)
Successful config (partial)

Anyone a suggestion


#1188

you have made an error when you added it to the yaml.


#1189

@ReneTode

Thanks… I thought so :frowning:

As for stop, as far as I can tell, this only works when the dot is playing something “natively”, i.e. not via a skill.
I want to stop playback from PLEX - which definitely doesn’t work for me. I want to do this so when I tell Alexa to turn of the stereo, I don’t want the music blaring from the dot…(without saying “stop” first).


#1190

it seems like when it comes to music, alexa doesnt know stop. only pause.
thats consistant with the behaviour when you speak to her, because after you say stop, she stops playing the music, but you can resume the play at any time.

to stop a skill, there must be a part from the skill that understands the command.
so there also should be a pause there.

but at this time i dont think you can control anything from a skill. not starting it, not stopping it, not pausing it.
you also cant control it from the alexa app or routines.


#1191

Hi. Any UK users having problems with the echo devices only showing standby status and won’t show currently playing on individual devices but will show up on the group device


#1192

I’m struggling a little bit with Tunein. Can someone offer a clue? I can verbally ask Alexa to play “The Roar” or “WCCP” or “105.5” on Tunein (all of which refers to the same radio station) and the echo plays the radio station. However when I do the following, Alexa says, “I cannot play by artist on Tunein”:

alexa_play_wccp:
  alias: WCCP Radio
  sequence:
  - service: media_player.play_media
    data:
      entity_id: media_player.echo_plus
      media_content_id: “WCCP”
      media_content_type: "TUNEIN"

I have tried all 3 variations in the media_content_id. Can anyone give advice?


#1193

@ReneTode
this is the yaml i have at the moment.

media_player:

I have also tried it with " " around the parameters
media_player:

But neither of the two worked for me


#1194

Managed to fix the issue, just redownloaded the .py file.

The one i downloaded from GITHub yesterday didn’t seem to be working


#1195

@ReneTode

Thanks for confirming. I guess that until we get a stop option in routines, I won’t be able to do this… back to playing a silent track instead.

All your input on this topic is very much appreciated.


#1196

This is what I did:

input_boolean:
  officeecho_preset_1:
    initial: off
    icon: mdi:numeric-1-box-outline
  officeecho_preset_2:
    initial: off
    icon: mdi:numeric-2-box-outline
  officeecho_preset_3:
    initial: off
    icon: mdi:numeric-3-box-outline
  officeecho_preset_4:
    initial: off
    icon: mdi:numeric-4-box-outline
  officeecho_preset_5:
    initial: off
    icon: mdi:numeric-5-box-outline
  officeecho_preset_6:
    initial: off
    icon: mdi:numeric-6-box-outline
    
input_select:    
  office_echo:
    name: Media Select
    options:
    - None
    - Tropicana Bogota  
    - Radio Swisspop
    - Dubai 92
    - Dubai Eye 103.8
    - Newshour (BBC)
    - BBC News
    initial: None
    icon: mdi:target

automation:
- id: office_echo_music   ## Announce what is typed as input
  alias: Office Echo Music
  trigger:
  - platform: state
    entity_id: 
    - input_boolean.officeecho_preset_1
    - input_boolean.officeecho_preset_2
    - input_boolean.officeecho_preset_3
    - input_boolean.officeecho_preset_4
    - input_boolean.officeecho_preset_5
    - input_boolean.officeecho_preset_6
  action:
  - service: input_select.select_option
    data_template:
      entity_id: input_select.office_echo
      option: >
        {% if trigger.entity_id.split(".")[1].split("_")[2].split("_")[0] | int == 1 %} Tropicana Bogota
        {% elif trigger.entity_id.split(".")[1].split("_")[2].split("_")[0] | int == 2 %} Radio Swisspop
        {% elif trigger.entity_id.split(".")[1].split("_")[2].split("_")[0] | int == 3 %} Dubai 92
        {% elif trigger.entity_id.split(".")[1].split("_")[2].split("_")[0] | int == 4 %} Dubai Eye 103.8
        {% elif trigger.entity_id.split(".")[1].split("_")[2].split("_")[0] | int == 5 %} Newshour (BBC)
        {% elif trigger.entity_id.split(".")[1].split("_")[2].split("_")[0] | int == 6 %} BBC News {% endif %}
  - service: media_player.play_media
    data_template:
      entity_id: media_player.office_echo_dot
      media_content_id: "{{ states.input_select.office_echo.state }}"
      media_content_type: "TUNEIN" #AMAZON_MUSIC, SPOTIFY, PANDORA, TUNEIN, I_HEART_RADIO
      
      
#############lovelace card #######

    - id: echo09
      type: custom:vertical-stack-in-card #vertical-stack
      cards:
      - id: echo10
        type: custom:mini-media-player
        entity: media_player.office_echo_dot
        name: Office Echo Dot
        artwork: cover
        power_color: true
        show_progress: true
        group: true
      - id: echo11
        type: glance
        columns: 6
        show_state: false
        show_name: false
        entities:
        - entity: input_boolean.officeecho_preset_1
          tap_action: toggle
        - entity: input_boolean.officeecho_preset_2
          tap_action: toggle
        - entity: input_boolean.officeecho_preset_3
          tap_action: toggle
        - entity: input_boolean.officeecho_preset_4
          tap_action: toggle
        - entity: input_boolean.officeecho_preset_5
          tap_action: toggle
        - entity: input_boolean.officeecho_preset_6
          tap_action: toggle 

the content id (input_select) has to be the exact name the amazon tunein card shows in alexa app.

hope it helps!

edit, for your station you need to type The Roar. see card picture


#1197

you need to add the files as includes in your configuration file


#1198

Thanks for the reply. When I try The Roar with the code below, Alexa responds with “I cannot play by song on Tunein”. Any ideas?

alexa_play_wccp:
  alias: WCCP Radio
  sequence:
  - service: media_player.play_media
    data:
      entity_id: media_player.echo_plus
      media_content_id: “The Roar”
      media_content_type: "TUNEIN"

#1199

no. looks correct. Does it work with another station?


#1200

Yes, it works with other stations. You were able to use your code to play “The Roar” or did you bring it up with voice? If your code works with “The Roar” I will try it. Thanks again


#1201

No, didnt try with The Roar. I looked it up on the browser.


#1202

I finally found a solution to this which may help someone else trying to play a Tunein station with the call letters. Even though I can verballly tell Alexa to play either “The Roar”, “105.5”, or “WCCP” on Tunein to play successfullly, none of those would work in a HA script.

The only thing that would work is if I put a space between the call letters. “W C C P” as the media_content_id. Nothing else would work.


#1203

makes sence.
probably with dots between it it will also work.
what helps is looking at the alexa history when you speak to her and see how she translates it to text.


#1204

No I tried that before the spaces and it failed. And yes the history showed w.c.c.p. but only spaces work.


#1205

yeah with dots its always a bit strange.
i think in most cases the dots that she writes in history need to be replaced with spaces.