alandtse / alexa_media_player

This is a custom component to allow control of Amazon Alexa devices in Home Assistant using the unofficial Alexa API.
Apache License 2.0
1.52k stars 290 forks source link

Amazon Alexa fails to start after HA reboot #2457

Closed FS1961 closed 3 months ago

FS1961 commented 3 months ago

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

  1. Reboot HA
  2. Check integration
  3. See error

Expected behavior

Screenshot 2024-08-12 at 3 31 52 PM

Screenshots

System details

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@g*m: Returning uuid {'uuid': '343a5f02376bf5937f066d76d1d70098', 'index': 0} 2024-08-12 09:49:46.599 DEBUG (MainThread) [alexapy.alexalogin] Login created for ft@g**l.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] f***t@gm: Returning uuid {'uuid': '343a5f02376bf5937f066d76d1d70098', 'index': 0} 2024-08-12 10:12:27.396 DEBUG (MainThread) [alexapy.alexalogin] Login created for f**t@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.

chrisvblemos commented 3 months ago

From the logs, it seems your access_token is invalid or expired and it is being refused here: 2024-08-12 10:12:27.787 DEBUG (MainThread) [alexapy.alexalogin] auth response <ClientResponse(https://api.amazon.com/auth/register) [401 Unauthorized]>

After deleting the pickle file, did you reauthenticate successfully using 2FA with an external app? More logs of the first authentication process would be helpful (after deleting the pickle file), the ones you sent are with the pickle file available.

scarolan commented 3 months ago

Same problem here. The party may be over. I completely removed and re-added the built-in authenticator, was able to auth, but then it kicks you back to the login page again and the integration gets stuck on "needs reconfigure"

FS1961 commented 3 months ago

Yes. I re-authenticated just fine. I even removed everything and reinstalled. Maybe there are residual / artifacts left behind somewhere?  I can remove the integration again but is there a whole directory I should delete?Also - doesn’t really explain why “reloading” works if the auth has expired. FrankOn Aug 12, 2024, at 4:45 PM, Sean Carolan @.***> wrote: Same problem here. The party may be over. I completely removed and re-added the built-in authenticator, was able to auth, but then it kicks you back to the login page again and the integration gets stuck on "needs reconfigure"

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

brandon-meadows commented 3 months ago

https://github.com/alandtse/alexa_media_player/issues/2433#issuecomment-2275924361

"requirements": ["alexapy>=1.28.2", "packaging>=20.3", "wrapt>=1.14.0"], 

This worked, change the manifest.json.

serosenstein commented 3 months ago

https://github.com/alandtse/alexa_media_player/issues/2433#issuecomment-2275924361

"requirements": ["alexapy>=1.28.2", "packaging>=20.3", "wrapt>=1.14.0"], 

This worked, change the manifest.json.

Change it to what? Mine already has that in it and your link to comment isn’t working

brandon-meadows commented 3 months ago

Change it to what? Mine already has that in it and your link to comment isn’t working

custom_components/alexa_media/manifest.json Mine had "alexapy==1.28.2" I changed it to "alexapy>=1.28.2"

serosenstein commented 3 months ago

Change it to what? Mine already has that in it and your link to comment isn’t working

custom_components/alexa_media/manifest.json Mine had "alexapy==1.28.2" I changed it to "alexapy>=1.28.2"

Oh ok, missed that. Unfortunately didn’t work for me (did a reload, reauth and even rebooted HA)

FS1961 commented 3 months ago

From the logs, it seems your access_token is invalid or expired and it is being refused here: 2024-08-12 10:12:27.787 DEBUG (MainThread) [alexapy.alexalogin] auth response <ClientResponse(https://api.amazon.com/auth/register) [401 Unauthorized]>

After deleting the pickle file, did you reauthenticate successfully using 2FA with an external app? More logs of the first authentication process would be helpful (after deleting the pickle file), the ones you sent are with the pickle file available.

I removed the pickle and restarted HA. Didn't ask for a re-auth but when I did a reload of the integration, it goes back to working. How do I force a re-auth except by removing the integration and re-adding it?

2024-08-13 07:25:40.259 DEBUG (MainThread) [custom_components.alexa_media] Nothing to import from configuration.yaml, loading from Integrations 2024-08-13 07:25:40.260 DEBUG (MainThread) [custom_components.alexa_media] alexa_media https://github.com/alandtse/alexa_media_player/issues 2024-08-13 07:25:40.260 DEBUG (MainThread) [custom_components.alexa_media] Loaded alexapy==1.28.2 2024-08-13 07:25:40.260 DEBUG (MainThread) [custom_components.alexa_media.helpers] ft@g*m: Returning uuid {'uuid': '343a5f02376bf5937f066d76d1d70098', 'index': 0} 2024-08-13 07:25:40.313 DEBUG (MainThread) [alexapy.alexalogin] Login created for fspatt@gmail.com - amazon.com 2024-08-13 07:25:40.314 DEBUG (MainThread) [alexapy.alexalogin] Searching for cookies from /config/.storage/alexa_media.fspatt@gmail.com.pickle 2024-08-13 07:25:40.315 DEBUG (MainThread) [alexapy.alexalogin] Trying to load cookie from file /config/.storage/alexa_media.fspatt@gmail.com.pickle 2024-08-13 07:26:21.640 DEBUG (MainThread) [custom_components.alexa_media] Completing remaining startup tasks. 2024-08-13 07:28:49.768 DEBUG (MainThread) [custom_components.alexa_media.helpers] ft@g*m: Returning uuid {'uuid': '343a5f02376bf5937f066d76d1d70098', 'index': 0} 2024-08-13 07:28:49.805 DEBUG (MainThread) [alexapy.alexalogin] Login created for fspatt@gmail.com - amazon.com 2024-08-13 07:28:49.808 DEBUG (MainThread) [alexapy.alexalogin] Searching for cookies from /config/.storage/alexa_media.fspatt@gmail.com.pickle 2024-08-13 07:28:49.808 DEBUG (MainThread) [alexapy.alexalogin] Trying to load cookie from file /config/.storage/alexa_media.fspatt@gmail.com.pickle 2024-08-13 07:28:49.813 DEBUG (MainThread) [alexapy.alexalogin] Trying to load aiohttpCookieJar to session 2024-08-13 07:28:49.816 DEBUG (MainThread) [alexapy.alexalogin] Loaded 10 cookies 2024-08-13 07:28:49.816 DEBUG (MainThread) [alexapy.alexalogin] Searching for cookies from /config/alexa_media.fspatt@gmail.com.pickle 2024-08-13 07:28:49.817 DEBUG (MainThread) [alexapy.alexalogin] Using cookies to log in 2024-08-13 07:28:49.818 DEBUG (MainThread) [alexapy.alexalogin] Attempting to register with amazon.com 2024-08-13 07:28:50.512 DEBUG (MainThread) [alexapy.alexalogin] auth response <ClientResponse(https://api.amazon.com/auth/register) [200 OK]>'

Screenshot 2024-08-13 at 7 27 00 AM Screenshot 2024-08-13 at 7 29 07 AM

I also edited the json. No change.

danielbrunt57 commented 3 months ago

This section of your error log:

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]>

has always existed even in AMP 4.10.3, which I've just loaded and checked and I see that log sequence even though the integration is working.

Are you sure you're not also getting the error in issue #2288 due to a partitioned cookie which started back in June? It is a homeassistant.config_entries error and not alexa_media / alexapy:

2024-06-18 15:11:26.699 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry daniel@brunt.ca - amazon.com for alexa_media
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/alexa_media/__init__.py", line 335, 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'
FS1961 commented 3 months ago

This section of your error log:

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]>

has always existed even in AMP 4.10.3, which I've just loaded and checked and I see that log sequence even though the integration is working.

Are you sure you're not also getting the error in issue #2288 due to a partitioned cookie which started back in June? It is a homeassistant.config_entries error and not alexa_media / alexapy:

2024-06-18 15:11:26.699 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry daniel@brunt.ca - amazon.com for alexa_media
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/alexa_media/__init__.py", line 335, 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'

Hello Daniel - I believe things started back in June so no, I'm not sure. Is the fix the "cookies.patch" issue as described?

FS1961 commented 3 months ago

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!!!!

danielbrunt57 commented 3 months ago

I'm very happy to hear that!

danielbrunt57 commented 3 months ago

@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):

image

image

image

image

FS1961 commented 3 months ago

Just one question, does the “patch” stay forever? Couldn’t the fix be incorporated into the integration?

Frank

On Aug 14, 2024, at 7:50 PM, Daniel @.***> wrote:

I'm very happy to hear that!

— Reply to this email directly, view it on GitHub https://github.com/alandtse/alexa_media_player/issues/2457#issuecomment-2289469086, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXPFZNTMS4ZBYSXCPQ6GFADZROKFRAVCNFSM6AAAAABMMGPE5KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBZGQ3DSMBYGY. You are receiving this because you modified the open/close state.

danielbrunt57 commented 3 months ago

Just one question, does the “patch” stay forever? Couldn’t the fix be incorporated into the integration? Frank

No, HA updates rewrite all of home assistant core thus restoring the original python_3.12/http/cookies.py. I tried every which way from Sunday that I know to attempt to bundle it somehow into AMP 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!

FS1961 commented 3 months ago

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: @.***>

danielbrunt57 commented 3 months ago

Manually re-replacing cookies.py after each HA update is not a lot of work even if you do each and every update until 3.13 comes out. The Patch integration was pretty easy to set up though and at least automates the process resulting in only two restarts to get AMP working again like it should after a core update. If I can find a better way I will but I'm pretty happy (for now) with having the patching automated...