alexa_media_player: Integration stop working after some time: `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
WHen i use media_player alexa wont work, the integration must be reloaded for retunr to working
To Reproduce
- Run an action for alexa media player (tts)
- Alexa wont talk
Expected behavior
Screenshots
System details
- Home-assistant (version): 2024.8.0
- alexa_media (version from
const.pyor HA startup):4.12.7 - alexapy (version from
pip show alexapyor HA startup):4.12.7 - Amazon 2FA is enabled (y/n). <!—We will not debug login issues if unanswered—>:
Logs
Logs
2024-08-09 15:18:43.563 ERROR (MainThread) [homeassistant] 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 2024-08-09 15:18:55.761 ERROR (MainThread) [homeassistant] 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 2024-08-09 15:18:59.798 ERROR (MainThread) Additional context
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 51 (4 by maintainers)
I had the same problem and I’m following the thread waiting for a solution. But I’ve found that if I set AMP > three dots > system options > enable new entity additions and enable polling for updates to off, the integration doesn’t stop working. It’s been running for 4 hours now. I hope it can be useful.
It’s simple:
I THINK you could have some trouble if an automation that uses Alexa and the automation that reload the integration AMP running at the same time
@deosrc
Thank you for your carefully detailed response and willingness to try and figure this all out.
@danielbrunt57
From the logs it looks like the issue re-adding the integration is separate and I’ve opened #2469. I managed to find a workaround to that (included in the issue) and now it is behaving as in #2453. I’ll move any discussion there.
@danielbrunt57
Agreed. I was deliberate in my wording in saying “I believe”, and it seems that I was incorrect on some points. Some stored data, such browsing history, are still present in private mode. It is just that the browsing in private mode is not added to it.
Cookies and local storage are not present though as using a private window requires me to login to HA again and my user preferences such as theme are not retained. It is not clear if cache is re-used or not.
There is nothing on the Firefox private tab page or the page linked above to suggest cookies are handled differently in private mode compared with standard, but there is an incognito specific setting for 3rd party cookies in chrome so it’s possible. This also reminded me of the changes to how cookies are handled in firefox, and also the firefox enhanced tracking protection setting. I don’t know if any of this might impact any of the AMP cookies.
I didn’t say I wasn’t willing. I would just prefer not to clear all of my HA user preferences if it is not necessary and thought private mode might be enough. I had forgotten that I had another browser installed that I could also use, or could use the profiles feature.
I have tested again using a chrome normal window instead of Firefox private window. I don’t believe I have ever used this browser, but cleared all browsing data for all sites to be sure (cookies, cache, etc.). The 3rd party cookies setting was set to “Block in incognito mode”, so that shouldn’t affect this test using a normal window. I received the same “login failed” result.
I can continue testing with other browser scenarios, but it feels like it would be better to try get more information out of HA/AMP instead.
I’m hesitant to open another “Authentication issue with HA 2024.8.0” thread at the moment when there are already a number of similar issues open, but will do so if you think it best. It seems too much coincidence for another authentication issue in 2024.8.*.
As mentioned, the auth issue I am having started out the same as #2453. The integration would prompt in HA that it needed to be reconfigured. Clicking reconfigure took me to the AMP Amazon login page where I logged in successfully and the page closed, but the reconfigure prompt persisted. IIRC, it would disappear for less than a second before appearing again.
The “login failed” prompt I have not seen mentioned elsewhere, but is only appearing after I removed and re-added the integration in a hopeful attempt that clearing any data would fix the issue. It also seems odd that I am not getting any error logs at all.
As mentioned above, I’m going to try get more information out of the logging in HA.
No without polling communication with Alexa is one-way. I realized that the problem is not solved, but if you only use notifications via Alexa it’s better than nothing…
Yo soy Amazon.es y también tengo ese problema. Las automatizaciones funcionan perfectamente, pero no anuncia nada Alexa. Probe en desinstalar Alexa media, reiniciar, elimiar el archivo del config y nada de nada. De momento la única solución temporal, reiniciar Alexa cada 10 minutos.
I’m in Europe (amazon.de) and don’t have these issues.
This should should be v1.28.2
Your logs do not include the issue, the errors are just a result of it. You should reboot, activate the debuglogs, reload the integration, wait until it fails, then save the logs.
Yes nothing changed