home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.31k stars 30.62k forks source link

Homekit integration will not load after upgrade to core-2024.8.2 #124178

Open ngrusz1 opened 2 months ago

ngrusz1 commented 2 months ago

The problem

After upgrading my HA instance to the latest version, I get error messages in my logs related to the homekit integration, and the homekit integration will not start (its status is listed as "not loaded" and there is no way to start it).

When I performed the initial upgrade, I noted the following message from pip at the command line:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
aiohttp-fast-url-dispatcher 0.3.1 requires aiohttp<3.10,>=3.8.5, but you have aiohttp 3.10.3 which is incompatible.

I confirmed that the installed version of aiohttp is now 3.10.3, and the installed version of aiohttp-fast-url-dispatcher is now 0.3.1. If I attempt to downgrade aiohttp back to the previous version of 3.9.5, HA will refuse to start at all (which makes sense as 3.10.3 now appears to be the required version for homeassistant 2024.8.2). I am not actually sure if the incompatible version of the aiohttp-fast-url-dispatcher package is actually causing the homekit integration errors, but I do not usually receive these types of messages from pip during an upgrade so I wanted to note them here. Please see the logs I have included from HA for the full homekit start-up errors.

What version of Home Assistant Core has the issue?

core-2024.8.2

What was the last working version of Home Assistant Core?

core-2024.7.4

What type of installation are you running?

Home Assistant Core

Integration causing the issue

homekit

Link to integration documentation on our website

https://www.home-assistant.io/integrations/homekit/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.util.loop
Source: util/loop.py:77
First occurred: 2:04:25 PM (1 occurrences)
Last logged: 2:04:25 PM

Detected blocking call to import_module with args ('homeassistant.components.homekit',) in /home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/homeassistant/loader.py, line 1067: ComponentProtocol, importlib.import_module(self.pkg_path) inside the event loop; This is causing stability issues. Please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#import_module Traceback (most recent call last): File "/home/homeassistant/srv/homeassistant/bin/hass", line 8, in <module> sys.exit(main()) File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/homeassistant/__main__.py", line 209, in main exit_code = runner.run(runtime_conf) File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 672, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 639, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1985, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/homeassistant/setup.py", line 165, in async_setup_component result = await _async_setup_component(hass, domain, config) File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/homeassistant/setup.py", line 334, in _async_setup_component component = await integration.async_get_component() File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/homeassistant/loader.py", line 1019, in async_get_component comp = self._get_component() File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/homeassistant/loader.py", line 1067, in _get_component ComponentProtocol, importlib.import_module(self.pkg_path)

Logger: homeassistant.loader
Source: loader.py:1067
First occurred: 2:04:25 PM (2 occurrences)
Last logged: 2:04:25 PM

Unexpected exception importing component homeassistant.components.homekit
Traceback (most recent call last):
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/homeassistant/loader.py", line 1067, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/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 "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/homeassistant/components/homekit/__init__.py", line 84, in <module>
    from . import (  # noqa: F401
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/homeassistant/components/homekit/type_cameras.py", line 34, in <module>
    from .accessories import TYPES, HomeAccessory, HomeDriver
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/homeassistant/components/homekit/accessories.py", line 10, in <module>
    from pyhap.accessory_driver import AccessoryDriver
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/pyhap/accessory_driver.py", line 53, in <module>
    from pyhap.hap_server import HAPServer
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/pyhap/hap_server.py", line 11, in <module>
    from .hap_protocol import HAPServerProtocol
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/pyhap/hap_protocol.py", line 16, in <module>
    from .hap_crypto import HAPCrypto
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/pyhap/hap_crypto.py", line 8, in <module>
    from chacha20poly1305_reuseable import ChaCha20Poly1305Reusable as ChaCha20Poly1305
  File "src/chacha20poly1305_reuseable/__init__.py", line 21, in init chacha20poly1305_reuseable
AttributeError: module 'lib' has no attribute 'EVP_CIPHER_CTX_ctrl'

Logger: homeassistant.setup
Source: setup.py:334
First occurred: 2:04:25 PM (1 occurrences)
Last logged: 2:04:25 PM

Setup failed for 'homekit': Unable to import component: Exception importing homeassistant.components.homekit
Traceback (most recent call last):
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/homeassistant/loader.py", line 1067, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/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 "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/homeassistant/components/homekit/__init__.py", line 84, in <module>
    from . import (  # noqa: F401
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/homeassistant/components/homekit/type_cameras.py", line 34, in <module>
    from .accessories import TYPES, HomeAccessory, HomeDriver
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/homeassistant/components/homekit/accessories.py", line 10, in <module>
    from pyhap.accessory_driver import AccessoryDriver
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/pyhap/accessory_driver.py", line 53, in <module>
    from pyhap.hap_server import HAPServer
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/pyhap/hap_server.py", line 11, in <module>
    from .hap_protocol import HAPServerProtocol
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/pyhap/hap_protocol.py", line 16, in <module>
    from .hap_crypto import HAPCrypto
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/pyhap/hap_crypto.py", line 8, in <module>
    from chacha20poly1305_reuseable import ChaCha20Poly1305Reusable as ChaCha20Poly1305
  File "src/chacha20poly1305_reuseable/__init__.py", line 21, in init chacha20poly1305_reuseable
AttributeError: module 'lib' has no attribute 'EVP_CIPHER_CTX_ctrl'

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

Traceback (most recent call last):
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/homeassistant/loader.py", line 1007, 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 "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/homeassistant/loader.py", line 1078, in _get_component
    raise ImportError(f"Exception importing {self.pkg_path}") from err
ImportError: Exception importing homeassistant.components.homekit

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/homeassistant/loader.py", line 1067, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/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 "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/homeassistant/components/homekit/__init__.py", line 84, in <module>
    from . import (  # noqa: F401
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/homeassistant/components/homekit/type_cameras.py", line 34, in <module>
    from .accessories import TYPES, HomeAccessory, HomeDriver
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/homeassistant/components/homekit/accessories.py", line 10, in <module>
    from pyhap.accessory_driver import AccessoryDriver
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/pyhap/accessory_driver.py", line 53, in <module>
    from pyhap.hap_server import HAPServer
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/pyhap/hap_server.py", line 11, in <module>
    from .hap_protocol import HAPServerProtocol
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/pyhap/hap_protocol.py", line 16, in <module>
    from .hap_crypto import HAPCrypto
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/pyhap/hap_crypto.py", line 8, in <module>
    from chacha20poly1305_reuseable import ChaCha20Poly1305Reusable as ChaCha20Poly1305
  File "src/chacha20poly1305_reuseable/__init__.py", line 21, in init chacha20poly1305_reuseable
AttributeError: module 'lib' has no attribute 'EVP_CIPHER_CTX_ctrl'

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

Traceback (most recent call last):
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/homeassistant/setup.py", line 334, in _async_setup_component
    component = await integration.async_get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/homeassistant/loader.py", line 1027, in async_get_component
    self._component_future.result()
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/homeassistant/loader.py", line 1019, in async_get_component
    comp = self._get_component()
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/srv/homeassistant_python3-12-2/lib/python3.12/site-packages/homeassistant/loader.py", line 1078, in _get_component
    raise ImportError(f"Exception importing {self.pkg_path}") from err
ImportError: Exception importing homeassistant.components.homekit

Additional information

No response

home-assistant[bot] commented 2 months ago

Hey there @bdraco, mind taking a look at this issue as it has been labeled with an integration (homekit) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `homekit` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign homekit` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


homekit documentation homekit source (message by IssueLinks)

ngrusz1 commented 2 months ago

While investigating these errors, I see that the documentation for the aiohttp-fast-url-dispatcher package has been updated to note that this package is obsolete with versions of aiohttp >3.10. So this error seems to be a coincidence, and is presumably unrelated to the homekit issue.

If it helps, I have the following versions of homekit packages installed:

andbad commented 2 months ago

I also have this error since I upgraded to 2024.8.0.

By(t)e

andbad commented 2 months ago

This solution worked for me: https://github.com/esphome/aioesphomeapi/pull/910

By(t)e

andbad commented 2 months ago

This solution worked to me: https://github.com/esphome/aioesphomeapi/pull/910

By(t)e

ngrusz1 commented 2 months ago

Thanks @andbad! I tried the update again, and noticed that while the cryptography package was automatically updated to 43.0.0, the chacha20poly1305-reuseable package was not automatically updated and remained at version 0.12.1. I manually updated this package (by doing pip install --upgrade chacha20poly1305-reuseable) and this forced the package to update to the most up-to-date version of 0.13.2 (as noted in the ticket at https://github.com/esphome/aioesphomeapi/pull/910).

This fixed the problem for me. I no longer receive the errors noted above when starting HA, and my homekit integration now appears to load successfully.

I suppose the next step is -- what needs to be done to fix this for The People? Why doesn't the chacha20poly1305-reuseable package update automatically with all of the rest of the packages? Perhaps it needs to be made a requirement for some other package?

andbad commented 2 months ago

I'm sorry, I don't know ho to fix for everyone. I think that @bdraco can help us.

By(t)e

sushantjaipuria commented 2 months ago

I’m having a similar problem. My Apple home keeps showing that the homebridge isn’t responding. It was working fine till yesterday, but not today. I updated my core to version 2024.8.3 yesterday.