Echo Devices (Alexa) as Media Player - Testers Needed

The input_boolean belongs in the normal config.

Have it in normal config and getting above error messages in log :frowning:

Were you able to resolve this? I seem to have the same problem. How can I tell which version of alexapy I am running if I’m running latest Alexa Media Player integration (version 2.3.4)?

If that would potentially allow in house, room based device tracking by tracking which Alexa device a Bluetooth device is nearest to, that would be great and I’d definitely find it useful.

@alandtse could it be that the status reset (form amazon) in the night (echo device change to idle or standby) now not take place? I use the Alexa media Player for automation in combination with motion sensors to play radio with tunein if anyone come in the rooms in the past i must start at the morning with the following

- id: motion-sensor-kueche-radio-on-idle
  alias: Bewegungssensor Küche Radio an
  trigger:
    platform: state
    entity_id: binary_sensor.aeotec_zw100_kueche_sensor
    from: "off"
    to: "on"
  condition:
   condition: and
   conditions:
    - condition: time
      after: '06:30:00'
      before: '21:00:00'
    - condition: or
      conditions:
      - condition: state
        entity_id: media_player.radio_kuche
        state: 'standby'
      - condition: state
        entity_id: media_player.radio_kuche
        state: 'idle'
  action:
    - service: media_player.volume_set
      data: 
        entity_id: media_player.radio_kuche
        volume_level: 0.3
    - service: media_player.play_media
      data:
        entity_id: media_player.radio_kuche
        media_content_id: ndr zwei
        media_content_type: TUNEIN
    - service: media_player.media_play
      entity_id: media_player.radio_kuche

after this i only use the following automation, because if i use the first automation it changes the volume and reload the radiostation on every motion with a short breake. and on the otherside if i would play in de between a other radiostation or a playlist i dont would rechange this to my standart radiostation

#############################################################
# Küche Radio an bei Bewegung wenn pause
#############################################################
- id: motion-sensor-kueche-radio-on-paused
  alias: Bewegungssensor Küche Radio an wenn Pause
  trigger:
    platform: state
    entity_id: binary_sensor.aeotec_zw100_kueche_sensor
    from: "off"
    to: "on"
  condition:
   condition: and
   conditions:
    - condition: time
      after: '06:30:00'
      before: '21:00:00'
    - condition: or
      conditions:
      - condition: state
        entity_id: media_player.radio_kuche
        state: 'paused'
  action:
    - service: media_player.media_play
      entity_id: media_player.radio_kuche

now i see in Homeassistent the following state of the device at the morning

volume_level: 0.3
is_volume_muted: false
media_content_type: music
media_duration: 0
media_position: 5268
media_position_updated_at: '2019-11-09T20:48:23.618688+00:00'
media_title: Freya Ridings - Castles
media_artist: NDR 2
media_album_name: Alle aktuellen Hits und dazu der Sound der 80er
source_list: []
shuffle: false
available: true
last_called: false
friendly_name: Radio Küche
entity_picture: 'https://cdn-profiles.tunein.com/s228737/images/logoq.png?t=154228'
supported_features: 56253

in the mediaplayer lovelace card of mini mediaplayer i see the radiostation picture but i can’t start with play. i only can play if i reload the station.

artwork: cover
entity: media_player.radio_kuche
hide:
  volume: false
