Closed Kalfany closed 2 weeks ago
Same with 2024.8.3
Same here! 2024.9.1
It looks like your Amazon accounts do not have 2SV enabled using Authenticator App...
It looks like your Amazon accounts do not have 2SV enabled using Authenticator App...
2SV has been active for months, and nothing has changed there 🤷♂️
It looks like your Amazon accounts do not have 2SV enabled using Authenticator App...
Active for months too. It worked till now.
I've no idea why this is in your logs then...
2024-09-09 12:25:10.023 DEBUG (MainThread) [alexapy.alexalogin] Found standard login page
2024-09-09 12:25:10.024 DEBUG (MainThread) [alexapy.alexalogin] Found post url to https://www.amazon.com/ap/register
2024-09-09 12:25:10.024 DEBUG (MainThread) [alexapy.alexalogin] Preparing form submission to https://www.amazon.com/ap/register with input data: {}
My start up log for alexapy:
2024-09-10 00:25:26.191 DEBUG (ImportExecutor_0) [alexapy.alexalogin] sys.version_info: (3, 12)
alexapy Version: 1.29.1
2024-09-10 00:25:36.685 DEBUG (MainThread) [alexapy.alexalogin] Creating TOTP for K************************************************GJQ
2024-09-10 00:25:36.685 DEBUG (MainThread) [alexapy.alexalogin] Generating OTP 315319
2024-09-10 00:25:36.686 DEBUG (MainThread) [alexapy.alexalogin] Login created for d****@****a - amazon.ca
2024-09-10 00:25:36.687 DEBUG (MainThread) [alexapy.alexalogin] Searching for cookies from /config/.storage/alexa_media.daniel@brunt.ca.pickle
2024-09-10 00:25:36.687 DEBUG (MainThread) [alexapy.alexalogin] Trying to load cookie from file /config/.storage/alexa_media.daniel@brunt.ca.pickle
2024-09-10 00:25:36.791 DEBUG (MainThread) [alexapy.alexalogin] Trying to load aiohttpCookieJar to session
2024-09-10 00:25:36.807 DEBUG (MainThread) [alexapy.alexalogin] Loaded 15 cookies
2024-09-10 00:25:36.807 DEBUG (MainThread) [alexapy.alexalogin] Searching for cookies from /config/alexa_media.daniel@brunt.ca.pickle
2024-09-10 00:25:36.807 DEBUG (MainThread) [alexapy.alexalogin] Using cookies to log in
2024-09-10 00:25:36.808 DEBUG (MainThread) [alexapy.alexalogin] Attempting to register with amazon.ca
2024-09-10 00:25:38.045 DEBUG (MainThread) [alexapy.alexalogin] auth response <ClientResponse(https://api.amazon.ca/auth/register) [200 OK]>
2024-09-10 00:25:38.046 DEBUG (MainThread) [alexapy.alexalogin] Successfully registered Daniel's 2nd Alexa Media Player device with Amazon
2024-09-10 00:25:38.046 DEBUG (MainThread) [alexapy.alexalogin] New access token(375) received which expires at 2024-09-10 01:25:38.046495 in 0:59:59.999971
2024-09-10 00:25:38.341 DEBUG (MainThread) [alexapy.alexalogin] capabilities response <ClientResponse(https://api.amazonalexa.com/v1/devices/@self/capabilities) [204 No Content]>
2024-09-10 00:25:38.573 DEBUG (MainThread) [alexapy.alexalogin] updating jar with cookie Set-Cookie: session-id=131-2424994-9272064; Domain=.amazon.ca; expires=5 Sep 2044 07:25:38 GMT; Path=/; Secure
2024-09-10 00:25:38.574 DEBUG (MainThread) [alexapy.alexalogin] updating jar with cookie Set-Cookie: ubid-acbca=131-6169391-4913816; Domain=.amazon.ca; expires=5 Sep 2044 07:25:38 GMT; Path=/; Secure
2024-09-10 00:25:38.574 DEBUG (MainThread) [alexapy.alexalogin] updating jar with cookie Set-Cookie: x-acbca=uiXlA2xR2ocl9DcRygTvw4Akbgo8OEIp; Domain=.amazon.ca; expires=5 Sep 2044 07:25:38 GMT; Path=/; Secure
2024-09-10 00:25:38.574 DEBUG (MainThread) [alexapy.alexalogin] updating jar with cookie Set-Cookie: at-acbca=Atza|IwEBICLIRotOsLyEJgvKW4_ToukX1BBhEQPqJx4FmpTrQTQkK8gSq1mlnxTEMC5XaGWbwKzL9ECkaTq86ZMBmTnxbYiGl1o5gqa9BziLZggEFfPD8Yy-qvM-E62z73w9LRcgi795C0qG3bPkEveYZ3AQN4f2F53PFSoVuqKMosqnyg9xKMw9ySaduwRBcxyfv436aMkw7qdDrIXd4zdtVnUMPc7KiBtEWz2UxAUaG7kd-WAzT8fe-1MOeoc_HFj2NMhG82V72vDEQKEXMaEv6N2qS4cbQG6A9y4K2fvWyK-TYM0-LSK97ufqNZMCLFhA4xM-Ds5oXXfIV3YyCCzxNOO0qqo-PGiGqbjdnYEvZ6-52A6DUAk9cNaBi5Z8rUelHzN_db-V-xWpaGy_opjU8ZfPrGLc; Domain=.amazon.ca; expires=11 Sep 2024 07:25:38 GMT; HttpOnly; Path=/; Secure
2024-09-10 00:25:38.575 DEBUG (MainThread) [alexapy.alexalogin] updating jar with cookie Set-Cookie: sess-at-acbca="jyaFkHQEi/75Nw6UM1ZEIMIs87GsUvVrSp5CP8DFtvI="; Domain=.amazon.ca; expires=11 Sep 2024 07:25:38 GMT; HttpOnly; Path=/; Secure
2024-09-10 00:25:38.575 INFO (MainThread) [alexapy.alexalogin] Exchanged refresh token for 5 .amazon.ca cookies: ['session-id', 'ubid-acbca', 'x-acbca', 'at-acbca', 'sess-at-acbca']
2024-09-10 00:25:38.575 DEBUG (MainThread) [alexapy.alexalogin] CSRF already exists; no need to discover
2024-09-10 00:25:38.576 DEBUG (MainThread) [alexapy.alexalogin] Session cookies for 'https://alexa.amazon.com/api/bootstrap': ['session-id', 'session-id-time', 'lc-main', 'ubid-main', 'session-token', 'x-main', 'at-main', 'sess-at-main', 'csrf']
2024-09-10 00:25:38.882 DEBUG (MainThread) [alexapy.alexalogin] GET:
2024-09-10 00:25:38.883 DEBUG (MainThread) [alexapy.alexalogin] Session cookies for 'https://alexa.amazon.ca/api/bootstrap': ['session-id', 'session-id-time', 'lc-main', 'ubid-main', 'session-token', 'x-main', 'at-main', 'sess-at-main', 'ubid-acbca', 'x-acbca', 'at-acbca', 'sess-at-acbca', 'csrf', 'i18n-prefs', 'lc-acbca']
2024-09-10 00:25:39.171 DEBUG (MainThread) [alexapy.alexalogin] GET:
2024-09-10 00:25:39.171 DEBUG (MainThread) [alexapy.alexalogin] Logged in as d****@****a to amazon.ca with id: A1UZ93DGNU3F5L
2024-09-10 00:25:39.453 DEBUG (MainThread) [alexapy.alexalogin] Domain amazon.ca matches reported account domain: amazon.ca
2024-09-10 00:25:39.468 DEBUG (MainThread) [alexapy.alexalogin] Login confirmed for d****@****a - amazon.ca; saving cookie to /config/.storage/alexa_media.daniel@brunt.ca.pickle
2024-09-10 00:25:39.543 DEBUG (MainThread) [custom_components.alexa_media] d****l@b******a: HTTP2 created: <alexapy.alexahttp2.HTTP2EchoClient object at 0xffff77b70770>
2024-09-10 00:25:40.248 DEBUG (MainThread) [alexapy.alexahttp2] Starting message parsing loop.
2024-09-10 00:25:40.248 DEBUG (MainThread) [alexapy.alexahttp2] Connecting to https://alexa.na.gateway.devices.a2z.com/v20160207/directives with {'method': 'GET', 'path': '/v20160207/directives', 'authority': 'alexa.na.gateway.devices.a2z.com', 'scheme': 'https', 'authorization': 'Bearer Atna|EwICIBnvrbalcAcTYV2-3aA5fumxLFtfIBEGGrZLSLb_c50T8korJ_y1VxAxIaBxkiZva6Re9j3Zh9dAJBNdpDgzeog9iyMfdgylgApvJivqyGgNsTtO47l5Xw5YvMnix56BMw0BCGrS_6oRtZskBUmF0hfxMOpwiAmWrjjbe7_DMgiHLSZoylScuL47xwUhxga5ughoyKOLIfGABl4hH2doJUHM5QmH0C6yGn030Ccu2c1xZF_XiWhGt61RfOG3cH_JHUJhG77wZ4ZvOoBi7LHPHCpCZc9pkLtq02Hex7Xo9EVfs_A6HLYICIesr63l8tTxog7RMpkksYdsJbA8fjxVH1sd70LQxYV1HT_yslxdGH-WkA'}
2024-09-10 00:25:40.250 DEBUG (MainThread) [alexapy.alexahttp2] Preparing ping to https://alexa.na.gateway.devices.a2z.com/ping
So, I deleted everything again and re-added it. Now everything is working again. I was at the same point two days ago. And after the 10th restart or so, it will probably break again. 🤷♂️
And it's broken again... I had already seen this error message a few days ago, but I couldn't find the log anymore.
It may work 1-2 times after a restart, and then the "concatenate str (not 'NoneType')" error comes back eventually.
2024-09-10 10:20:20.467 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry XXXXXXXXX - amazon.de for alexa_media
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/alexa_media/__init__.py", line 361, in async_setup_entry
await login.login(cookies=await login.load_cookie())
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/alexapy/alexalogin.py", line 328, in load_cookie
cookies = pickle.loads(await myfile.read())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/http/cookies.py", line 312, in __setitem__
raise CookieError("Invalid attribute %r" % (K,))
http.cookies.CookieError: Invalid attribute 'partitioned'
http.cookies.CookieError: Invalid attribute 'partitioned'
That is the 3 month old "partitioned cookie problem".
I'm working on a possible new solution for that but another solution is to replace /usr/local/lib/python3.12/http/cookies.py
with the version proposed in a Python 3.13 PR:
Ref: Support for Partitioned cookies attribute #112713
and gh-112713 : Add support for 'partitioned' attribute in http.cookies
Download the file here.
Hello, everybody.
I dont' know if it helps the discussion (I didnt read it), but I ended up in this page while browsing for the error:
alexalogin.login((<alexapy.alexalogin.AlexaLogin object at 0x7fc88f5b5a00>,), {'cookies': {}}): An error occurred accessing AlexaAPI: An exception of type TypeError occurred. Arguments:
('can only concatenate str (not "NoneType") to str',)
My alexa media player integration was not working because of this error. I fixed up just by updating everything on my raspberry pi.
sudo apt-get update
suddo apt-get upgrade -y
And them everything was back to normal.
Hope it helps
My alexa media player integration was not working because of this error. I fixed up just by updating everything on my raspberry pi.
sudo apt-get update suddo apt-get upgrade -y
And them everything was back to normal.
Hope it helps
I think it might as my suspicions are that caching of some sort, somewhere might be responsible...
If it helps, I get the same type of error in my logs. My Alexa Media is asking to re-authenticate and when I try to do so, I get to visit the Amazon website login screen. I click "Continue" on the screen pre-populated with my email address and I get back to that (I think there was a second page but I forgot). In the logs I see:
2024-09-11 08:34:41.292 WARNING (MainThread) [alexapy.helpers] alexaapi.get_state((<alexapy.alexaapi.AlexaAPI object at 0x7f0b1e7837a0>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
2024-09-11 08:34:41.296 WARNING (MainThread) [alexapy.helpers] alexaapi.get_state((<alexapy.alexaapi.AlexaAPI object at 0x7f0b1e7b28d0>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
2024-09-11 08:34:42.805 WARNING (MainThread) [alexapy.helpers] alexaapi.run_behavior((<alexapy.alexaapi.AlexaAPI object at 0x7f0b1e7b28d0>, {'@type': 'com.amazon.alexa.behaviors.model.OpaquePayloadOperationNode', 'type': 'Alexa.DeviceControls.Volume', 'operationPayload': {'deviceType': 'A2DS1Q2TPDJ48U', 'deviceSerialNumber': 'G************0CK', 'locale': 'it-it', 'customerId': 'A**********M8E', 'value': 54.0}}), {'queue_delay': 1.5}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
2024-09-11 08:34:42.805 WARNING (MainThread) [alexapy.helpers] alexaapi.send_sequence((<alexapy.alexaapi.AlexaAPI object at 0x7f0b1e7b28d0>, 'Alexa.DeviceControls.Volume'), {'customer_id': 'A3I6JFYIK91M8E', 'value': 54.0, 'queue_delay': 1.5}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
2024-09-11 08:34:42.805 WARNING (MainThread) [alexapy.helpers] alexaapi.set_volume((<alexapy.alexaapi.AlexaAPI object at 0x7f0b1e7b28d0>, 0.54), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
File "/usr/local/lib/python3.12/site-packages/alexapy/helpers.py", line 137, in wrapper
File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 1111, in set_volume
File "/usr/local/lib/python3.12/site-packages/alexapy/helpers.py", line 137, in wrapper
File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 512, in send_sequence
File "/usr/local/lib/python3.12/site-packages/alexapy/helpers.py", line 137, in wrapper
File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 434, in run_behavior
File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 226, in _post_request
File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 199, in _request
alexapy.errors.AlexapyLoginError: Login error detected; not contacting API
2024-09-11 08:45:08.860 WARNING (MainThread) [alexapy.helpers] alexaapi.get_customer_history_records((<alexapy.alexalogin.AlexaLogin object at 0x7f0b35a1cd40>,), {'max_record_size': 10}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
2024-09-11 08:45:08.860 WARNING (MainThread) [alexapy.helpers] alexaapi.get_last_device_serial((<alexapy.alexalogin.AlexaLogin object at 0x7f0b35a1cd40>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
2024-09-11 10:00:48.712 WARNING (MainThread) [alexapy.helpers] alexaapi.get_state((<alexapy.alexaapi.AlexaAPI object at 0x7f0b1e7837a0>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
2024-09-11 10:00:48.716 WARNING (MainThread) [alexapy.helpers] alexaapi.get_state((<alexapy.alexaapi.AlexaAPI object at 0x7f0b1e7b28d0>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
2024-09-11 10:00:50.226 WARNING (MainThread) [alexapy.helpers] alexaapi.run_behavior((<alexapy.alexaapi.AlexaAPI object at 0x7f0b1e7b28d0>, {'@type': 'com.amazon.alexa.behaviors.model.OpaquePayloadOperationNode', 'type': 'Alexa.DeviceControls.Volume', 'operationPayload': {'deviceType': 'A2DS1Q2TPDJ48U', 'deviceSerialNumber': 'G************0CK', 'locale': 'it-it', 'customerId': 'A**********M8E', 'value': 54.0}}), {'queue_delay': 1.5}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
2024-09-11 10:00:50.226 WARNING (MainThread) [alexapy.helpers] alexaapi.send_sequence((<alexapy.alexaapi.AlexaAPI object at 0x7f0b1e7b28d0>, 'Alexa.DeviceControls.Volume'), {'customer_id': 'A3I6JFYIK91M8E', 'value': 54.0, 'queue_delay': 1.5}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
2024-09-11 10:00:50.226 WARNING (MainThread) [alexapy.helpers] alexaapi.set_volume((<alexapy.alexaapi.AlexaAPI object at 0x7f0b1e7b28d0>, 0.54), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
File "/usr/local/lib/python3.12/site-packages/alexapy/helpers.py", line 137, in wrapper
File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 1111, in set_volume
File "/usr/local/lib/python3.12/site-packages/alexapy/helpers.py", line 137, in wrapper
File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 512, in send_sequence
File "/usr/local/lib/python3.12/site-packages/alexapy/helpers.py", line 137, in wrapper
File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 434, in run_behavior
File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 226, in _post_request
File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 199, in _request
alexapy.errors.AlexapyLoginError: Login error detected; not contacting API
2024-09-11 10:00:52.718 WARNING (MainThread) [alexapy.helpers] alexaapi.get_state((<alexapy.alexaapi.AlexaAPI object at 0x7f0b1e7837a0>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
2024-09-11 10:00:52.720 WARNING (MainThread) [alexapy.helpers] alexaapi.get_state((<alexapy.alexaapi.AlexaAPI object at 0x7f0b1e7b28d0>,), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
2024-09-11 10:00:54.228 WARNING (MainThread) [alexapy.helpers] alexaapi.run_behavior((<alexapy.alexaapi.AlexaAPI object at 0x7f0b1e7b28d0>, {'@type': 'com.amazon.alexa.behaviors.model.OpaquePayloadOperationNode', 'type': 'Alexa.DeviceControls.Volume', 'operationPayload': {'deviceType': 'A2DS1Q2TPDJ48U', 'deviceSerialNumber': 'G************0CK', 'locale': 'it-it', 'customerId': 'A**********M8E', 'value': 54.0}}), {'queue_delay': 1.5}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
2024-09-11 10:00:54.228 WARNING (MainThread) [alexapy.helpers] alexaapi.send_sequence((<alexapy.alexaapi.AlexaAPI object at 0x7f0b1e7b28d0>, 'Alexa.DeviceControls.Volume'), {'customer_id': 'A3I6JFYIK91M8E', 'value': 54.0, 'queue_delay': 1.5}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
2024-09-11 10:00:54.228 WARNING (MainThread) [alexapy.helpers] alexaapi.set_volume((<alexapy.alexaapi.AlexaAPI object at 0x7f0b1e7b28d0>, 0.54), {}): An error occurred accessing AlexaAPI: An exception of type AlexapyLoginError occurred. Arguments:
File "/usr/local/lib/python3.12/site-packages/alexapy/helpers.py", line 137, in wrapper
File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 1111, in set_volume
File "/usr/local/lib/python3.12/site-packages/alexapy/helpers.py", line 137, in wrapper
File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 512, in send_sequence
File "/usr/local/lib/python3.12/site-packages/alexapy/helpers.py", line 137, in wrapper
File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 434, in run_behavior
File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 226, in _post_request
File "/usr/local/lib/python3.12/site-packages/alexapy/alexaapi.py", line 199, in _request
alexapy.errors.AlexapyLoginError: Login error detected; not contacting API
2024-09-11 10:01:05.023 WARNING (MainThread) [alexapy.helpers] alexalogin.login((<alexapy.alexalogin.AlexaLogin object at 0x7f0b35a1cd40>,), {'data': OrderedDict({'otp_secret': 'U************************************************7OQ', 'email': 'f**m@h*********m', 'password': 'REDACTED 10 CHARS', 'url': 'amazon.it', 'scan_interval': 60, 'include_devices': '', 'exclude_devices': '', 'debug': False, 'reauth': True})}): An error occurred accessing AlexaAPI: An exception of type TypeError occurred. Arguments:
2024-09-11 10:01:05.023 WARNING (MainThread) [custom_components.alexa_media.config_flow] Unknown error: can only concatenate str (not "NoneType") to str
cant add any extra information, except to say having the same error:
alexalogin.login((<alexapy.alexalogin.AlexaLogin object at 0x7f2f5eb236b0>,), {'cookies': {}}): An error occurred accessing AlexaAPI: An exception of type TypeError occurred. Arguments: ('can only concatenate str (not "NoneType") to str',)
@f18m
My Alexa Media is asking to re-authenticate and when I try to do so, I get to visit the Amazon website login screen. I click "Continue" on the screen pre-populated with my email address and I get back to that (I think there was a second page but I forgot). In the logs I see:
When you visit the Amazon login page with email address, instead of clicking "continue" on the email screen, try selecting the option to create a new account (bear with me). Enter anything at all for First name & Last name (like "Q W") and submit. Amazon will then inform you that it already has an account for that email. Switch back to login with email & password, which should now be on one screen, click continue and you should then see the OTP screen. I spent several hours trying to figure out what's going on and decided to try Create New Account just to see what would happen and thereby discovered the above. I don't know yet why it's doing this now but I suspect either Amazon segregated the initial email & password screens or something has changed yet again in HA Core 2024.9.1 as I just started seeing this behaviour.
I believe I remember encountering this error when I was also stuck in Amazon's login loop, where no cookie could be saved. The error likely isn't being caught properly but seems to occur only when there's an issue on Amazon's side. Unfortunately, I regret that the logs for this issue have already been deleted.
This is the log entry I saw when I was stuck in the login loop (it was still in an open notepad on my PC). It's way beyond my skill level to understand what it's doing:
2024-09-11 19:55:20.096 DEBUG (MainThread) [alexapy.alexalogin] Attempting oauth login to
https://www.amazon.com/ap/signin?openid.return_to=https://www.amazon.com/ap/maplanding
&openid.assoc_handle=amzn_dp_project_dee_ios
&openid.identity=http://specs.openid.net/auth/2.0/identifier_select
&pageId=amzn_dp_project_dee_ios&accountStatusPolicy=P1
&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select
&openid.mode=checkid_setup
&openid.ns.oa2=http://www.amazon.com/ap/ext/oauth/2
&openid.oa2.client_id=device:306332613434373737663435316666316161363763666236643834666439623032333431333234393536346335363335353634643332353733383331
&openid.ns.pape=http://specs.openid.net/extensions/pape/1.0
&openid.oa2.response_type=code
&openid.ns=http://specs.openid.net/auth/2.0
&openid.pape.max_auth_age=0
&openid.oa2.scope=device_auth_access
&openid.oa2.code_challenge_method=S256
&openid.oa2.code_challenge=qVNqbCRsP24g1duhlpooF7diPzrkzDrkUzE49chzygI
&language=en_CA
https://www.amazon.com/ap/maplanding
?openid.assoc_handle=amzn_dp_project_dee_ios&openid.claimed_id=https%3A%2F%2Fwww.amazon.com%2Fap%2Fid%2Famzn1.account.AE2UYTSC4T77TJMTK7HVKA4SHSJQ
&openid.identity=https%3A%2F%2Fwww.amazon.com%2Fap%2Fid%2Famzn1.account.AE2UYTSC4T77TJMTK7HVKA4SHSJQ
&openid.mode=id_res
&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0
&openid.op_endpoint=https%3A%2F%2Fwww.amazon.com%2Fap%2Fsignin
&openid.response_nonce=2024-09-12T03%3A23%3A09Z4782521131671538174
&openid.return_to=https%3A%2F%2Fwww.amazon.com%2Fap%2Fmaplanding
&openid.signed=assoc_handle%2Cclaimed_id%2Cidentity%2Cmode%2Cns%2Cop_endpoint%2Cresponse_nonce%2Creturn_to%2Cns.pape%2Cpape.auth_policies%2Cpape.auth_time%2Coa2.authorization_code%2Csigned
&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0
&openid.pape.auth_policies=http%3A%2F%2Fschemas.openid.net%2Fpape%2Fpolicies%2F2007%2F06%2Fmulti-factor
&openid.pape.auth_time=2024-09-12T03%3A23%3A03Z
&openid.sig=AAu6mU%2FQyKHqCZe%2FxOwB3%2B4TALALHqJwxBRCk3seAZ8%3D
&serial=
&openid.oa2.authorization_code=ANtkoxeNBHOlUOCwIOTQIKof
&openid.ns.oa2=http%3A%2F%2Fwww.amazon.com%2Fap%2Fext%2Foauth%2F2
I was also seeing the initial captcha window which is something I have not encountered for a very long time.
Issue #2514 is related to this
Hello everyone, I've also had the error (TypeError: can only concatenate str (not "NoneType") to str) for 3 days or one of the last updates. Is there a solution now or is it being worked on? Currently, some automations are no longer working because of this. Thank you very much
I had the same error, reinstalled the integration from HACS (after deleting the pickle file in the .storage folder of HA) and now is working ok for 3 days.
On Fri, Sep 13, 2024 at 8:46 AM deifel @.***> wrote:
Hello everyone, I've also had the error (TypeError: can only concatenate str (not "NoneType") to str) for 3 days or one of the last updates. Is there a solution now or is it being worked on? Currently, some automations are no longer working because of this. Thank you very much
— Reply to this email directly, view it on GitHub https://github.com/alandtse/alexa_media_player/issues/2515#issuecomment-2348156386, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEUCREIEI6DSMNKUW6YZ2XLZWKC4PAVCNFSM6AAAAABN4HX5QGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBYGE2TMMZYGY . You are receiving this because you commented.Message ID: @.***>
ChatGPT:
The error you're encountering is a TypeError caused by trying to concatenate a string with a NoneType
object during the login process for the alexa_media
integration in Home Assistant. The error occurs in this code snippet:
error_message += list_item.find("span").string
Cause:
The program is trying to append text from an HTML span
element, but list_item.find("span").string
is returning None
. This happens when the expected span
element is either missing or empty, potentially due to an unexpected or malformed response from Amazon's login page.
Potential Causes:
Solution:
Modify the Python Code: The program needs to handle cases where no text is found in the span
element:
span_text = list_item.find("span").string
if span_text: # Only append if span_text is not None
error_message += span_text
This simple check ensures the program won't break if the element is empty, preventing the TypeError.
Clear Cookies: Old or corrupted cookies could cause faulty authentication attempts. You can delete the saved cookie files and restart the login process, allowing fresh cookies to be generated:
rm /config/.storage/alexa_media.*.pickle
Wait for Stabilization: Given Amazon's recent IAM issues, retrying after services fully stabilize may resolve the problem without requiring further changes.
During the login process, the system initiates an OAuth login attempt, where it exchanges credentials for access tokens via an external service (Amazon). If the response during this attempt is malformed or incomplete, the login process could fail, leading to the errors you are seeing. Properly handling these scenarios by checking for missing elements or corrupted session data can help prevent these issues.
By following these steps, you should be able to resolve the error and avoid the login loop caused by this unexpected behavior.
@cyberdie
I had the same error, reinstalled the integration from HACS (after deleting the pickle file in the .storage folder of HA) and now is working ok for 3 days.
Anyone experiencing this issue should try clearing potentially corrupted cookies, as this could help resolve the problem.
I deleted the pickl file and removed the addon. If i now try to reinstall and configure it, i also get a loop on login page on amazon.
I deleted the pickl file and removed the addon. If i now try to reinstall and configure it, i also get a loop on login page on amazon.
Reboot again, then try Daniel's sequence
Works für 3 hours - now the error (NoneType...) is back :(
Works für 3 hours - now the error (NoneType...) is back :(
You may try my __init__.py
file version:
__init__.py.txt
to __init__.py
.config\custom_components\alexa_media\__init__.py
file. (e.g. rename it)__init__.py
in your config\custom_components\alexa_media\
directory.My version tries to give you more useful error messages and retries to log in. If it fails, please post your logs. Maybe we can see more, maybe not. (Depends on where it fails.)
I just updated HA from 2024.7.3 to 2024.9.1 and immediately encountered this error. Alexa has previously been working fine for months. Reloading integration and rebooting HA had no effect, nor did deleting my pickle and rebooting. I eventually restored from backup to 2024.7.3 and Alexa is working again. (This makes me wonder how this can be an Amazon problem, it must be something on our end). Following this for a fix.
there is a new alexapy version that fixes cookie issues, i just changed the version in the manifest to "alexapy==1.29.2" and then restarted, then reset back up and ensured i added the code for 2fa and all seems to be back up and running
there is a new alexapy version that fixes cookie issues, i just changed the version in the manifest to "alexapy==1.29.2" and then restarted, then reset back up and ensured i added the code for 2fa and all seems to be back up and running
When you set it back up, did you encounter a captcha window and then the endless loop from email to password back to email pages?
same error here, alexa media player worked (more or less) for the last weeks. since today it doesnt start and i got the same behavior as mentioned by @danielbrunt57. changed manifest to 1.29.2 like @fuzzysb did and tried to configure integration and also got a mail - password - mail and so on loop.
same error here, alexa media player worked (more or less) for the last weeks. since today it doesnt start and i got the same behavior as mentioned by @danielbrunt57. changed manifest to 1.29.2 like @fuzzysb did and tried to configure integration and also got a mail - password - mail and so on loop.
Retry the login sequence with my workaround to get out of the loop: Daniel's sequence The callback expects two pages: email & password on first, OTP on the 2nd. I think something changed in Amazon and initially we're now getting email entry page, password entry page, OTP entry page.
You may try my
__init__.py
file version:
- Rename
__init__.py.txt
to__init__.py
.- Make a backup of your original
config\custom_components\alexa_media\__init__.py
file. (e.g. rename it)- Move
__init__.py
in yourconfig\custom_components\alexa_media\
directory.- reboot
- Retry with Daniel's sequence
My version tries to give you more useful error messages and retries to log in. If it fails, please post your logs. Maybe we can see more, maybe not. (Depends on where it fails.)
I now have the TypeError: can only concatenate str (not "NoneType") to str
error, even with your __init__.py
- there's just more attempts now and log entries but still ends with same error.
2024-09-14 155501.549 alexa log.txt
I now have the
TypeError: can only concatenate str (not "NoneType") to str
error, even with your__init__.py
- there's just more attempts now and log entries but still ends with same error. 2024-09-14 155501.549 alexa log.txt
I restored alexalogin.py
and the integration is now working again so it was something I introduced into it, perhaps my fix for warning: Detected blocking call to load_verify_locations with args (<ssl.SSLContext object at 0xffff527c3950>, '/usr/local/lib/python3.12/site-packages/certifi/cacert.pem', None, None) as that is now back again...
I also have a side problem. Right now the integration is not going. so notify.alexa_media does not exist. All my automations that use that service (action) now no longer work.
Has anyone found a way to put a try catch without removing the service altogether?
I tried with continue_on_error: true creating a proxy service but nothing always crashes for “action does not exist”
Has anyone found a way to put a try catch without removing the service altogether?
Although this does not directly check for the notify.alexa_media
service, this template can indirectly check by referencing an alexa_media
media_player
entity. If the alexa media_player
entity does not exist then it's pretty much a given that the notify.alexa_media
service doesn't exist either:
{{ states("media_player.kitchen_echo_dot") != 'unknown' }}
In automation/script:
if:
- condition: template
value_template: "{{ states('media_player.kitchen_echo_dot') != 'unknown' }}"
then:
- action: notify.alexa_media_kitchen_echo_dot
data:
message: Hello. Can you hear me?
This seems to be resolved for me in 4.13.0 released today.
Sadly 4.13 has not fixed it for me.
2024-09-16` 22:41:42.719 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry aaaaa@aaaaal.net - amazon.co.uk for alexa_media
Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/alexa_media/init.py", line 361, in async_setup_entry await login.login(cookies=await login.load_cookie()) 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/alexalogin.py", line 661, in login site = await self._process_page(html, site) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/alexapy/alexalogin.py", line 1463, in _process_page error_message += list_item.find("span").string TypeError: can only concatenate str (not "NoneType") to str
4.13.1 and I still have the issue unfortunately
Logger: homeassistant.config_entries
Source: config_entries.py:604
First occurred: 13:43:41 (1 occurrences)
Last logged: 13:43:41
Error setting up entry cagnulein@gmail.com - amazon.it for alexa_media
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/alexa_media/__init__.py", line 361, in async_setup_entry
await login.login(cookies=await login.load_cookie())
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/alexalogin.py", line 713, in login
self._site = await self._process_page(await post_resp.text(), site)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/alexapy/alexalogin.py", line 1506, in _process_page
error_message += list_item.find("span").string
TypeError: can only concatenate str (not "NoneType") to str
Same here, still happening with 4.13.1
Some here, Registrador: homeassistant.config_entries Fuente: config_entries.py:604 Ocurrió por primera vez: 10:14:51 (3 ocurrencias) Última vez registrado: 11:40:59
Error setting up entry xxxxxxxx@yahoo.es - amazon.es for alexa_media Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/alexa_media/init.py", line 361, in async_setup_entry await login.login(cookies=await login.load_cookie()) 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/alexalogin.py", line 713, in login self._site = await self._process_page(await post_resp.text(), site) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/alexapy/alexalogin.py", line 1506, in _process_page error_message += list_item.find("span").string TypeError: can only concatenate str (not "NoneType") to str
Has everyone tried deleting the integration config entry and setting it up again?
Has everyone tried deleting the integration config entry and setting it up again?
I didnt want to be that guy 🤣🤣🤣 but, "its working for me" after doing that :)
Has everyone tried deleting the integration config entry and setting it up again?
I didnt want to be that guy 🤣🤣🤣 but, "its working for me" after doing that :)
As specified by people earlier it will work initially but just stop again on it's own... :(
As specified by people earlier it will work initially but just stop again on it's own... :(
If that's true after doing as I outlined then there's still an issue with cookie manipulation/credentials.
Personally, I would rather just eat them...
I'm also facing this issue
Hello, everybody.
I dont' know if it helps the discussion (I didnt read it), but I ended up in this page while browsing for the error:
alexalogin.login((<alexapy.alexalogin.AlexaLogin object at 0x7fc88f5b5a00>,), {'cookies': {}}): An error occurred accessing AlexaAPI: An exception of type TypeError occurred. Arguments: ('can only concatenate str (not "NoneType") to str',)
My alexa media player integration was not working because of this error. I fixed up just by updating everything on my raspberry pi.
sudo apt-get update suddo apt-get upgrade -y
And them everything was back to normal.
Hope it helps
Guys, its working normally for me since I updated everything on my Rasp. Even before this week update of the integration.
Has anyone else tried updating the OS? The problema persisted?
No more problems for me
Hello, everybody. I dont' know if it helps the discussion (I didnt read it), but I ended up in this page while browsing for the error:
alexalogin.login((<alexapy.alexalogin.AlexaLogin object at 0x7fc88f5b5a00>,), {'cookies': {}}): An error occurred accessing AlexaAPI: An exception of type TypeError occurred. Arguments: ('can only concatenate str (not "NoneType") to str',)
My alexa media player integration was not working because of this error. I fixed up just by updating everything on my raspberry pi.
sudo apt-get update suddo apt-get upgrade -y
And them everything was back to normal. Hope it helps
Guys, its working normally for me since I updated everything on my Rasp. Even before this week update of the integration.
Has anyone else tried updating the OS? The problema persisted?
No more problems for me
I am running latest version of HAOS (as a vm on proxmox), not sure if that would be the equivalent to what you're saying
Hello, everybody. I dont' know if it helps the discussion (I didnt read it), but I ended up in this page while browsing for the error:
alexalogin.login((<alexapy.alexalogin.AlexaLogin object at 0x7fc88f5b5a00>,), {'cookies': {}}): An error occurred accessing AlexaAPI: An exception of type TypeError occurred. Arguments: ('can only concatenate str (not "NoneType") to str',)
My alexa media player integration was not working because of this error. I fixed up just by updating everything on my raspberry pi.
sudo apt-get update suddo apt-get upgrade -y
And them everything was back to normal. Hope it helps
Guys, its working normally for me since I updated everything on my Rasp. Even before this week update of the integration.
Has anyone else tried updating the OS? The problema persisted?
No more problems for me
Humm… I’m not sure now… it’s working for me since my last attempt to fix it… I always keep it up to date so might have updated then deleted stuff and fixed it and it didn’t re-break. I’ll report back IF it breaks again! Promise! 😇
This is a bug in alexapy 1.29.2. I changed it locally and now it reads:
if errorbox:
error_message = errorbox.find("h4").string
if error_message == None:
error_message = ""
for list_item in errorbox.findAll("li"):
jms = list_item.find("span")
if jms and jms.string:
error_message += jms.string
_LOGGER.error("Error message: %s", error_message)
status["error_message"] = error_message
Daniel is a god! @danielbrunt57
I removed the integration, rebooted, added the integration again, went into endless login loop, used the Daniel method to try to create a new account with the same email, it failed as planned, logged in again and this time got to the 2FA page. After this everything started working! It's 3am and it took 3 hours to fix but it's working!!! :-)
Describe the bug
The integration no longer starts. In the past, multiple restarts helped (HA 2024.07 / HA 2024.08), but recently, nothing helps anymore. A complete reinstallation worked for 2 days, but after several restarts, the same problem occurred again.
Same or similar to https://github.com/alandtse/alexa_media_player/issues/1072
TypeError: can only concatenate str (not "NoneType") to str
To Reproduce
🤷♂️
Expected behavior
Screenshots
System details
const.py
or HA startup log): 4.12.12pip show alexapy
in homeasssistant container or HA startup log): 1.28.2Debug Logs (alexa_media & alexapy) Please provide logs.
Additional context