Echo Devices (Alexa) as Media Player - Testers Needed

This seems to have stopped working for me today. The notify service (using announce) is failing without errors and trying to trigger a routine using the media_player.play_media service fails with this error in the logs:

An error occured accessing AlexaAPI: An exception of type JSONDecodeError occurred. Arguments:
('Expecting value: line 8 column 1 (char 7)',)

Any ideas about what the problem may be?

You’re not logged in anymore. Try deleting the cookie.

Thanks, I deleted the alexa_media.*****.pickle file and it’s working now. I’ve had problems before where I needed to log in again but, on those occasions, it was obvious that there was an issue because all the devices had disappeared. This time they still showed up and it still seemed to be properly showing the playback state of the devices, only routines and announcements appeared to be affected.

Is there any way that this can be caught before it causes a problem, like automatically deleting the file if there is a problem with the login?

1 Like

We actually check on each restart and it should remake the cookie if there’s a problem. However as of right now we don’t have logic if it loses access between restarts. In your specific case, the media player status was still working because the updates are based on a persistent connection but the routines require a new connection.

Thanks for the follow-up… I updated HA to latest version, rebooted and still didnt work, then it somehow started working again the next day! Not sure why.

I wanted to test this out but it seems the github link is down?

The link in the OP is dated, go here: https://github.com/keatontaylor/alexa_media_player/

2 Likes

is there a quick way to announce to all echos? instead of listing each one in a json list. i don’t see anything about it in the docs.

Yes but you need some groups.

What is the correct way to add this to HA? I see there is different solutions.

This is a snippet from my configuration.yaml

group:
  house_talk:
    name: house_talk
    view: no
    entities:
      - media_player.kitchen_echo
      - media_player.livingroom_echo_dot
      - media_player.bedroom_echo_dot
      - media_player.bathroom_echo_dot
      - media_player.guestroom_echo_dot
      - media_player.richard_s_tablet
      - media_player.sandy_s_tablet

Install instructions.

1.3.0 is out.

This version support Guard Mode settings along with various bug fixes. We finally removed the media_player.alexa_tts service. Use the notify component instead.

We’ve swapped to supporting HACS since custom_updater is deprecated. This release should work for custom_updater, but I didn’t test it nor do I intend to fix any issues on it.

For those on hassio, you may have to restart 2-3 times before HA will load the dependencies. It doesn’t look like something we can control.

Features:

  • Add Alexa Guard mode support as an alarm_control_panel. Use ARM_AWAY to enable. (resolves #186)
  • Add HACS support. We will deprecate custom_updater shortly; please migrate. Thanks @xatr0z(resolves #201)

Fixes:

  • Remove async references (resolves #171)
  • Fix bug where announce did not work for multiple accounts (resolves #210)
  • Add further existing entity checks (resolves #180)
  • Add additional websocket reconnect logic (resolves #181)

Full changelog.

As always, please use the the Wiki and FAQ if you need instructions or have questions. Also, please help in documenting features in the wiki since this thread is basically unsearchable now. We also use GitHub for bug reports/feature requests .

1 Like

Currently this is only available in the US right?

Yes, but it should only create the alarm_control_panel if it discovers the Alexa guard entity in your devices. Of course, I don’t have a non-US account so it’s possible Amazon has enabled the entity in the device list so we may try to load it even if it’s not functional.

Alarm panel is working perfectly… Good man

Just updated to v1.3.0, no issues so far, thanks for the continued work on this component. :slight_smile:

Updated to v1.3.0. Good

You can add it here https://github.com/home-assistant/custom-components-wheels that way the wheels for the dependencies are pre buildt :slight_smile:

I’ve switched to the newest release using HACS and adding the repo manually in settings.

Everything seems to be working as far as the media players getting recognized (i’m not at home to test that they actually say anything, tho) but I’m getting the following error in the log:

2019-06-23 09:59:32 ERROR (MainThread) [homeassistant.components.alarm_control_panel] Error while setting up platform alexa_media
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/alexa_media/alarm_control_panel.py", line 34, in setup_platform
    hass)  \
  File "/config/custom_components/alexa_media/alarm_control_panel.py", line 73, in __init__
    ['LambdaBridge_AAA/OnGuardSmartHomeBridgeService']
KeyError: 'LambdaBridge_AAA/OnGuardSmartHomeBridgeService'

I’ve restarted three times waiting 5 to 10 minutes between restarts and the error keeps returning.

I’m running non-hassio HA in Docker.

1 Like