Echo Devices (Alexa) as Media Player - Testers Needed

Try this:

action:
  - service: notify.alexa_media
    data:
      message: The Garage Door just opened.
      data:
        type: announce
      target:
        - media_player.twilight_zone
        - media_player.office_dot
      title: Attention

Just updated to HA 2021.12 and the Alexa integration no longer loads - getting the following errors in the log file. Anyone else seeing this?

2021-12-12 21:14:51 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration eufy_security which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it i>
2021-12-12 21:14:51 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration icloud3 which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you >
2021-12-12 21:14:51 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration arris_dcx960 which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if>
2021-12-12 21:14:51 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you exp>
2021-12-12 21:14:57 WARNING (MainThread) [homeassistant.helpers.frame] Detected integration that called async_timeout.timeout with loop keyword argument. The loop keyword argument is deprecated and calls will fail after Home >
2021-12-12 21:14:57 ERROR (MainThread) [homeassistant.setup] Setup failed for alexa_media: unknown error
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 181, in _async_setup_component
    component = integration.get_component()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 522, in get_component
    cache[self.domain] = importlib.import_module(self.pkg_path)
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/config/custom_components/alexa_media/__init__.py", line 16, in <module>
    from alexapy import (
  File "/usr/local/lib/python3.9/site-packages/alexapy/__init__.py", line 16, in <module>
    from .alexaapi import AlexaAPI
  File "/usr/local/lib/python3.9/site-packages/alexapy/alexaapi.py", line 21, in <module>
    from alexapy.aiohttp import ClientConnectionError, ClientResponse
  File "/usr/local/lib/python3.9/site-packages/alexapy/aiohttp/__init__.py", line 6, in <module>
    from .client import (
  File "/usr/local/lib/python3.9/site-packages/alexapy/aiohttp/client.py", line 35, in <module>
    from . import hdrs, http, payload
  File "/usr/local/lib/python3.9/site-packages/alexapy/aiohttp/http.py", line 7, in <module>
    from .http_parser import (
  File "/usr/local/lib/python3.9/site-packages/alexapy/aiohttp/http_parser.py", line 15, in <module>
    from .helpers import NO_EXTENSIONS, BaseTimerContext
  File "/usr/local/lib/python3.9/site-packages/alexapy/aiohttp/helpers.py", line 667, in <module>
    class CeilTimeout(async_timeout.timeout):
TypeError: function() argument 'code' must be code, not str
2
1 Like

FYI - updating the integration in HACS fixes this - working now!

1 Like

I tried that, but it didn’t work. Then I tried just the office dot (the one that wasn’t working) and it didn’t announce. I tested just twilight zone, and it worked.

What’s weird is that my office dot works with my media card and sending text to speech. Think I need to figure out why this dot isn’t working like the rest.

1 Like

Yeah, I’m an idiot. The dot was on do not disturb.

Can anyone clarify what is going on with the latest HA version and AMP?

I’m still on HA V2021.11.

My AMP is V3.10.12.

Is that the latest version of AMP? there isn’t a newer version of it according to HACS.

I saw that to be on HA v2021.12 you need to be on the beta version of AMP so as to not cause errors.

seeing all of the above how do I need to move forward?

If I update HA will the new version of AMP show up in HACS then? Or am I OK to update HA right now on my current AMP version?

I can confirm after upgrade to 2021.12, the new version of AMP 3.10.15 did show up automatically as a new update available in Hacs. I upgraded AMP and all has been working well with it and 2021.12 so far.

1 Like

Ok, thanks.

So the procedure is:

update HA
update AMP

Hi everyone,

Looking for some help here, I am a newbie to home assistant (around 4 - 6 weeks roughly) I have been trying to get the Alexa media player working, I found that it was not working previously due to needing the December update of home assistant which I have now installed.

I have managed to get it installed and working and have automated some bluetooth speakers turning on and off via the status which works fine.

The next step for me is getting the announcements working via Alexa, one of the use cases is that it will announce when my washing machine or tumble dried has finished but this is where the trouble comes in, I am trying to run the following test via the call service.

when it runs I receive the following error

Looking in the logs I get the following text:

Logger: homeassistant.helpers.script.websocket_api_script
Source: helpers/script.py:1382
First occurred: 17:44:15 (2 occurrences)
Last logged: 17:45:12

websocket_api script: Error executing script. Invalid data for call_service at pos 1: expected dict for dictionary value @ data['data']

Followed by

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/connection.py:134
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 17:44:15 (2 occurrences)
Last logged: 17:45:12

[140239490520448] Error handling message: expected dict for dictionary value @ data['data']. Got None
[140239343222640] Error handling message: expected dict for dictionary value @ data['data']. Got None

I also tried to create a small input boolean that announces test when switched on but I never get any announcement

  alias: Alexa Test
  description: ''
  trigger:
  - platform: state
    entity_id: input_boolean.alexa_test_toggle
    from: 'off'
    to: 'on'
  condition: []
  action:
  - service: notify.alexa_media
    data:
      message: Testing
      data:
        type: announce
      target: alexa_media_lr_s_echo_dot
      title: Test
  mode: single

It is very likely I am doing something wrong here I would guess so thought I would do a quick forum post to see if anyone can tell me where I am going wrong?

I am running on the latest version of HA 2021.12.4 & Latest version of the media player V3.10.15

Hi, for the first (the test) try something like this (you’re missing the data part and its value announce or tts):

service: notify.alexa_media
data:
  message: The Garage door has been open for 10 minutes.
  data:
    type: announce
  target: media_player.echo_office2, media_player.echo_office
  title: Your Garage Door friend

For the test automation:

alias: New Automation
description: ''
trigger:
  - platform: state
    entity_id: input_boolean.input_boolean_alexa_test_toggle
    from: 'off'
    to: 'on'
condition: []
action:
  - service: notify.alexa_media
    data:
      message: Testing
      target: media_player.echo_office2, media_player.echo_office
      data:
        type: announce
mode: single

ps
are you sure that this → alexa_media_lr_s_echo_dot is the internal name of your echo dot?

1 Like

what is the best way to tell what the internal name is, I got these names from VS code when typing it autofills.

And the names that show up under the devices tab

And the name of the one I am trying to test with using the Automation\Service call.

Looking at the entity itself is making me think realise I might have been using the wrong name all this time :thinking:

Yeah, I wasn’t 100% sure that they all should start with media_player or if they could be renamed…
Go there → grafik
click on entities and on the top, to the left type in media_

Thanks, looks like they do all start media player.

I now have the test automation working, thank you very much!

Welcome and have fun!

1 Like

Now that we can have Santa as a voice option on Alexa “Hay Santa” and he seem to be a fully Polly style voice, anyone know if we make him be the voice on notify.alexa_media?

Hi everyone, for some reason the captcha is not showing, anyone knows why is that?

Try restarting HA… if it needs to reauth and you don’t see it within about 10 minutes it never seems to work for me. Restarting HA usually brings it back.

Is it possible to use different languages in automations with notify.alexa_media service?
I am using italian language but i some automations i want to use thai language. If it is possible, how?

I tried this, but it doesn’t work:

  - service: notify.alexa_media
    data:
      target: media_player.echo_plus
      data:
        type: tts
      message: '{{ [ ''ในที่สุดคุณก็อยู่ที่บ้านเจ้าหญิง'' , ''ยินดีต้อนรับความรักของฉันกลับมา''
        , ''วันนี้เป็นอย่างไรบ้าง'' ,           ''สวัสดีฉันหวังว่าคุณจะสนุกไปกับการอยู่ข้างนอก''
        , ''ความนับถือ'' , ] |random }}'
```

AFAIK you can use any language Alexa supports. Thai is IMO none of them.

Ok, thanks, but which is the config to use to have alexa notifications speak in a different language in an automation?