alexa_media_player: Amazon Alexa fails to start after HA reboot
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
After restarting HA, the integration fails to load. I must manually reload, by clicking the 3 dots, integration and then everything works. This happens every time but never used to happen.
To Reproduce
- Reboot HA
- Check integration
- See error
Expected behavior
Screenshots
System details
- Home-assistant (version): 2024.8.1
- alexa_media (version from
const.pyor HA startup): 4.12.7 - alexapy (version from
pip show alexapyor HA startup): 1.28.2 - Amazon 2FA is enabled (y/n). <!—We will not debug login issues if unanswered—>: Yes
Logs 2024-08-12 09:49:46.557 DEBUG (MainThread) [custom_components.alexa_media] Nothing to import from configuration.yaml, loading from Integrations 2024-08-12 09:49:46.557 DEBUG (MainThread) [custom_components.alexa_media] alexa_media https://github.com/alandtse/alexa_media_player/issues 2024-08-12 09:49:46.557 DEBUG (MainThread) [custom_components.alexa_media] Loaded alexapy==1.28.2 2024-08-12 09:49:46.557 DEBUG (MainThread) [custom_components.alexa_media.helpers] ft@gm: Returning uuid {‘uuid’: ‘343a5f02376bf5937f066d76d1d70098’, ‘index’: 0} 2024-08-12 09:49:46.599 DEBUG (MainThread) [alexapy.alexalogin] Login created for ft@gl.com - amazon.com 2024-08-12 09:49:46.600 DEBUG (MainThread) [alexapy.alexalogin] Searching for cookies from /config/.storage/alexa_media.fspatt@gmail.com.pickle 2024-08-12 09:49:46.601 DEBUG (MainThread) [alexapy.alexalogin] Trying to load cookie from file /config/.storage/alexa_media.fspatt@gmail.com.pickle 2024-08-12 09:50:31.577 DEBUG (MainThread) [custom_components.alexa_media] Completing remaining startup tasks. 2024-08-12 10:12:27.358 DEBUG (MainThread) [custom_components.alexa_media.helpers] ft@gm: Returning uuid {‘uuid’: ‘343a5f02376bf5937f066d76d1d70098’, ‘index’: 0} 2024-08-12 10:12:27.396 DEBUG (MainThread) [alexapy.alexalogin] Login created for ft@g*****m - amazon.com 2024-08-12 10:12:27.400 DEBUG (MainThread) [alexapy.alexalogin] Searching for cookies from /config/.storage/alexa_media.fspatt@gmail.com.pickle 2024-08-12 10:12:27.400 DEBUG (MainThread) [alexapy.alexalogin] Trying to load cookie from file /config/.storage/alexa_media.fspatt@gmail.com.pickle 2024-08-12 10:12:27.405 DEBUG (MainThread) [alexapy.alexalogin] Trying to load aiohttpCookieJar to session 2024-08-12 10:12:27.408 DEBUG (MainThread) [alexapy.alexalogin] Loaded 10 cookies 2024-08-12 10:12:27.408 DEBUG (MainThread) [alexapy.alexalogin] Searching for cookies from /config/alexa_media.fspatt@gmail.com.pickle 2024-08-12 10:12:27.408 DEBUG (MainThread) [alexapy.alexalogin] Using cookies to log in 2024-08-12 10:12:27.409 DEBUG (MainThread) [alexapy.alexalogin] Attempting to register with amazon.com 2024-08-12 10:12:27.787 DEBUG (MainThread) [alexapy.alexalogin] auth response <ClientResponse(https://api.amazon.com/auth/register) [401 Unauthorized]> {“requested_extensions”: [“device_info”, “customer_info”], “cookies”: {“website_cookies”: [], “domain”: “.amazon.com”}, “registration_data”: {“domain”: “Device”, “app_version”: “2.2.556530.0”, “device_type”: “A2IVLV5VM2W81”, “device_name”: “%FIRST_NAME%'s%DUPE_STRATEGY_1ST%Alexa Media Player”, “os_version”: “16.6”, “device_serial”: “343a5f02376bf5937f066d76d1d70098”, “device_model”: “iPhone”, “app_name”: “Alexa Media Player”, “software_version”: “1”}, “auth_data”: {“access_token”: “Atna|EwICIB0b_dAJbWSjszIGrkQeKUL8oVyMVTjsqN4Mj390yyc4bTthtUTBjIPng_xb1cmoYk9ducFSIWRWKo3X__CW0FYHWDNAbiL0d0DqGYK7DUTHkdpwMESulEiZM8HbzaB_eDtHskOdxAtf1t-BFvxjcKIr08IspbsNVjCRXUfpGYj1tLufGLTW76xzXdrTw5RLU87XPdRemeL6Eumr81zhWzIhbJgaLpXIf3xsK5H8K_mr_RxTZeu9byjc5-lFdPLb0X2enMQx6rbKXRKBD60CZ1Ume_eabjKdE1yapMq1n_2M5bxafhd80HG-U6lU7W28JzdliSNq81ok10ah0dwBYCX96M7zudmrn3fzBP5U6J1VsaLPVoVyZyT9WnsX8IV6dSQ”}, “user_context_map”: {“frc”: “12qsUvMpzMgGTaJQbJKbZY76FsI2G0W7EaMb4WztzThdBnjeWIvb1y+lgtfL+p2k2c42cTwq8G2xEt8i6lPazTEk+SSzsHolo4f+jNWgLVgHfRm2/psF5ixj6YVV+HFgDBURLAg4BYg9IiGRpRQAKUo+ZFtlVHjbOnB8MWOh4lFBMc2Dgw9tZFUh4KUtbRt1GU6VMalwsfLZN9uSsi6e3BWj/DdyazboU6u7FRC0gjRfdlnOQBn6NhacV5jdGG9YBIgiDfyWCfmFtH2UHuN8/352TGvWLw65JWAKe0bR4hEq+UBQgifVLNNgZtis6NPiS0/iUbyTXmv5Df6Bcd2Px+aWurcgcHBNT4HQTgHlFYMsJb9P4XAY/cNfgB2JcDcIiwhQjnGDhaCeHI59iFLpIX8GGnq/Ey9J6Q”}, “requested_token_type”: [“bearer”, “mac_dms”, “website_cookies”]} 2024-08-12 10:12:27.787 DEBUG (MainThread) [alexapy.alexalogin] Unable to register with [‘amazon.com’] 2024-08-12 10:12:28.348 DEBUG (MainThread) [alexapy.alexalogin] capabilities response <ClientResponse(https://api.amazonalexa.com/v1/devices/@self/capabilities) [403 Forbidden]>
Additional context
I’ve delete the pickles as was previously suggested under FAQ, removed, rebooted, reinstalled, rebooted, etc. No joy.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 17 (1 by maintainers)
Well thanks for your efforts and explanation! FrankOn Aug 15, 2024, at 8:10 AM, Daniel @.***> wrote:
Just one question, does the “patch” stay forever? Couldn’t the fix be incorporated into the integration? Frank
No. I tried every which way from Sunday that I know to attempt to do that but my attempts all failed, and no one else has attempted to do what I could not do. I manually re-replaced cookies.py after every HA update since 2024.6.2 until I queried google with different key words and found amitfin’s custom_component. Python 3.13 Final is scheduled to release in October but I do not know when HA will upgrade to it after that. Could be 2024.11.x or 2024.12.x, hopefully no later than that!
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>
Just one question, does the “patch” stay forever? Couldn’t the fix be incorporated into the integration?
Frank
@FS1961 Here is how I automate automatically re-patching that file after every new HA update (which you will have to do 8-10+ times until HA adopts Python 3.13 which should then support partitioned cookies):
https://github.com/amitfin/patch,Category: Integrationpatchand added that shared folder to Setting > System > Storage > Network storage aspatches. That creates a folder in Home Assistant/share/namedpatches. Alternatively, you can just create the/share/patchesfolder which will then reside on your HA storage device.configuration.yamlfile:Okay, I applied the cookies.patch as described above. I deleted the pickle, removed the integration, restarted, added the integration, restarted, authenticated, and restarted the HA. Now the integration works!!! Thanks so much for your help!!!