Skip to content

Integration fails to load after HA upgrade to core 2025.5.3 #331

@skruehoetl

Description

@skruehoetl

The problem

After upgrading the HomeAssistant (OS) Core to 2025.5.3 the victron integration fails to load.
Two errors are shown in the log:

  • Setup failed for custom integration 'victron': Unable to import component: cannot import name 'pack_bitstring' from 'pymodbus.pdu.pdu' (/usr/local/lib/python3.13/site-packages/pymodbus/pdu/pdu.py)
  • Detected blocking call to import_module with args ('custom_components.victron',) in /usr/src/homeassistant/homeassistant/loader.py, line 1053

While the 1st looks like some environment incompatibility (something about pymodbus versions?), the second one sounds like an error in HA itself, which doesn't really make sense to me.

Environment

  • Home Assistant Core release with the issue: 2025.5.3
  • Last working Home Assistant Core release (if known): 2025.5.2
  • Integration version causing this issue: 0.5.0

Problem-relevant configuration dialog

I can no longeraccess the configuration since the integration won't load, so I can screenshot the "not loaded" error message (in German locale).

Image

Traceback/Error logs

1st log entry:

Logger: homeassistant.setup
Quelle: setup.py:344
Erstmals aufgetreten: 23:15:58 (1 Vorkommnis)
Zuletzt protokolliert: 23:15:58

Setup failed for custom integration 'victron': Unable to import component: cannot import name 'pack_bitstring' from 'pymodbus.pdu.pdu' (/usr/local/lib/python3.13/site-packages/pymodbus/pdu/pdu.py)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 993, in async_get_component
    comp = await self.hass.async_add_import_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        self._get_component, True
        ^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1053, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 201, in protected_loop_func
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.13/importlib/__init__.py", line 88, 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 1026, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/victron/__init__.py", line 10, in <module>
    from .coordinator import victronEnergyDeviceUpdateCoordinator as Coordinator
  File "/config/custom_components/victron/coordinator.py", line 11, in <module>
    from pymodbus.payload import BinaryPayloadDecoder
  File "/usr/local/lib/python3.13/site-packages/pymodbus/payload.py", line 22, in <module>
    from pymodbus.pdu.pdu import (
    ...<2 lines>...
    )
ImportError: cannot import name 'pack_bitstring' from 'pymodbus.pdu.pdu' (/usr/local/lib/python3.13/site-packages/pymodbus/pdu/pdu.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 344, in _async_setup_component
    component = await integration.async_get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1013, in async_get_component
    self._component_future.result()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1005, in async_get_component
    comp = self._get_component()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1053, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 201, in protected_loop_func
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.13/importlib/__init__.py", line 88, 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 1026, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/victron/__init__.py", line 10, in <module>
    from .coordinator import victronEnergyDeviceUpdateCoordinator as Coordinator
  File "/config/custom_components/victron/coordinator.py", line 11, in <module>
    from pymodbus.payload import BinaryPayloadDecoder
  File "/usr/local/lib/python3.13/site-packages/pymodbus/payload.py", line 22, in <module>
    from pymodbus.pdu.pdu import (
    ...<2 lines>...
    )
ImportError: cannot import name 'pack_bitstring' from 'pymodbus.pdu.pdu' (/usr/local/lib/python3.13/site-packages/pymodbus/pdu/pdu.py)

2nd log entry

Logger: homeassistant.util.loop
Quelle: util/loop.py:77
Erstmals aufgetreten: 23:15:58 (1 Vorkommnis)
Zuletzt protokolliert: 23:15:58

Detected blocking call to import_module with args ('custom_components.victron',) in /usr/src/homeassistant/homeassistant/loader.py, line 1053: 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 "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/__main__.py", line 227, in <module> sys.exit(main()) File "/usr/src/homeassistant/homeassistant/__main__.py", line 213, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 154, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.13/asyncio/base_events.py", line 706, in run_until_complete self.run_forever() File "/usr/local/lib/python3.13/asyncio/base_events.py", line 677, in run_forever self._run_once() File "/usr/local/lib/python3.13/asyncio/base_events.py", line 2034, in _run_once handle._run() File "/usr/local/lib/python3.13/asyncio/events.py", line 89, in _run self._context.run(self._callback, *self._args) File "/usr/src/homeassistant/homeassistant/setup.py", line 171, in async_setup_component result = await _async_setup_component(hass, domain, config) File "/usr/src/homeassistant/homeassistant/setup.py", line 344, in _async_setup_component component = await integration.async_get_component() File "/usr/src/homeassistant/homeassistant/loader.py", line 1005, in async_get_component comp = self._get_component() File "/usr/src/homeassistant/homeassistant/loader.py", line 1053, in _get_component ComponentProtocol, importlib.import_module(self.pkg_path)

In case of unit ID issue, missing devices or non-updating devices

Additional information

I recently installed the "Solvis Control" integration which also accesses via modbus, so I suspected incompatible library versions. However, the system was working without an error message after the Solvis Control install and reboot. It was not until the 2025.5.3 upgrade that the issue started

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugfixInconsistencies or issues which will cause a problem for users or implementors.staleThere has not been activity on this issue or PR for quite some time.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions