I have created a post in Github as I am a bit desperate to fix it. (Detected blocking call to import_module with args ('homeassistant.components.bluetooth',) · Issue #138016 · home-assistant/core · GitHub). Sorry for duplicating.
I just updated from core-2024.12.5 to core-2025.2.1 and bluetooth component is failing. As bluetooth component is failing, ESPHome is also failing.
Home Assistant OS on RPi4.
I haven’t used bluetooth integration in my setup and don’t plan to use it for now.
I would appreciate all the help I can get as my heating system is controlled through ESPHome. Thanks!
EDIT: Have tried powering it off or on with bluetoothctl power on/off and no changes. Also tried adding or removing bluetooth: to configuration.yaml. Just trying stuff…
[core-ssh ~]$ bluetoothctl power off
Unable to open mgmt_socket
[CHG] Controller DC:A6:32:91:9A:04 PowerState: on-disabling
AdvertisementMonitor path registered
Changing power off succeeded
[CHG] Controller DC:A6:32:91:9A:04 PowerState: off
[CHG] Controller DC:A6:32:91:9A:04 Powered: no
[CHG] Controller DC:A6:32:91:9A:04 Discovering: no
[CHG] Controller DC:A6:32:91:9A:04 Class: 0x00000000 (0)
[core-ssh ~]$ bluetoothctl power on
Unable to open mgmt_socket
[CHG] Controller DC:A6:32:91:9A:04 PowerState: off-enabling
AdvertisementMonitor path registered
2025-02-09 11:43:03.683 ERROR (ImportExecutor_0) [homeassistant.loader] Unexpected exception importing component homeassistant.components.bluetooth
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 1075, 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 "/usr/src/homeassistant/homeassistant/components/bluetooth/__init__.py", line 10, in <module>
from bleak_retry_connector import BleakSlotManager
File "/usr/local/lib/python3.13/site-packages/bleak_retry_connector/__init__.py", line 11, in <module>
from bleak import BleakClient, BleakScanner
File "/usr/local/lib/python3.13/site-packages/bleak/__init__.py", line 50, in <module>
from .backends.client import BaseBleakClient, get_platform_client_backend_type
File "/usr/local/lib/python3.13/site-packages/bleak/backends/client.py", line 22, in <module>
from ..exc import BleakError
SyntaxError: source code string cannot contain null bytes
2025-02-09 11:43:03.705 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to import_module with args ('homeassistant.components.bluetooth',) in /usr/src/homeassistant/homeassistant/loader.py, line 1075: 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 707, in run_until_complete
self.run_forever()
File "/usr/local/lib/python3.13/asyncio/base_events.py", line 678, in run_forever
self._run_once()
File "/usr/local/lib/python3.13/asyncio/base_events.py", line 2033, 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 340, in _async_setup_component
component = await integration.async_get_component()
File "/usr/src/homeassistant/homeassistant/loader.py", line 1027, in async_get_component
comp = self._get_component()
File "/usr/src/homeassistant/homeassistant/loader.py", line 1075, in _get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
2025-02-09 11:43:03.712 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing component homeassistant.components.bluetooth
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 1075, 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 "/usr/src/homeassistant/homeassistant/components/bluetooth/__init__.py", line 10, in <module>
from bleak_retry_connector import BleakSlotManager
File "/usr/local/lib/python3.13/site-packages/bleak_retry_connector/__init__.py", line 11, in <module>
from bleak import BleakClient, BleakScanner
File "/usr/local/lib/python3.13/site-packages/bleak/__init__.py", line 50, in <module>
from .backends.client import BaseBleakClient, get_platform_client_backend_type
File "/usr/local/lib/python3.13/site-packages/bleak/backends/client.py", line 22, in <module>
from ..exc import BleakError
SyntaxError: source code string cannot contain null bytes
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 1015, 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 1086, in _get_component
raise ImportError(f"Exception importing {self.pkg_path}") from err
ImportError: Exception importing homeassistant.components.bluetooth
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 1075, 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 "/usr/src/homeassistant/homeassistant/components/bluetooth/__init__.py", line 10, in <module>
from bleak_retry_connector import BleakSlotManager
File "/usr/local/lib/python3.13/site-packages/bleak_retry_connector/__init__.py", line 11, in <module>
from bleak import BleakClient, BleakScanner
File "/usr/local/lib/python3.13/site-packages/bleak/__init__.py", line 50, in <module>
from .backends.client import BaseBleakClient, get_platform_client_backend_type
File "/usr/local/lib/python3.13/site-packages/bleak/backends/client.py", line 22, in <module>
from ..exc import BleakError
SyntaxError: source code string cannot contain null bytes
2025-02-09 11:43:03.722 ERROR (MainThread) [homeassistant.setup] Setup failed for 'bluetooth': Unable to import component: Exception importing homeassistant.components.bluetooth
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 1075, 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 "/usr/src/homeassistant/homeassistant/components/bluetooth/__init__.py", line 10, in <module>
from bleak_retry_connector import BleakSlotManager
File "/usr/local/lib/python3.13/site-packages/bleak_retry_connector/__init__.py", line 11, in <module>
from bleak import BleakClient, BleakScanner
File "/usr/local/lib/python3.13/site-packages/bleak/__init__.py", line 50, in <module>
from .backends.client import BaseBleakClient, get_platform_client_backend_type
File "/usr/local/lib/python3.13/site-packages/bleak/backends/client.py", line 22, in <module>
from ..exc import BleakError
SyntaxError: source code string cannot contain null bytes
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 1015, 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 1086, in _get_component
raise ImportError(f"Exception importing {self.pkg_path}") from err
ImportError: Exception importing homeassistant.components.bluetooth
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 1075, 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 "/usr/src/homeassistant/homeassistant/components/bluetooth/__init__.py", line 10, in <module>
from bleak_retry_connector import BleakSlotManager
File "/usr/local/lib/python3.13/site-packages/bleak_retry_connector/__init__.py", line 11, in <module>
from bleak import BleakClient, BleakScanner
File "/usr/local/lib/python3.13/site-packages/bleak/__init__.py", line 50, in <module>
from .backends.client import BaseBleakClient, get_platform_client_backend_type
File "/usr/local/lib/python3.13/site-packages/bleak/backends/client.py", line 22, in <module>
from ..exc import BleakError
SyntaxError: source code string cannot contain null bytes
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 340, in _async_setup_component
component = await integration.async_get_component()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1035, in async_get_component
self._component_future.result()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1027, in async_get_component
comp = self._get_component()
File "/usr/src/homeassistant/homeassistant/loader.py", line 1086, in _get_component
raise ImportError(f"Exception importing {self.pkg_path}") from err
ImportError: Exception importing homeassistant.components.bluetooth