hahomematic: Error Loading Integration - cannot import name 'CALLBACK_TYPE' from 'hahomematic.const

I agree to the following

  • I have read the documentation right now
  • I have read the FAQs right now
  • I am aware of the latest release notes
  • I am aware that an integration that was installed via HACS also needs to be updated via HACS
  • The Backend (CCU/Homegear/…) is working as expected, devices are taught in and are controllable by its own UI.
  • I am running the latest version of the custom_component (and Home Assistant)

The problem

Since upgrading the Integration from an old Version to the newest 1.63.1 I cannot get it to load. I got the same error since approx. Version 1.54 so I was waiting and using the old Version. Unfortunately i cannot get back to the old Version because the oldest one in HACS is 1.60.1 now.

The Error:

Logger: homeassistant.setup
Quelle: setup.py:322
Erstmals aufgetreten: 15:23:23 (1 Vorkommnisse)
Zuletzt protokolliert: 15:23:23

Setup failed for custom integration 'homematicip_local': Unable to import component: cannot import name 'CALLBACK_TYPE' from 'hahomematic.const' (/config/deps/lib/python3.12/site-packages/hahomematic/const.py)
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 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/homematicip_local/__init__.py", line 25, in <module>
    from .control_unit import ControlConfig, ControlUnit, get_storage_folder
  File "/config/custom_components/homematicip_local/control_unit.py", line 15, in <module>
    from hahomematic.const import (
ImportError: cannot import name 'CALLBACK_TYPE' from 'hahomematic.const' (/config/deps/lib/python3.12/site-packages/hahomematic/const.py)

During handling of the above exception, another exception occurred:

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 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/homematicip_local/__init__.py", line 25, in <module>
    from .control_unit import ControlConfig, ControlUnit, get_storage_folder
  File "/config/custom_components/homematicip_local/control_unit.py", line 15, in <module>
    from hahomematic.const import (
ImportError: cannot import name 'CALLBACK_TYPE' from 'hahomematic.const' (/config/deps/lib/python3.12/site-packages/hahomematic/const.py)

Any Help is appreciated.

What version of HomematicIP (local) has the issue?

1.63.1

What was the last working version of HomematicIP (local)?

1.54.0

What type of installation are you running?

Home Assistant OS

What type of installation are you running for your homematic backend?

RaspberryMatic HA-Addon

Which version of your homematic backend are you running?

3.75.7.20240601

What hardware are you running for your system?

Pi5

Which config details do you use

  • TLS
  • callback data (see)

Which interfaces do you use?

  • Homematic IP
  • Homematic (Bidcos-RF)
  • Groups (Heating-Group)
  • BidCos-Wired (HM-Wired)

Diagnostics information (no logs here)

No response

Log file extract. Anything in the logs that might be useful for us? The log (Setting/System/Logs -> load full log) is the best source to support trouble shooting!

No response

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 27 (14 by maintainers)

Most upvoted comments

The Contents of the “/config/deps” on my System are as follows:

  • deps
    • lib
      • python3.12
        • site-packages
          • “many dirs” - also some “hahomematic” dirs with files in it
      • python3.11
        • site-packages
          • “many dirs” - also some “hahomematic” dirs with files in it
      • python3.10
        • site-packages
          • “many dirs” - also some “hahomematic” dirs with files in it
    • bin
      • icalendar (file)

I deleted “/config/deps/lib/python3.12/site-packages/hahomematic/” uploaded Version 1.59.0 of the Integration it is working 👍 I replaced Version 1.59.0 with the newest HACS Install and it is also working fine.

Thank you very much. 👍 Now I maybe need to find out why these folders are populated?

I wonder why your system tries to load dependencies from /config/deps . The directory is always empty on my machines.

If there is something in there, then you should min. delete /config/deps/lib/python3.12/site-packages/hahomematic/