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.pyor HA startup): 4.12.7 - alexapy (version from
pip show alexapyor 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)
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:
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
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:
It’s a login error within alexapy. Try deleting your
/config/.storage/alexa_media.<config_entry_identifier>.picklefile and restart HA,…This is not working here. Please reopen
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
Sorry. I fixed the links in my previous posts
[https://pastebin.com/Dn0eEwDt](**_url_**)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
Of all the links you have posted, none of them are valid… Hyperlinks lead to “url”.
and
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 ?
Me too
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
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
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
Did you enable debug logging as described here? Looking at the code, there should be more logs to look at.
I found and deleted the file. I restarted HassOS. Now notifications via alexa media player seem to work
It’s not in
/config/custom_components/alexa_media, it’s in/config/.storage/