alexa_media_player: Notify (TTS) not working: `Login error detected; not contacting API`

IMPORTANT: Please search the issues, including closed issues, and the FAQ before opening a new issue. The template is mandatory; failure to use it will result in issue closure.

Describe the bug

all amazon devices are available but notify doesn’t work

updated to 2024.8.0 and Alexa Media Player 4.12.7

Expected behavior

notify (TTS) to alexa devices is not working with errors:

  • Error doing job: Task exception was never retrieved (None)
  • Login error detected; not contacting API

Screenshots

System details

  • Home-assistant (version): 2024.08
  • alexa_media (version from const.py or HA startup): 4.12.7
  • alexapy (version from pip show alexapy or HA startup):
  • Amazon 2FA is enabled (y/n). : n (but 2SV is enabled)

Logs

Registratore: homeassistant
Fonte: /usr/src/homeassistant/homeassistant/runner.py:148
Prima occorrenza: 19:47:52 (10 occorrenze)
Ultima registrazione: 20:52:43

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/alexapy/helpers.py", line 137, in wrapper
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 960, in send_announcement
    await self.send_sequence(
  File "/usr/local/lib/python3.12/site-packages/alexapy/helpers.py", line 137, in wrapper
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 512, in send_sequence
    await self.run_behavior(node_data, queue_delay=queue_delay)
  File "/usr/local/lib/python3.12/site-packages/alexapy/helpers.py", line 137, in wrapper
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 434, in run_behavior
    await self._post_request("/api/behaviors/preview", data=data)
  File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 226, in _post_request
    return await self._request("post", uri, data, query)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/backoff/_async.py", line 151, in retry
    ret = await target(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 199, in _request
    raise AlexapyLoginError("Login error detected; not contacting API")
alexapy.errors.AlexapyLoginError: Login error detected; not contacting API

Additional context

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 6
  • Comments: 54 (2 by maintainers)

Most upvoted comments

Did you enable debug logging as described here? Looking at the code, there should be more logs to look at.

I’ve enabled debug logging. In the meantime I saw that another user opened an issue similar to this one and that, as a temporary solution, he created an automation that reloads the AMP integration every 10 minutes. So I tried to reload AMP to see if the notifications would work again. Indeed, if AMP is reloaded it works again. This is the log immediately after reloading AMP:

Registratore: homeassistant.config_entries
Fonte: config_entries.py:819
Prima occorrenza: 10:07:04 (1 occorrenze)
Ultima registrazione: 10:07:04

Error unloading entry luca.**************@icloud.com - amazon.it for notify
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 819, in async_unload
    result = await component.async_unload_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/notify/__init__.py", line 135, in async_unload_entry
    return await component.async_unload_entry(entry)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 202, in async_unload_entry
    raise ValueError("Config entry was never loaded!")
ValueError: Config entry was never loaded!

I can confirm I was getting the same error since upgrading to HA 2024.08, and Alexa 4.12.5 - Have just installed 4.12.7 and all is working again at this time

I use HassOS. I don’t see this file in the alexa_media folder

It’s not in /config/custom_components/alexa_media, it’s in /config/.storage/

I found and deleted the file. I restarted HassOS. Now notifications via alexa media player seem to work

Unfortunately after a short time the problem returned. The notifications through alexa media player no longer work. Deleting that file did not solve the problem.

Here is the log:

Registratore: homeassistant
Fonte: /usr/src/homeassistant/homeassistant/runner.py:148
Prima occorrenza: 23:00:04 (2 occorrenze)
Ultima registrazione: 23:10:59

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/alexapy/helpers.py", line 137, in wrapper
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 960, in send_announcement
    await self.send_sequence(
  File "/usr/local/lib/python3.12/site-packages/alexapy/helpers.py", line 137, in wrapper
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 512, in send_sequence
    await self.run_behavior(node_data, queue_delay=queue_delay)
  File "/usr/local/lib/python3.12/site-packages/alexapy/helpers.py", line 137, in wrapper
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 434, in run_behavior
    await self._post_request("/api/behaviors/preview", data=data)
  File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 226, in _post_request
    return await self._request("post", uri, data, query)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/backoff/_async.py", line 151, in retry
    ret = await target(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 199, in _request
    raise AlexapyLoginError("Login error detected; not contacting API")
alexapy.errors.AlexapyLoginError: Login error detected; not contacting API

alexapy.errors.AlexapyLoginError: Login error detected; not contacting API

It’s a login error within alexapy. Try deleting your /config/.storage/alexa_media.<config_entry_identifier>.pickle file and restart HA,…

This is not working here. Please reopen

Enable newly added entities

I tried disabling ‘Enable newly added entities’, leaving “Enable polling for updates” enabled instead.

After a few hours, AMP notifications stopped working and now the integration asks for authentication again.

I specify that yesterday I also followed the procedure indicated in another issue (removing AMP, deleting the .pickle file, restarting, reactivating AMP).

This is the log if I try to launch a notification

('Login error detected; not contacting API',) 2024-08-17 18:02:30.996 WARNING (MainThread) [alexapy.helpers] alexaapi.send_sequence((<alexapy.alexaapi.AlexaAPI object at 0x7f5d8efdd0>, 'AlexaAnnouncement'), {'customer_id': 'A1************6L', 'expireAfter': 'PT5S', 'content': [{'locale': 'it-it', 'display': {'title': '', 'body': ''}, 'speak': {'type': 'text', 'value': 'Questo annuncio è soltanto un test'}}], 'target': {'customerId': 'A**********A6L', 'devices': [{'deviceSerialNumber': '8****************************b68', 'deviceTypeId': 'A3NPD82ABCPIDP'}]}, 'skillId': 'amzn1.ask.1p.routines.messaging', 'queue_delay': 1.5}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Login error detected; not contacting API',) 2024-08-17 18:02:30.997 WARNING (MainThread) [alexapy.helpers] alexaapi.send_announcement((<alexapy.alexaapi.AlexaAPI object at 0x7f5d8efdd0>, 'Questo annuncio è soltanto un test'), {'customer_id': 'A1************6L', 'targets': ['85e16bfd04964b03b1d18e225cb0db68'], 'title': 'Home Assistant', 'method': 'speak', 'queue_delay': 1.5}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Login error detected; not contacting API',)

I propose to reopen this issue because the problem is not solved and I think that the same should be done for other recent issues, similar to this one, perhaps by reuniting them.

If I’m not wrong, there is one on ‘voice notifications’ and another that concerns a new authentication problem, all opened, like this one, immediately after the release of Home Assistant 2024.08.

Following the discussion in other recent issues, I disabled the two options that concern “adding new entities” and “polling for updates”. I did a couple of tests through the ‘actions’ of ‘developer tools’. The notifications seem to work but the automation that restarts AMP every 10 minutes is still enabled

AMP notify test OK after disabling polling

This a detailed log some hours after … https://pastebin.com/Dn0eEwDt

Of all the links you have posted, none of them are valid… Hyperlinks lead to “url”.

[https://pastebin.com/Dn0eEwDt](**_url_**)

Sorry. I fixed the links in my previous posts

This a detailed log some hours after … https://pastebin.com/Dn0eEwDt

Of all the links you have posted, none of them are valid… Hyperlinks lead to “url”.

[https://pastebin.com/Dn0eEwDt](**_url_**)

This a detailed log some hours after …

https://pastebin.com/Dn0eEwDt

The URL needs to be inside the ( ) The [ ] is for the clickable text that will be displayed.

[This is the text and the link is https://pastebin.com/Dn0eEwDt](https://pastebin.com/Dn0eEwDt)

This is the text and the link is https://pastebin.com/Dn0eEwDt

This a detailed log some hours after …

https://pastebin.com/Dn0eEwDt

Of all the links you have posted, none of them are valid… Hyperlinks lead to “url”.

https://pastebin.com/EgP3T76p

2024-08-09 18:00:02.084 DEBUG (MainThread) [alexapy.alexalogin] GET: 
https://alexa.amazon.com/api/bootstrap returned 401:Unauthorized with response 

and

2024-08-09 18:00:03.087 DEBUG (MainThread) [alexapy.alexahttp2] HTTP2 Connection Closed.
2024-08-09 18:00:03.089 DEBUG (MainThread) [custom_components.alexa_media] l**************o@i********m: Close requested; will not reconnect http2

are the most interesting to me.

Try the following: For the first one, delete/remove alexa media player from the UI->Settings->Devices&Services, then go into /config/.storage/ (.storage is a hidden folder) and delete the pickle file with your e-mail in it. Then re-add the integration via UI and reconfigure it. Post new logs if issue persists.

As for the second line, I have no idea how HTTP2 is receiving a close request. Tried to backtrack all calls but I think I’m getting lost. Not sure if this log is a problem either way, just something that I haven’t seen yet. Know anything @danielbrunt57 ?

Same issue with HA updated to 2024.8.0 and Alexa Media Player 4.12.7. As a temporary solution, I’ve created an automation that reloads the AMP integration every 10 minutes

as a temporary solution I also created an automation that recharges AMP every 10 minutes

Me too

Same issue with HA updated to 2024.8.0 and Alexa Media Player 4.12.7. As a temporary solution, I’ve created an automation that reloads the AMP integration every 10 minutes

as a temporary solution I also created an automation that recharges AMP every 10 minutes

I can confirm Alexa media Player integraton must be restart for return to working the voice notification

Did you enable debug logging as described here? Looking at the code, there should be more logs to look at.

I’ve enabled debug logging. In the meantime I saw that another user opened an issue similar to this one and that, as a temporary solution, he created an automation that reloads the AMP integration every 10 minutes. So I tried to reload AMP to see if the notifications would work again. Indeed, if AMP is reloaded it works again. This is the log immediately after reloading AMP:

Registratore: homeassistant.config_entries
Fonte: config_entries.py:819
Prima occorrenza: 10:07:04 (1 occorrenze)
Ultima registrazione: 10:07:04

Error unloading entry luca.**************@icloud.com - amazon.it for notify
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 819, in async_unload
    result = await component.async_unload_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/notify/__init__.py", line 135, in async_unload_entry
    return await component.async_unload_entry(entry)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 202, in async_unload_entry
    raise ValueError("Config entry was never loaded!")
ValueError: Config entry was never loaded!

Same issue with HA updated to 2024.8.0 and Alexa Media Player 4.12.7. As a temporary solution, I’ve created an automation that reloads the AMP integration every 10 minutes

I use HassOS. I don’t see this file in the alexa_media folder

It’s not in /config/custom_components/alexa_media, it’s in /config/.storage/

I found and deleted the file. I restarted HassOS. Now notifications via alexa media player seem to work

Unfortunately after a short time the problem returned. The notifications through alexa media player no longer work. Deleting that file did not solve the problem. Here is the log:

Registratore: homeassistant
Fonte: /usr/src/homeassistant/homeassistant/runner.py:148
Prima occorrenza: 23:00:04 (2 occorrenze)
Ultima registrazione: 23:10:59

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/alexapy/helpers.py", line 137, in wrapper
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 960, in send_announcement
    await self.send_sequence(
  File "/usr/local/lib/python3.12/site-packages/alexapy/helpers.py", line 137, in wrapper
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 512, in send_sequence
    await self.run_behavior(node_data, queue_delay=queue_delay)
  File "/usr/local/lib/python3.12/site-packages/alexapy/helpers.py", line 137, in wrapper
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 434, in run_behavior
    await self._post_request("/api/behaviors/preview", data=data)
  File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 226, in _post_request
    return await self._request("post", uri, data, query)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/backoff/_async.py", line 151, in retry
    ret = await target(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 199, in _request
    raise AlexapyLoginError("Login error detected; not contacting API")
alexapy.errors.AlexapyLoginError: Login error detected; not contacting API

Did you enable debug logging as described here? Looking at the code, there should be more logs to look at.

Thank you for this hint. Now my Alexa devices are in do-not-disturb-mode and my family is sleeping. Tomorrow morning I’ll give it a try and then I’ll post here the results

I use HassOS. I don’t see this file in the alexa_media folder

It’s not in /config/custom_components/alexa_media, it’s in /config/.storage/

I found and deleted the file. I restarted HassOS. Now notifications via alexa media player seem to work

Unfortunately after a short time the problem returned. The notifications through alexa media player no longer work. Deleting that file did not solve the problem.

Here is the log:

Registratore: homeassistant
Fonte: /usr/src/homeassistant/homeassistant/runner.py:148
Prima occorrenza: 23:00:04 (2 occorrenze)
Ultima registrazione: 23:10:59

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/alexapy/helpers.py", line 137, in wrapper
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 960, in send_announcement
    await self.send_sequence(
  File "/usr/local/lib/python3.12/site-packages/alexapy/helpers.py", line 137, in wrapper
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 512, in send_sequence
    await self.run_behavior(node_data, queue_delay=queue_delay)
  File "/usr/local/lib/python3.12/site-packages/alexapy/helpers.py", line 137, in wrapper
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 434, in run_behavior
    await self._post_request("/api/behaviors/preview", data=data)
  File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 226, in _post_request
    return await self._request("post", uri, data, query)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/backoff/_async.py", line 151, in retry
    ret = await target(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 199, in _request
    raise AlexapyLoginError("Login error detected; not contacting API")
alexapy.errors.AlexapyLoginError: Login error detected; not contacting API

Did you enable debug logging as described here? Looking at the code, there should be more logs to look at.

I use HassOS. I don’t see this file in the alexa_media folder

It’s not in /config/custom_components/alexa_media, it’s in /config/.storage/

I found and deleted the file. I restarted HassOS. Now notifications via alexa media player seem to work

I use HassOS. I don’t see this file in the alexa_media folder

It’s not in /config/custom_components/alexa_media, it’s in /config/.storage/