Echo Devices (Alexa) as Media Player - Testers Needed

Same issue and same versions of HA and AMP like Sunny.

Moreover (or related), when I click ‘confirm’ in the Alexa Media Player persistent notification:

‘Failed call to service configurator/configure . get’

System Log:

19-09-02 09:11:19 ERROR (MainThread) [hassio.api.proxy] Client error on WebSocket API Cannot connect to host 172.30.32.1:8123 ssl:False [Connection refused].

Log:

get
11:20 custom_components/alexa_media/__init__.py (ERROR) - message first occured at 11:17 and shows up 2 times

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 130, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1235, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1260, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/components/configurator/__init__.py", line 235, in async_handle_service_call
    await self.hass.async_add_job(callback, call.data.get(ATTR_FIELDS, {}))
  File "/config/custom_components/alexa_media/__init__.py", line 153, in configuration_callback
    login, callback_data)
  File "/config/custom_components/alexa_media/__init__.py", line 143, in setup_platform_callback
    await login.login(data=callback_data)
  File "/usr/local/lib/python3.7/site-packages/alexapy/alexalogin.py", line 306, in login
    headers=self._headers)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 466, in _request
    ssl=ssl, proxy_headers=proxy_headers, traces=traces)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 286, in __init__
    self.update_host(url)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 340, in update_host
    raise InvalidURL(url)
aiohttp.client_exceptions.InvalidURL: get

Thank you
SoL

Does anyone here have this working with the Sonos One speakers? I had this working perfectly a couple months ago and now I can no longer announce through the Sonos. All my Amazon devices work fine and I can TTS over the Sonos just fine too. I’m guessing a Sonos software update caused the break. I might try changing the voice assistant to Google on the Sonos to see if that works. Currently on the 0.98.1 of HA and v2.0.1 of the Alexa Media Player.

Same issue here! anyone found how to solve it? thank you

Same issue here, as of 0.98.1 (and .2, I upgraded to try to resolve it):

  • all of my Alexa devices went offline
  • I have a persistent notification to re-authenticate (which doesn’t work)
  • I have the following error in HA:
2019-09-02 12:34:50 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):                                              
  File "/usr/src/homeassistant/homeassistant/components/alexa/state_report.py", line 45, in async_entity_state_listener
    hass, smart_home_config, alexa_changed_entity                               
  File "/usr/src/homeassistant/homeassistant/components/alexa/state_report.py", line 103, in async_send_changereport_me
    response_json = json.loads(response_text)                                   
  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)         

Same here, same versions.

Same here, but isn’t this related to the HA Alexa component and not the Alexa Media custom component ?

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/alexa/state_report.py", line 45, in async_entity_state_listener
    hass, smart_home_config, alexa_changed_entity
  File "/usr/src/homeassistant/homeassistant/components/alexa/state_report.py", line 103, in async_send_changereport_message
    response_json = json.loads(response_text)
  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)

No idea; decided to just do a library fix since that’s what HA does internally.

Thanks; fix is staged.

As pointed out by @Holdestmade this is an Alexa bug not alexa_media_player.

Will probably need debug logs to figure out what this is. Could be related to another bug. Have a fix planned for tonight hopefully as soon as Amazon stops throttling me.

This happened suddenly and it looks like something changed on the Amazon or Sonos side. Haven’t been focusing on it due to other issues above. TTS is the workaround for now. Had reports that it stopped working after 1.4 so looking for someone using an older HA to test 1.3.1 and get me logs.

1 Like

You are correct, this is the HA Alexa component, but it must be in use by alexa_media (custom component loaded via HACS) or the Hassio Cloud (Nabu Casa). I don’t have any other Alexa components loaded.

I’ve disabled Hassio Cloud just to see if that clears the errors.

I can confirm that making THESE changes to the notify.py file, and deleting the pickle file, fixes the issue after a reboot.

FWIW, disabling Hassio Cloud integration (cloud:) stops the errors, even with alexa_media still enabled and configured (it’s not working though).

Is it possbile to make the alexa_media_player use the Synology Audio Station with Home Assistant. It were brilliant. thx

Ok, so do we (users) need to do something manually or will it fix itself with the next update(s)?

@h4nc if you edit the notify.py file, with the linked changes, and delete the alexa pickle, it fixes the issue. No need to wait for an update to roll out.

1 Like

2.1.0 is out.

Should have squashed all login bugs. :sweat_smile: If I missed one, please use 1.4.1 to login. Also addressed some minor bugs related to bluetooth. New feature bump is the ability to exclude switches/alarm_control_panels, etc. Use the exclude_devices options described in the link below.

For those of you using include please note all your switches/Alexa Guard devices will not appear until you include them.

Include only loads devices that have been listed. If you didn’t include the Alexa guard or the switches, then you will not see them. If you want to figure out the names, then let the component run once without any include_devices settings and save the names. Alexa Guard is admittedly difficult since it includes part of it’s serial number at the end. The other switches should follow a standard naming convention, e.g. “Echo Bedroom do not disturb switch”, “Echo Bedroom repeat switch”, “Echo Bedroom shuffle switch”.

FYI, found one bug where you’ll see a warning on startup from your recorder. Decided the login issues where more important to resolve but let me know if the bug impacts you more than the warning.

For those on hassio, you may have to restart 2-3 times before HA will load the dependencies.
Please note, we’ve swapped repositories to custom-components. If you haven’t done so, please reinstall from HACS so it tracks from the new repo.

Feature

  • allow exclusions for alarm_control_panel and switches (169545f) - Use the full friendly name (e.g., “Master Bedroom repeat switch”)

Fix

  • update to alexapy 1.0.2 (3e50526) (fixes #307, fixes #310?, fixes #323)
  • change platform loading to be account specific (bcc0de7) (fixes #260?)
  • add key check for targets (fac356d) (fixes #328)
  • provide updated message for use of HA tts UI (46b9d88)
  • bug where bluetooth state not properly updated (c5da965) (fixes #316)
  • add await for set_bluetooth (e622497)(fixes #316)

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 .

2 Likes

Hi alandtse,
thank you again for your job and patience.
I’m replying here because different errors came up after 2.1.0 update, let me show you some screenshots and reports.

After clicking ‘configure’ on the alexa persistent notification, it correctly asks me the double authentication code but after ‘confirm’ this is what I get:

‘Failed call to service configurator/configure . ’

which is a bit different from the previous error in 2.0.1 version [ ‘Failed call to service configurator/configure . get’ ].

Logs:

  1. custom_components/alexa_media/init.py (ERROR):
    Login successful, but AlexaLogin session is missing required token: 'csrf' please try to relogin but if this persists this is unrecoverable, please report.

  2. core.py (ERROR):
    Error doing job: Unclosed client session.

  3. core.py (ERROR):
    Error doing job: Unclosed connector

  4. custom_components/alexa_media/init.py (ERROR):

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 130, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1235, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1260, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/components/configurator/__init__.py", line 235, in async_handle_service_call
    await self.hass.async_add_job(callback, call.data.get(ATTR_FIELDS, {}))
  File "/config/custom_components/alexa_media/__init__.py", line 166, in configuration_callback
    login, callback_data)
  File "/config/custom_components/alexa_media/__init__.py", line 156, in setup_platform_callback
    await login.login(data=callback_data)
  File "/usr/local/lib/python3.7/site-packages/alexapy/alexalogin.py", line 344, in login
    site = await self._process_page(await post_resp.text(), site)
  File "/usr/local/lib/python3.7/site-packages/alexapy/alexalogin.py", line 494, in _process_page
    assert self._data is not None
AssertionError

Thank you
SoL

1 Like

I got the same error as SoL in v2.1.0.

Home Assistant frontent reports this after the “Please hit confirm to begin login attempt.” submission :

Failed call to service configurator/configure .

And prints this in the logs:

Login successful, but AlexaLogin session is missing required token: 'csrf' please try to relogin but if this persists this is unrecoverable, please report

as suggested by alandtse I logged in with 1.4.1 and then upgraded to 2.1.0 correctly.

1 Like

I logged in using 1.4.1, but it does not work for me after I update to 2.1.0

FWIW, I upgraded to 2.1.0 this morning, was successfully able to use the configurator and all of my Alexa Media devices were re-found and are working.

If folks are still seeing the

File "/usr/src/homeassistant/homeassistant/components/alexa/state_report.py", line 103, in async_send_changereport_message

errors. These are coming from the Home Assistant Hassio Cloud integration (Nabu Casa). The only way to get rid of them is to disable the integration. Otherwise you get about 1 every 3 seconds.

Thanks @alandtse for all of the hard work and quick response to the errors in 2.0.1.
On that Recorder “warning”, I also noticed the password was being recorded in clear text. Can that be masked? I wasn’t expecting the password to show up in the log.

I don’t know if this is related. I just updated to 98.2 and I can no longer announce to my echo devices. It looks like home assistant can no longer see the entity.

custom_components.alexa_media.notify] Invalid Home Assistant entity in

Any thoughts?

Got it working again. I removed the files out of /custom_components/alexa_media/ replaced them with the master branch. Restarted home assistance, it asked me to authenticate and bam.

Have you reinstalled alexa via Hacs