shortcuts:
  buttons:
    - data:
        entity_id: media_player.radio_kuche
        media_content_id: ndr zwei
        media_content_type: TUNEIN
      id: media_player.play_media
      name: NDR 2
      type: service
    - data:
        entity_id: media_player.radio_kuche
        media_content_id: ndr info
        media_content_type: TUNEIN
      id: media_player.play_media
      name: NDR Info
      type: service
    - data:
        entity_id: media_player.radio_kuche
        media_content_id: deutschlandfunk
        media_content_type: TUNEIN
      id: media_player.play_media
      name: Deutschlandfunk
      type: service
    - data:
        entity_id: media_player.radio_kuche
        media_content_id: absolute relax
        media_content_type: TUNEIN
      id: media_player.play_media
      name: Absolute Relax
      type: service
    - data:
        entity_id: media_player.radio_kuche
        media_content_id: sunshine live
        media_content_type: TUNEIN
      id: media_player.play_media
      name: Sunshine live
      type: service
    - data:
        entity_id: media_player.radio_kuche
        media_content_id: spiele meine playlist katja
        media_content_type: AMAZON_MUSIC
      id: media_player.play_media
      name: Katja
      type: service
    - data:
        entity_id: media_player.radio_kuche
        media_content_id: spiele meine playlist Daniel
        media_content_type: AMAZON_MUSIC
      id: media_player.play_media
      name: Daniel
      type: service
    - data:
        entity_id: media_player.radio_kuche
        media_content_id: spiele meine playlist Finley
        media_content_type: AMAZON_MUSIC
      id: media_player.play_media
      name: Finley
      type: service
    - data:
        entity_id: media_player.radio_kuche
        media_content_id: spiele meine playlist chillout
        media_content_type: AMAZON_MUSIC
      id: media_player.play_media
      name: Chillout
      type: service
  columns: 3
source: icon
type: 'custom:mini-media-player'

In addition i use following automation to stop automation for 3h if i mute the echo device

#############################################################
# Küche Radio aus und deaktivierung wenn Stumm an
#############################################################
- id: kueche-radio-deactivate-mute-true
  alias: Küche Radio deaktivieren wenn stumm
  trigger:
    platform: state
    entity_id: sensor.media_player_mute_status_radio_kueche
    from: 'False'
    to: 'True'
  action:
    - service: media_player.media_pause
      entity_id: media_player.radio_kuche
    - service: switch.turn_on
      entity_id: switch.radio_kuche_do_not_disturb_switch
    - service: automation.turn_off
      entity_id: automation.bewegungssensor_kuche_radio_an
    - service: automation.turn_off
      entity_id: automation.bewegungssensor_kuche_radio_an_wenn_pause
    - delay: 3:00:00
    - service: automation.turn_on
      entity_id: automation.bewegungssensor_kuche_radio_an
    - service: automation.turn_on
      entity_id: automation.bewegungssensor_kuche_radio_an_wenn_pause

if i unmute the echo device the following automation restarts the play on motion automation.

#############################################################
# Küche Radio aktivierung wenn Stumm aus
#############################################################
- id: kueche-radio-deactivate-mute-false
  alias: Küche Radio aktivieren wenn nicht stumm
  trigger:
    platform: state
    entity_id: sensor.media_player_mute_status_radio_kueche
    from: 'True'
    to: 'False'
  action:
    - service: switch.turn_off
      entity_id: switch.radio_kuche_do_not_disturb_switch
    - service: automation.turn_on
      entity_id: automation.bewegungssensor_kuche_radio_an
    - service: automation.turn_on
      entity_id: automation.bewegungssensor_kuche_radio_an_wenn_pause
1 Like

I have things setup however when I try and send Alexa a TTS command Alexa says that text to speech can only be called by the notify dot alexa media service. Is there something I missed in the setup?

I had a thought, not sure if this is possible. I have a Fire TV Cube on my bedroom TV. Is there any way to send commands to it to control the TV? I’m thinking somewhat similar to the “routines” command but instead just sends commands as you would speak them (like “tune to ESPN”). Is this possible?

1 Like

I have an unusual problem - I’m trying to send ‘push’ notifications to my mobile phone (media_player.matthew_s_alexa_apps) as part of an automation. My partner also has an alexa_media integration and this includes ‘media_player.matthew_s_alexa_apps’ so she is receiving notifications as well! Also, we get two notifications each.
I’ve uninstalled, removed directories, reinstalled through HACS and added Integrations with no luck so far.
Is there any way to separate our accounts? I thought of removing her but I also need to send her notifications as well.

Hi, that’s why alexa is sending notifications to the account and not to a single device. Alexa notifications are raised at any connected device to a certain account.
It’s better to use pushover in order to send detailed notifications to named devices.

Hi,
tonight I encountered a problem with TTS. Before actually saying what Alexa is supposed to say, she now starts every TTS output with “Sprich mir nach” (German for “repeat after me”). This makes TTS essentially useless. Have others encountered the same problem? I’m on the latest version of the custom component.

Hi all, I noticed a strange thing, sending a TTS text to my alexa media player it says something with the name “Simon” and then the message I wrote, maybe an easter egg or an hack of someone?

Yup, same here. Alexa uses the “Simon says” phrase. Something changed on the Amazon side, I guess?
Also, the Alexa alarm control panel is unavailable in HA. Too bad, coz I just spend a few hours synchronizing it to my alarm system last week.

That makes sense now, I’ll change my notification service. Thanks

I am having since some days these errors when restarting HA:

2019-11-13 10:59:43 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry [email protected] - amazon.it for alarm_control_panel
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/config_entries.py", line 190, in async_setup
    hass, self
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/alarm_control_panel/__init__.py", line 74, in async_setup_entry
    return await hass.data[DOMAIN].async_setup_entry(entry)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_component.py", line 151, in async_setup_entry
    raise ValueError("Config entry has already been setup!")
ValueError: Config entry has already been setup!
2019-11-13 10:59:49 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry [email protected] - amazon.it for media_player
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/config_entries.py", line 190, in async_setup
    hass, self
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/media_player/__init__.py", line 340, in async_setup_entry
    return await hass.data[DOMAIN].async_setup_entry(entry)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_component.py", line 151, in async_setup_entry
    raise ValueError("Config entry has already been setup!")
ValueError: Config entry has already been setup!
2019-11-13 11:00:00 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry [email protected] - amazon.it for switch
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/config_entries.py", line 190, in async_setup
    hass, self
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/switch/__init__.py", line 79, in async_setup_entry
    return await hass.data[DOMAIN].async_setup_entry(entry)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_component.py", line 151, in async_setup_entry
    raise ValueError("Config entry has already been setup!")
ValueError: Config entry has already been setup!
2019-11-13 11:00:03 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry [email protected] - amazon.it for media_player
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/config_entries.py", line 190, in async_setup
    hass, self
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/media_player/__init__.py", line 340, in async_setup_entry
    return await hass.data[DOMAIN].async_setup_entry(entry)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_component.py", line 151, in async_setup_entry
    raise ValueError("Config entry has already been setup!")
ValueError: Config entry has already been setup!
2019-11-13 11:00:03 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry [email protected] - amazon.it for alarm_control_panel
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/config_entries.py", line 190, in async_setup
    hass, self
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/alarm_control_panel/__init__.py", line 74, in async_setup_entry
    return await hass.data[DOMAIN].async_setup_entry(entry)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_component.py", line 151, in async_setup_entry
    raise ValueError("Config entry has already been setup!")
ValueError: Config entry has already been setup!
2019-11-13 11:00:03 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry [email protected] - amazon.it for switch
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/config_entries.py", line 190, in async_setup
    hass, self
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/switch/__init__.py", line 79, in async_setup_entry
    return await hass.data[DOMAIN].async_setup_entry(entry)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_component.py", line 151, in async_setup_entry
    raise ValueError("Config entry has already been setup!")
ValueError: Config entry has already been setup!
2019-11-13 11:00:07 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry [email protected] - amazon.it for sensor
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/config_entries.py", line 190, in async_setup
    hass, self
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/sensor/__init__.py", line 60, in async_setup_entry
    return await hass.data[DOMAIN].async_setup_entry(entry)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_component.py", line 151, in async_setup_entry
    raise ValueError("Config entry has already been setup!")
ValueError: Config entry has already been setup!
2019-11-13 11:00:07 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry [email protected] - amazon.it for sensor
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/config_entries.py", line 190, in async_setup
    hass, self
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/sensor/__init__.py", line 60, in async_setup_entry
    return await hass.data[DOMAIN].async_setup_entry(entry)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_component.py", line 151, in async_setup_entry
    raise ValueError("Config entry has already been setup!")
