-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alexa Media Reauthentication Required - continuously appear: Login error detected; not contacting API
#2453
Comments
+1 |
4 similar comments
+1 |
+1 |
+1 |
+1 |
+1 |
Hi, The problem is not only the reauthentication, my speakers are not shown at all even after it authenticates, like in my printscreen |
|
|
Still the same for me, same error |
Does everything work for you? It no longer asks to authenticate every half hour and notifications always work? Thank you very much. |
This is still happening for me at HA version 2024.8.1 |
I am also facing this at HA version 2024.8.1 |
Same situation … stress! |
Same here after 2024.8.1 update. |
Same here after 2024.8.1 update. Continually asking to authenticate and failing to login. |
Home-assistant (version): 2024.8.0 After reconfiguring the integration as commented above, restarting the computer (no home assistant), Alexa plays the HA messages in automations for a bunch of minutes, after that, no speaking again. Then if I reload the AMP integration, works again for a while, and fails after a while until reload the integration and so on. |
Not working in my case |
The same here 😭 |
Same issue here. Logs: alexaapi.send_sequence((<alexapy.alexaapi.AlexaAPI object at 0x7f14adfe8410>, 'Alexa.Speak'), {'customer_id': 'A369Q6OMY8A2EE', 'textToSpeak': "Home Assistant reports all doors are closed", 'target': {'customerId': 'A2EE', 'devices': [{'deviceSerialNumber': 'G19C', 'deviceTypeId': 'A7WXQPH584YP'}]}, 'skillId': 'amzn1.ask.1p.saysomething', 'queue_delay': 1.5}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: ('Unauthorized',) |
Same problem here with amazon.it domain. |
Ciao. What is the HA service that reload an integration? |
Same here, amazon.de |
I'll give you my automation, just using 1 of the speakers is enough, reload the entire integration `alias: Recarga Alexa hasta que se arregle
|
Service... I meant action 😎😎😎 |
Also suffering this, example:
Simply pressing "Reload" on the integration fixes it temporarily (2FA enabled). |
Same issue on both core versions 2024.8.0 and 2024.8.1 with 4.12.7 Alexa media player. |
With polling disable it keep working for me and for my friends! :-) my suggestion is to disable it! |
I was lucky enough to be able to use it almost always, with a short break in August; I was forced to use HA in July to avoid unwanted blocks. then from September onwards I did all the HA and AMP updates without problems even with the echo dot temperature sensor. |
You are right…but… why is it a real shame? I think it is not helpful to have this reaction and use these words. |
I honestly don't understand your comment and your reaction; |
It's the word "shame" that didn't seem appropriate to me, but if I misunderstood I apologize! many times I see sterile complaints about things that are the fruit of the community's work and passion. |
have you programmed an automation to reload the integration every x minutes/hours? |
No, I don’t. In my personal case polling it’s not very relevant, so I give up that feature. |
I tried almost evrything but with no success. This is teh log i get it 2024-10-12 19:36:17.849 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to load_verify_locations with args (<ssl.SSLContext object at 0x7fa965091050>, '/usr/local/lib/python3.12/site-packages/certifi/cacert.pem', None, None) inside the event loop by custom integration 'alexa_media' at custom_components/alexa_media/config_flow.py, line 280: self.login = AlexaLogin( (offender: /usr/local/lib/python3.12/ssl.py, line 708: context.load_verify_locations(cafile, capath, cadata)), please create a bug report at https://github.com/alandtse/alexa_media_player/issues 2024-10-12 19:36:28.005 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to load_verify_locations with args (<ssl.SSLContext object at 0x7fa9600edad0>,) inside the event loop by custom integration 'alexa_media' at custom_components/alexa_media/config_flow.py, line 374: self.proxy = AlexaProxy( (offender: /usr/local/lib/python3.12/site-packages/httpx/_config.py, line 149: context.load_verify_locations(cafile=cafile)), please create a bug report at https://github.com/alandtse/alexa_media_player/issues 2024-10-12 19:42:49.732 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open with args (PosixPath('/config/.storage/alexa_media.mail.account@hotmail.com.pickle'),) inside the event loop by custom integration 'alexa_media' at custom_components/alexa_media/config_flow.py, line 420: if await self.login.test_loggedin(): (offender: /usr/local/lib/python3.12/site-packages/aiohttp/cookiejar.py, line 121: with file_path.open(mode="wb") as f:), please create a bug report at https://github.com/alandtse/alexa_media_player/issues 2024-10-12 19:42:49.825 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open with args (PosixPath('/config/.storage/alexa_media.mail.account@hotmail.com.pickle'),) inside the event loop by custom integration 'alexa_media' at custom_components/alexa_media/init.py, line 361: await login.login(cookies=await login.load_cookie()) (offender: /usr/local/lib/python3.12/site-packages/aiohttp/cookiejar.py, line 126: with file_path.open(mode="rb") as f:), please create a bug report at https://github.com/alandtse/alexa_media_player/issues 2024-10-12 19:42:57.462 WARNING (MainThread) [alexapy.helpers] alexaapi.get_customer_history_records((<alexapy.alexalogin.AlexaLogin object at 0x7fa94f8376e0>,), {'max_record_size': 10}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments: |
+1 same here UPDATE: after deleting pickle, and devices suppressing OTP, it works. |
I have deleted pickle, no device suppreing OTP and still get the error Logger: homeassistant Error doing job: Task exception was never retrieved (None) |
For several weeks the integration has not worked for me due to the issue #2515 Now after updating to v4.13.5 I am not getting the issue described in #2515, but still the integration fails, even after reconfiguring it, which seems to match the current issue. When I try to do something with the integration, log shows 2 warning and an error:
|
the exception is originating from here https://gitlab.com/keatontaylor/alexapy/-/blob/dev/alexapy/alexaapi.py?ref_type=heads#L199 in my case, after setting conditional logging in the 3 only places where the value is being explicitly set to False (so after an unsuccessful login), it was after one call ended in 401: when in this state all subsequent calls will fail, it looks like it never reattempts automatically to login, which is the only way to end in the flow where that flag gets assigned True again (if everything goes well): now...just for curiosity I retried from my HA test instance to reissue a call that should fail because supposedly not loggedin, and while in breakpoint I overrode the value of login_successful to True just to see what happens if the request does not get killed there and...guess what? Still not sure how to move from here, but IMHO killing the request because of that check done only once for all next calls does not seems correct, this one is however apparently internally called here only at initial phase so when integration is loaded into HA and not with further calls, I think we could try replacing the static value check with the dynamic one like in one disadvantage I see is that running that fn for every single request is going to be way more expensive than quickly checking a stored boolean value, still the improvement in reliability would be there...or at least it could be limited to only when the value happens to be found False |
@srescio I think alexapy MR !392 might be relevant here. Could you give it a test run &/or reply with your evaluation of its effect/benefit? |
As for you suggestion "try replacing the static value check with the dynamic one like in alexahttp2", I'm not sure how you would do that. Does this look like what you're proposing?
Revised:
|
yes thats what I though, though after checking better also the custom component code it would not be enough as there are several places where that flag is checked for the same purpose...so for a solid fix we need to find a way for repopulating it to yesterday I started my instance at 00:15 then did not execute any more commands and let it sit, today I found out that the extension with the api lib did periodically some refreshing calls which all went well till 00:39 where it finally hit a 401 unauthorized when attempting to retrieve data from and that was the last one with a non 0 time execution for "Finished fetching alexa_media" (5.295), all the others happening later at roughly 10min interval (i guess some polling is happening here, hence why the hack of reloading the integration needs to be at 10min or lower) ends in 0 seconds with no other logs, because all request in alexapy are then immediately killed by the
|
after all the above idleness I just did a speak test knowing it would fail and these are the full logs (i've enabled debug logs pretty much everywhere it seemed fit) :
the interesting one is the at this point all necessary bits for making a request are there, only that for some reason alexalogin.finalize_login which would set the another log indicates that its not passing trough the |
given that the next thing being done is to call made this fix branch for alexapy: https://gitlab.com/srescio/alexapy/-/commits/fix-login_successful-not-being-set-true-after-session-refresh check it out, and hope it works 🤞🏻 |
This is just a stab in the dark and I've not tested the code change but what about setting "login_seccessful" here?
The above stab-in-the-dark was devised before your most recent post above... |
kinda, the syntax is a bit off, |
so |
I've not experienced the I've made the two replacements in my
|
nha, saw again this after some idle
I think they're two different issues, the flag should fix a speak attempt after session has expired, but why this call ends in 401 for https://www.amazon.it/alexa-privacy/apd/rvh/customer-history-records` needs to be investigated... |
I see it ending in 429, not 401. Interesting note: Alexa-Remote (Node.JS) was updated some time ago to use
|
It's also using a somewhat different header for the client connection that I've retrofitted into alexapy with no ill effects..
|
Hurrah !!! |
@spaggio80 |
Settings > Devices & Services > Alexa Media Player > 3 Dots > System Options |
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
Looks like in Homeassistant OS X64, 2024.8.0 integration Alexa Media Player in continuously asking for authentification or reauthentification.
integration version 4.12.7, amazon.com domain, 2FA enabled.
Even just after authentification no dot speaker is shown.
To Reproduce
Reauthenticate xxxxxxxx@hotmail.com on the Integrations page. Relogin required after 0:00:01.582947 and 2 api calls.
Expected behavior
to stop asking for authentification and my dot speakers to appear in HAOS
Screenshots
attached
System details
Core
2024.8.0
Supervisor
2024.08.0
Operating System
12.4
Frontend
20240806.1
alexa_media (version from const.py or HA startup): Which ever is the latest updated new version (08/08/24)
alexapy (version from pip show alexapy or HA startup): Same as above
Amazon [2FA is enabled] - Yes
. <!---We will not debug login issues if unanswered--->:
Logs
Please provide logs.
('Login error detected; not contacting API',)
2024-08-10 15:53:41.987 WARNING (MainThread) [alexapy.helpers] alexaapi.get_bluetooth((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.009 WARNING (MainThread) [alexapy.helpers] alexaapi.get_guard_details((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.009 WARNING (MainThread) [alexapy.helpers] alexaapi.get_network_details((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.022 WARNING (MainThread) [alexapy.helpers] alexaapi.get_authentication((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.030 WARNING (MainThread) [alexapy.helpers] alexaapi.get_authentication((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.046 WARNING (MainThread) [alexapy.helpers] alexaapi.get_dnd_state((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.054 WARNING (MainThread) [alexapy.helpers] alexaapi.get_bluetooth((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.095 WARNING (MainThread) [alexapy.helpers] alexaapi.get_devices((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.226 WARNING (MainThread) [alexapy.helpers] alexaapi.get_dnd_state((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.250 WARNING (MainThread) [alexapy.helpers] alexaapi.get_authentication((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.279 WARNING (MainThread) [alexapy.helpers] alexaapi.get_device_preferences((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.298 WARNING (MainThread) [alexapy.helpers] alexaapi.get_devices((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.313 WARNING (MainThread) [alexapy.helpers] alexaapi.get_device_preferences((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
2024-08-10 15:53:42.356 WARNING (MainThread) [alexapy.helpers] alexaapi.get_device_preferences((<alexapy.alexalogin.AlexaLogin object at 0x7f4392050470>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
('Login error detected; not contacting API',)
Additional context
The text was updated successfully, but these errors were encountered: