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.47k stars 283 forks source link

Alexa Media Player fails to initialize after restarting HA 2024.6.3 due to partitioned cookie #2288

Closed danielbrunt57 closed 2 weeks ago

danielbrunt57 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

Alexa Media Player is failing to initialize after restarting HA 2024.6.3. If I reload the integration, all is well.

To Reproduce

Restart Home assistant 2014.6.3 and observe that the integration failed to load.

Expected behavior

It should load like it did on 2024.6.2 and older.

Screenshots

image

System details

Logs

home-assistant_2024-06-17T13-08-27.618Z.log

Additional context

danielbrunt57 commented 3 months ago

After getting 2024.7.0 on Wednesday and also upgrading to the latest AMP, no the issue persists. I just now decided to retry core-2024.7.0 with a different test:

image image

Note: I added "hacs" dependency to manifest.json otherwise AMP would be in the 1st initializing state for a v e r y long time.

Using the original python3.12 cookies.py file without partitioned cookie support, this worked for me but it does delay my complete startup by a lot. I will probably go back to the python3.13 file...

danielbrunt57 commented 3 months ago

As I think I stated before, Python 3.13 is not scheduled to be out of beta until October and it may be a month or more before HA updates to 3.13. The PR for partitioned cookie support appears to still be on track as a Feature for 3.13, but we might see a new AMP integration before all that happens as this one is now on life support.

myevit commented 3 months ago

Same issue. Had to roll back to previous release.

danielbrunt57 commented 3 months ago

Same issue. Had to roll back to previous release.

If that's the solution you choose to stick with then based on my limited knowledge of the issue and a solution for it, you'll be on 2024.6.2 until November or December. The core devs aren't going to look into a problem which they'll perceive to be the integration's fault.

raymondjstone commented 3 months ago

I have this issue was well, interestingly perhaps I also had the same issue just recently with the tuya integration as well, ie also needed a reload of the item after a reboot, the tuya one however has stopped happening after the last HA update but the alexa one persists

jondiez commented 3 months ago

Registrador: homeassistant.setup Fuente: setup.py:322 Ocurrió por primera vez: 12:11:15 (1 ocurrencias) Último inicio de sesión: 12:11:15

Setup failed for custom integration 'alexa_media': Unable to import component: Exception importing custom_components.alexa_media Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/loader.py", line 1050, in _get_component ComponentProtocol, importlib.import_module(self.pkg_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/importlib/init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1331, in _find_and_load_unlocked File "", line 935, in _load_unlocked File "", line 995, in exec_module File "", line 488, in _call_with_frames_removed File "/config/custom_components/alexa_media/init.py", line 16, in from alexapy import ( File "/usr/local/lib/python3.12/site-packages/alexapy/init.py", line 41, in maintainer = metadata["maintainer"]


  File "/usr/local/lib/python3.12/site-packages/importlib_metadata/_adapters.py", line 54, in __getitem__
    raise KeyError(item)
KeyError: 'maintainer'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 990, in async_get_component
    comp = await self.hass.async_add_import_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1061, in _get_component
    raise ImportError(f"Exception importing {self.pkg_path}") from err
ImportError: Exception importing custom_components.alexa_media

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1050, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/alexa_media/__init__.py", line 16, in <module>
    from alexapy import (
  File "/usr/local/lib/python3.12/site-packages/alexapy/__init__.py", line 41, in <module>
    __maintainer__ = metadata["maintainer"]
                     ~~~~~~~~^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/importlib_metadata/_adapters.py", line 54, in __getitem__
    raise KeyError(item)
KeyError: 'maintainer'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 322, in _async_setup_component
    component = await integration.async_get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1010, in async_get_component
    self._component_future.result()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1002, in async_get_component
    comp = self._get_component()
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1061, in _get_component
    raise ImportError(f"Exception importing {self.pkg_path}") from err
ImportError: Exception importing custom_components.alexa_media
liquidt1983 commented 3 months ago

I am having to same issue. After every restart, I have to reload the integration for it to work.

danielbrunt57 commented 3 months ago

I am having to same issue. After every restart, I have to reload the integration for it to work.

The only solutions so far are... 1) Revert to 2024.6.2 and stay there until you hear otherwise (which could be 6 months). 2) Create an automation triggered by home assistant start to reload the integration. 3) Replace the /usr/local/lib/python3.12/http/cookies.py file and re-replace it after every HA update until python 3.13 is released and HA upgrades to it, with the PR for python 3.13 version which I discovered in my quest for a solution.

The core issue seems to lie in HA's python 3.12 and how AMP interacts with HA core services i.e. http. For some reason yet unknown, AMP initialization is gaining access to/given a partitioned cookie (see CHIPS support in browsers) but is getting a regular cookie when reloaded.

Someone may still discover the reason and a solution for it but it will not be the maintainer of this integration as he has stepped away from it except to review and merge other PR's that people might put forth.

alandtse commented 3 months ago

The only solutions so far are...

  1. Revert to 2024.6.2 and stay there until you hear otherwise (which could be 6 months).
  2. Create an automation triggered by home assistant start to reload the integration.
  3. Replace the /usr/local/lib/python3.12/http/cookies.py file and re-replace it after every HA update until python 3.13 is released and HA upgrades to it, with the PR for python 3.13 version which I discovered in my quest for a solution.

The core issue seems to lie in HA's python 3.12 and how AMP interacts with HA core services i.e. http. For some reason yet unknown, AMP initialization is gaining access to/given a partitioned cookie (see CHIPS support in browsers) but is getting a regular cookie when reloaded.

Someone may still discover the reason and a solution for it but it will not be the maintainer of this integration as he has stepped away from it except to review and merge other PR's that people might put forth.

  1. Have alexapy keep a custom version of http with the fix and use that. The downside is that it will be frozen in place moving forward. I haven't looked at cookies and don't intend to, but perhaps an inherited class can provide the functionality temporarily and based on python version.

As noted, I'll review and merge if someone sends a PR.

jondiez commented 3 months ago

AMP doesn't even initialize me. I already put the error above

Menz01 commented 2 months ago

I am having to same issue. After every restart, I have to reload the integration for it to work.

The only solutions so far are...

  1. Revert to 2024.6.2 and stay there until you hear otherwise (which could be 6 months).
  2. Create an automation triggered by home assistant start to reload the integration.
  3. Replace the /usr/local/lib/python3.12/http/cookies.py file and re-replace it after every HA update until python 3.13 is released and HA upgrades to it, with the PR for python 3.13 version which I discovered in my quest for a solution.

The core issue seems to lie in HA's python 3.12 and how AMP interacts with HA core services i.e. http. For some reason yet unknown, AMP initialization is gaining access to/given a partitioned cookie (see CHIPS support in browsers) but is getting a regular cookie when reloaded.

Someone may still discover the reason and a solution for it but it will not be the maintainer of this integration as he has stepped away from it except to review and merge other PR's that people might put forth.

I'd like to try #2 is there a good example of how to do that? the one i read further up this thread looks like its restarting a device but then again... i am the one asking so i am the one admitting i do not know too

Petro31 commented 2 months ago

I am having to same issue. After every restart, I have to reload the integration for it to work.

The only solutions so far are...

  1. Revert to 2024.6.2 and stay there until you hear otherwise (which could be 6 months).
  2. Create an automation triggered by home assistant start to reload the integration.
  3. Replace the /usr/local/lib/python3.12/http/cookies.py file and re-replace it after every HA update until python 3.13 is released and HA upgrades to it, with the PR for python 3.13 version which I discovered in my quest for a solution.

The core issue seems to lie in HA's python 3.12 and how AMP interacts with HA core services i.e. http. For some reason yet unknown, AMP initialization is gaining access to/given a partitioned cookie (see CHIPS support in browsers) but is getting a regular cookie when reloaded. Someone may still discover the reason and a solution for it but it will not be the maintainer of this integration as he has stepped away from it except to review and merge other PR's that people might put forth.

I'd like to try #2 is there a good example of how to do that? the one i read further up this thread looks like its restarting a device but then again... i am the one asking so i am the one admitting i do not know too

here's an example https://github.com/Petro31/home-assistant-config/blob/5e61f118f8854a79b24a5af4ba1adb6ef2341eed/automation/reactions.yaml#L75

Menz01 commented 2 months ago

here's an example https://github.com/Petro31/home-assistant-config/blob/5e61f118f8854a79b24a5af4ba1adb6ef2341eed/automation/reactions.yaml#L75

what i do not understand is the goal is to reload the integration after HA restarts, why are you reloading alexa speaker identity? image

i get everything above that and the bottom partis a notification. i just don't understand the reloading of an alexa device

GitHubGoody commented 2 months ago

Reloading any entity in an integration reloads the entire integration.

cryd-s commented 2 months ago

hm same issue here - need to reload some times after every restart :(

dragorex71 commented 2 months ago

Reloading any entity in an integration reloads the entire integration.

~I solved half of the problem. With the suggested automation i reload the integration so now Alexa can reach HA. If i call Alexa to turn on a light, for example, it does. But in the opposite direction, from HA to Alexa, i steel have problem. Here a screen of an echo device after the reload: image As you can see it is unavailable. The problem is that i have scripts to run alexa's routines that in these conditions don't work.~

EDIT: It was all a different issue, sorry. The automation solves perfectly the problem, attending a definitive solution.

danielbrunt57 commented 2 months ago

here's an example https://github.com/Petro31/home-assistant-config/blob/5e61f118f8854a79b24a5af4ba1adb6ef2341eed/automation/reactions.yaml#L75 what i do not understand is the goal is to reload the integration after HA restarts, why are you reloading alexa speaker identity? > i get everything above that and the bottom partis a notification. i just don't understand the reloading of an alexa device

Reloading an alexa device reloads the config entity for that device which in the case of Alexa Media Player includes all devices in the config entry. The integration does permit installing the integration more than once for different accounts, but most people only have the one.

danielbrunt57 commented 2 months ago

Reloading any entity in an integration reloads the entire integration.

Not completely true as I just outlined but like I said, most people only have one config entry.

danielbrunt57 commented 2 months ago

hm same issue here - need to reload some times after every restart :(

Yes, that is a known issue since HA 2024.6.2...

danielbrunt57 commented 2 months ago

my workaround:

alias: xSYSTEM - Reload Alexa Media Player after HA starts description: Workaround trigger:

platform: homeassistant event: start condition: [] action: delay: hours: 0 minutes: 1 seconds: 0 milliseconds: 0 alias: Reload Alexa Media Player integration service: homeassistant.reload_config_entry data: {} enabled: true target: entity_id: media_player.toilet_echo mode: single



#reload of one device is enough ;-)

That solution has already been posted! Also, please format your posts correctly by surrounding your code with triple back quotes before and after the code on their own line. Or select the code segment and use the editor's <> button to encase the block with triple backquotes.

alias: Home Assistant Startup
description: ""
trigger:
  - platform: homeassistant
    event: start
condition: []
action:
danielbrunt57 commented 2 months ago

hm same issue here - need to reload some times after every restart :(

Use the automation: trigger: homeassistant start method or the cookies.py replacement method.

danielbrunt57 commented 2 months ago

@alandtse I've spent many many hours diagnosing this (much > 12 hours - as that was just my last session!), delving into the dark depths of custom_components/alexa_media and the issue is not there but in the alexapy module that gets loaded in HA, It runs first when HA is starting and that is when the partitioned cookie is encountered which raises the error. HA initializes AMP and almost immediately the error is generated. However, the custom component still continues to load executing its startup tasks, refreshing notify targets, last alexa, etc. finishing with services registered but HA shows the integration as failed and is non-functional, and then HA fires its startup completed. Shortly thereafter, but not immediately, you can reload the integration and then it works. Why the partitioned cookie is no longer an issue at that point remains a mystery to me! If the pickled cookie triggers an error in http cookies then how can the integration even work at all after that and id it can, what's the purpose of the pickled cookie? The reload (on my system) has to be more than 10 seconds after HA fires the startup event. 15 seconds was hit and miss whereas 20 seconds always reloaded. It's quite the intricate, tangled mess which I think is due in part to HA paralleling tasks attempting to reduce startup time?? I've not yet found another integration coded like this one is...

danielbrunt57 commented 2 months ago

This is a WooHoo! moment for me...

image image

I gave up on the partitioned cookie issue and re-replaced cookies.py with the new 3.13 PR version, which I will have to do every week until HA upgrades to it, and returned to coding the enhanced options input.

danielbrunt57 commented 2 months ago

@alantse Please close this as 2 workarounds have been provided. This should self-resolve once Python 3.13 releases in October, and HA eventually upgrades to it.

KennethLavrsen commented 2 months ago

Hacking the code inside the HA docker needed to be repeated every time you upgrade HA. Having an automation to reload after 1 minute. Works. Is horrible. Waiting until October where HA Maybe upgrades Python and that will maybe fix it (we cannot be sure)

Why can't this component be modified so it delays its loading so it works for everyone. All users that do not see this bug report will have no clue. And when you close it - it becomes practically invisible. Users will have an issue, come here to look for open bugs. Find none. Is this component only for geeks?

I do not personally trust that this custom component will exist much longer.

danielbrunt57 commented 2 months ago

@KennethLavrsen

Hacking the code inside the HA docker needed to be repeated every time you upgrade HA.

The cookies.py I found is in a PR for Python 3.13 beta and is not a hack! If you think you can get the core devs to update HA to Python 3.13 beta 4 just for the sake of the Alexa Media Player Integration, or convince them to reverse their code changes back to 2024.6.2, good luck with either of those!

alexapy is installed into the Python 3.12 site-packages in the homeassistant docker container and executes when HA loads. Partitioned cookies (see CHIPS - Allow developers to opt a cookie in to "partitioned" storage, with a separate cookie jar per top-level site.) is becoming a fact of life in Edge/Chrome, Firefox, Safari, etc. aimed at "improving user privacy and security".

I'm not aware of any mechanism to delay an integration from starting other than the "dependencies" in manifest.json and I tried every one I could think of to no avail. If you have concrete suggestions, I'm all ears...

All users that do not see this bug report

All users should check Open & Closed issues. I know I do. But I guess you do not...

I've invested countless hours and sleepless nights over the past few weeks digging inside the code and learning as much as I can about python and the inner workings of HA to try and keep this integration alive. What have you done besides poo-poo it??

If @alandtse concurs this should be left open, I have no objections...

KennethLavrsen commented 2 months ago

You seem miss my points. You need to mobilize some enphathy and try to put yourself in the minds of users that are not Python programmers.

It is an unacceptable hack having to penetrate the HA docker container, patch code and then see it all reverted each time you install a HA patch release which will happen probably 10-12 times before it includes a new Python version. No user can be satisfied with that as an acceptable work around.

The automation work around is acceptable. But you need to know it. You need to be able to find it. And very few will find it if it is hidden as a closed bug. People should not expect having to find information about workarounds about a bug that is still present showing its ugly face for most, probably all users. Why is it important to close the bug? Do you pay money to Github for every open bug? What good does it do to anyone?

I have personally installed 5 Raspberry Pi Zero 2W with Jabra speakers and use these for my house TTS announcements. I expect this integration will die within a few months. Sad. It has worked well for years.

alandtse commented 2 months ago

Ok the tone is getting out of hand. Please remember there are human beings at the other end of the pipes.

As @danielbrunt57 is volunteering to respond to issues and provide code, I've been deferring to him on the close decision frankly because I'm not following the issues closely. I was actually about to provide him contributor privileges to do it without asking me.

That said, we can leave this open. But please keep things civil. I don't have time or the interest to come moderate disputes.

If you're concerned about the integration dying, consider helping out with code, translations, or responding to issues. Otherwise I could see @danielbrunt57 deciding to just avoid the trouble completely.

danielbrunt57 commented 2 months ago

After a 6 hour deep dive inside alexapy, I think I have a solution for the "partitioned" cookie! I reverted my http/cookies.py to the original python 3.12 version and with my edit to alexapy/alexalogin.py, I no longer get the error message and the integration loads without any assistance after a restart.

Is there anyone out there with the issue who is brave enough and proficient enough to edit their file and try it before I commit a PR for alexapy?

/usr/local/lib/python3.12/site-packages/alexapy/alexalogin.py Original Code:

image

My change:

                if isinstance(cookies, RequestsCookieJar):
                    _LOGGER.debug("Loading RequestsCookieJar")
                    cookies = cookies.get_dict()
                    assert cookies is not None
                    for key, value in cookies.items():
                        if self._debug:
                            _LOGGER.debug('Key: "%s", Value: "%s"', key, value)
                        # escape extra quote marks from Requests cookie
                        # also skip the new (2024/06) "partitioned" key so python 3.12 cookies.py doesn't barf!
                        if key != "partitioned":
                            return_cookies[str(key)] = value.strip('"')
                    numcookies = len(return_cookies)
UlrichThiess commented 2 months ago

Ill try. Wait...

danielbrunt57 commented 2 months ago

I also noticed there's a PR from Juan Pablo de Castro Fernández 5 days ago: Allows missing "maintainer" metadata which will solve another issue some users have been having.

image

UlrichThiess commented 2 months ago

Changed back to original cookies.py and restart HA: Problem exists. Changed alexalogin.py and restart HA: no Problems Second restart: no Problems Thrid restart: no Problems

danielbrunt57 commented 2 months ago

Thanks, I've submitted my PR. @alandtse Please see https://gitlab.com/keatontaylor/alexapy/-/merge_requests/376

I'm gonna go have a beer (or two) to celebrate....

wxman60 commented 2 months ago

I was already using the original cookies.py file so I just made the changes to alexalogin.py. Then restarted it 3 times and it started each time on its own. Thanks @danielbrunt57 !

wxman60 commented 2 months ago

Well after a day it stopped working. Don't know why. The change I made is still in the file. I guess I will go back to using my automation to do the reload.

st3v3nFr commented 2 months ago

A weird thing is that i don't have this issue on my side, despite using this cool cutom component for years now.

Krispkiwi commented 2 months ago

I'm getting this also, gonna try the downgrading solution above

Hammerhand17 commented 2 months ago

Weird that my paths are different so I can't try to solve the issue.

I have it in /usr/lib/python3.12/site-packages but I don't have any alexapy folder nor alexalogin.py.

UlrichThiess commented 2 months ago

use Advanced SSH & Web Terminal with enabled Safe Mode then

docker exec -it $(docker ps -f name=homeassistant -q) bash
vi /usr/local/lib/python3.12/site-packages/alexapy/alexalogin.py
Hammerhand17 commented 2 months ago

use Advanced SSH & Web Terminal with enabled Safe Mode then

docker exec -it $(docker ps -f name=homeassistant -q) bash
vi /usr/local/lib/python3.12/site-packages/alexapy/alexalogin.py

Ok, that did the trick. Besides, neither modifying the cookie/making the automation makes my integration work again.

Moreover, I try to uninstall it and nothing happens.

UlrichThiess commented 2 months ago

This is my automation:

alias: Integration Alexa Media Player Reload
description: ""
trigger:
  - platform: homeassistant
    event: start
condition:
  - condition: state
    entity_id: media_player.buro_ug_echo
    state: unavailable
action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
    enabled: false
  - service: homeassistant.reload_config_entry
    metadata: {}
    data: {}
    target:
      entity_id: media_player.buro_ug_echo
mode: single

change media_player.buro_ug_echo into your own media_player.???

Hammerhand17 commented 1 month ago

This is my automation:

alias: Integration Alexa Media Player Reload
description: ""
trigger:
  - platform: homeassistant
    event: start
condition:
  - condition: state
    entity_id: media_player.buro_ug_echo
    state: unavailable
action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
    enabled: false
  - service: homeassistant.reload_config_entry
    metadata: {}
    data: {}
    target:
      entity_id: media_player.buro_ug_echo
mode: single

change media_player.buro_ug_echo into your own media_player.???

Well, now the issue send to be with my installation because I can't uninstall it. Tomorrow I will try again and report if everything works okay. Thanks for your help!

Nope. I achieved to uninstall it but now I receive:

registrador: homeassistant.config_entriesFuente: config_entries.py:2832Ocurri%C3%B3 por primera vez: 16:31:18 (1 ocurrencias)%C3%9Altimo inicio de sesi%C3%B3n: 16:31:18Error occurred loading flow for integration alexa_media: Exception importing custom_components.alexa_media.config_flow

Ok, latest try and I could achieve success. It's working fine. Thanks!

NordFreak commented 1 month ago

use Advanced SSH & Web Terminal with enabled Safe Mode then

docker exec -it $(docker ps -f name=homeassistant -q) bash
vi /usr/local/lib/python3.12/site-packages/alexapy/alexalogin.py

Is this the final solution to the problem?

dragorex71 commented 1 month ago

I was using the automation from the beginning to fix the problem but today I have noticed that it fixes the issue no more.

Well after a day it stopped working. Don't know why. The change I made is still in the file. I guess I will go back to using my automation to do the reload.

raymondjstone commented 1 month ago

Todays update from home assistant changes the use of service in automation so I guess that will be why it no longer works

dragorex71 commented 1 month ago

Todays update from home assistant changes the use of service in automation so I guess that will be why it no longer works

I don't think. They say everything will continue to work just as it did before

danielbrunt57 commented 1 month ago

If anyone is actively using the Python 3.13 cookies.py replacement method to workaround the issue of this post, I've found a way to automate that patch. Let me know if you're interested. What it does is after an HA update & restart, the custom component detects a mismatch in the file, replaces it, and restarts HA.

NordFreak commented 1 month ago

If anyone is actively using the Python 3.13 cookies.py replacement method to workaround the issue of this post, I've found a way to automate that patch. Let me know if you're interested. What it does is after an HA update & restart, the custom component detects a mismatch in the file, replaces it, and restarts HA.

I'm very interested in a good permanent solution. At the moment I'm making do (like most people) by reloading the integration with a time delay after system startup.

The workaround also works reliably, but a solution that doesn't fill up the log with an unnecessary error message would be kind of sexy

hiagocosta commented 1 month ago

If anyone is actively using the Python 3.13 cookies.py replacement method to workaround the issue of this post, I've found a way to automate that patch. Let me know if you're interested. What it does is after an HA update & restart, the custom component detects a mismatch in the file, replaces it, and restarts HA.

I'm very interested too!

jazzmonger commented 1 month ago

reloading the integration no longer fixes this problem. GRRRRRRRRRRRRRRRRRRR.... Core 2024.8.0 Supervisor 2024.08.0