ValueError: Config entry has already been setup!

Which is the problem? How to fix?

Hi,

got this issue yesterday:

Tue Nov 12 2019 22:10:44 GMT+0100 (Mitteleuropäische Normalzeit)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/alexa_media/__init__.py", line 506, in update_devices
    await update_last_called(login_obj)
  File "/config/custom_components/alexa_media/__init__.py", line 552, in update_last_called
    last_called = await AlexaAPI.get_last_device_serial(login_obj)
  File "/usr/local/lib/python3.7/site-packages/alexapy/alexaapi.py", line 587, in get_last_device_serial
    response = await AlexaAPI.get_activities(login, items)
  File "/usr/local/lib/python3.7/site-packages/alexapy/alexaapi.py", line 551, in get_activities
    return (await response.json(content_type=None))['activities']
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 1040, in json
    return loads(stripped.decode(encoding))
  File "/usr/local/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Something I have to keep an eye on?

I am getting this same error since upgrading last night. Hassio won’t start.

Hi guys, I’ve installed integration but am having no luck testing if it works.
Can I please get an example of how to test this? e.g. which service to choose and what service data to put in (mine is asking for YAML).
I really only what to use this for TTS function on my echo dots.

I’m running Home Assistant 0.102.0.dev20191028 via docker.

I am in Australia if that makes a difference (using url: “amazon.com.au” in my configuration.yaml )

/edit
Turns out the url that worked for me was amazon.com

Do you have a Fire TV device, and are you also running AndroidTV? I had to exclude my Fire TV from alexa_media_player, remove the alexa_media_player integration, restart HA, and add the alexa_media_player integration back to fix this problem.

Hi! I have just added the code under and is wondering if someone could show me how to get Alexa to announce different sensors i have on HA? I am using the latest verison v2.3.4.
I have been searching around but cant find out how to do it. Hope someone can share a code how to do it.

notify:
  - platform: alexa_media
    name: alexa_media

i use for example the following script to announce over the state of other persons an states of sensors (like temperatur) if a person coming home

alex_home:
  alias: Alex kommt nach hause
  sequence:
  - wait_template: '{{ is_state(''person.alex'', ''home'') }}'
    timeout: 00:08:00
  - delay: 00:00:12
  - service: notify.alexa_media
    data_template:
      data:
        type: announce
      target: media_player.radio_wohnzimmer
      message: 'Hallo Alex. Willkommen zuhause. Mama ist {% if is_state("person.mama",
        "home") -%} auch zuhause. {%- else -%} nicht zuhause. {%- endif %} Papa ist
        {% if is_state("person.papa", "home") -%} auch zuhause. {%- else -%} nicht
        zuhause.{%- endif %} Die Temperatur zuhause beträgt {{ states("sensor.heizung_wohnzimmer_temperature")
        }} Grad. Und draussen ist es aktuell {{ states("sensor.openweathermap_temperature")
        }} Grad. Jetzt ist es {{ states("sensor.time") }} '

on the other side i use the following to announce about a text message from an input field…
Lovelace Config

entities:
  - entity: input_text.alexa_durchsage
    type: 'custom:text-input-row'
  - action_name: Senden...
    entity: script.durchsage
    icon: 'mdi:voice'
    name: ' '
    service: script.turn_on
    type: call-service
type: entities

the used plugin for the input field

an the beloning script for this…

durchsage:
  alias: Durchsage
  sequence:
  - service: media_player.volume_set
    data:
      entity_id: media_player.radio_wohnzimmer
      volume_level: '0.3'
  - delay: '00:00:03'
  - data_template:
      data:
        type: announce
      message: "{{ states('input_text.alexa_durchsage') }}"
      target: media_player.radio_wohnzimmer
    service: notify.alexa_media
  - data:
      message: "{{ states('input_text.alexa_durchsage') }}"
      title: '*Durchsage*'
    service: notify.telegram_group_channel_name```
3 Likes