Home assistant update fixes (aioesphomeapi, turbojpeg, libpcap and bluetooth config)

First up, thanks for DietPi and the great integrations.

I’ve been experimenting with Home Assistant and recently got a ZBT-2 adapter and some IKEA matter bits and it’s all working really nicely (HA core installed via DietPi and otbr-posix manually compiled and configured, matter-js python matter server docker image).

When upgrading HA I hit a couple of issues, unsure if these are things which are specific to my setup or which it would be helpful to have covered by the DietPi scripts, or indeed if all my approaches were correct. But sharing here in case they’re useful to others, or indeed to me next time I hit them!

(1) New version of pip

Running /opt/homeassistant/homeassistant-update.sh resulted in a message saying a new version of pip was available. So as covered in the docs I did a reinstall with

dietpi-software reinstall 157

(2) Installing ‘aioesphomeapi’

Errors were showing up in Home Assistant UI and in journalctl. Looking at the logs in /opt/homeassistant/.homeassistant/home-assistant.log helped find and troubleshoot them more clearly:

ModuleNotFoundError: No module named 'aioesphomeapi'

This was fixed by installing the Python Client for ESPHome native API which is used by Home Assistant into the home assistant environment with

sudo -u homeassistant uv pip install --directory /opt/homeassistant aioesphomeapi

(3) Installing turbojpeg library

RuntimeError: Unable to locate turbojpeg library automatically. You may specify the turbojpeg library path manually.

I tried a similar install first but that didn’t help, not sure if he first step was needed, but the error went after the second

sudo -u homeassistant uv pip install --directory /opt/homeassistant PyTurboJPEG

sudo apt install libturbojpeg0-dev

(3) Install libpcap

The next error was:

Cannot watch for dhcp packets without a functional packet filter: libpcap is not available. Cannot compile filter !

Another two step approach, again not sure if the first step was needed?

sudo -u homeassistant uv pip install --directory /opt/homeassistant libpcap

sudo apt install libpcap-dev

(4) Correct bluetooth capabilities

The final error in the logs was

Missing required permissions for Bluetooth management: Missing NET_ADMIN/NET_RAW capabilities for Bluetooth management. Automatic adapter recovery is unavailable. Add NET_ADMIN and NET_RAW capabilities to the container to enable it

Which was fixed as follows, some steps were just to find the correct path to the python binary

sudo apt-get install bluez libbluetooth-dev

cd /opt/homeassistant/

source .venv/bin/activate

readlink -f "$(which python3)"

/opt/homeassistant/.local/share/uv/python/cpython-3.14.5-linux-aarch64-gnu/bin/python3.14

sudo setcap 'cap_net_admin,cap_net_raw+eip' /opt/homeassistant/.local/share/uv/python/cpython-3.14.5-linux-aarch64-gnu/bin/python3.14

For context: Missing packages on fresh HomeAssistant installation (with temporary fix) · Issue #8145 · MichaIng/DietPi · GitHub

Thanks and apologies for missing the GitHub thread!

Yesterday I updated Homeassistant on my Dietpi from version 2026.2.0 to 2026.5.4 (yeah, I skipped a few versions during the last months). After this update, none of my dozens of Zigbee and Shelly Wifi devices could be controlled anymore.

I found the error log about the missing aioesphomeapi module in the homeassistant.log file and searched for it here, as I hadn’t heard of any similar upgrade problems from friends who run their HA on non-DietPi devices.

ERROR (MainThread) [homeassistant.setup] Setup failed for 'usb': Unable to import component: No module named 'aioesphomeapi'

Luckily the installation of this missing module in the way described here solved the problems right away.

sudo -u homeassistant uv pip install --directory /opt/homeassistant aioesphomeapi

:smiling_face_with_three_hearts:

Sure, the only officially supported HA instances are AIO Docker containers, which include all dependencies for all integrations, no matter which one is enabled.

It seems there is a quirk about how the USB component is loaded. It does not define aioesphomeapi as requirement: core/homeassistant/components/usb/manifest.json at 840243db9c98ae36031adb39b989389fd8482b10 · home-assistant/core · GitHub
It seems fine on first view, since it does not import it directly. But obviously, it does so indirectly through other components. I am not sure how cross-component dependencies are declared. The only one which imports aioesphomeapi directly is ESPHome, which does declare it as dependency: core/homeassistant/components/esphome/manifest.json at 840243db9c98ae36031adb39b989389fd8482b10 · home-assistant/core · GitHub
But it looks like the order of initialization is wrong or not implicit, so that the USB component is loaded before the ESPHome component has been, while the USB component does import parts of ESPHome.

It might even be a transient issue only, solved by a service restart. Something similar existed in the past, where initialization of some components failed loading some Python modules, but in parallel those Python modules were installed as dependencies of other components. So on service restart, the missing modules were installed already.

You might want to report this to HA devs. Such dependencies are supposed to be installed automatically, in correct order. If the USB component imports from ESPHome, it either needs to assure ESPHome itself has initialized first, or declare all ESPHome dependencies as own dependencies as well, including aioesphomeapi.

Thank you so much for the sharing. I used your suggested commands and now works fine on my RPI4.
I still have issue with RPI3 but I think is linked to much more ram needed now.
Bye
Sandro

Thank you so much for this. My home assistant Homekit integration breaks every time I upgrade and I always come back here to run the commands to fix it.

Glad to hear it’s been of use!

Out of interest what exactly breaks, do you always see the same errors?

Don’t really remember at this point - this is the 2nd time it has happened, so I just come here, run those commands and it’ll work. It’s definitely Bluetooth related, which is strange cause my Aqara FP2 supposedly only needs WiFi.

We recognized here that the HA USB component depended on aioesphomeapi, which was not defined in its metadata. And the Bluetooth component depends on the USB component. Hence without explicitly installing aioesphomeapi, USB and Bluetooth components in HA failed both. Usually, HA components declare their dependencies, so that HA installs them all automatically on startup.

My PR to fix this explains it more in detail: components: usb: complement serialx[esphome] dependency by MichaIng · Pull Request #177267 · home-assistant/core · GitHub

It was however fixed in another better way, which removed the aioesphomeapi dependency entirely: usb: Avoid importing aioesphomeapi in serial proxy stub by AlD · Pull Request #174181 · home-assistant/core · GitHub

This fix is part of stable Home Assistant since more than a months now, so this exact error should not show up anymore. @bruceoutdoors did you face this any recently? Would be great if you could paste the exact error from journalctl -u home-assistent here.

Generally, while it is a workaround only for something that should be fixed in HA component metadata, additional Python dependencies can be defined in dietpi.txt: DietPi/dietpi.txt at bfad9131fbf66e86182d8138af8f6578f882023e · MichaIng/DietPi · GitHub
The (space-separated) list of packages added to SOFTWARE_HOMEASSISTANT_PIP_DEPS= is automatically installed into the HA venv by dietpi-software, when the HA is (re)installed.

Found it:

$ sudo journalctl -u home-assistant.service | grep -A5 -B5 blue
Sep 06 20:11:45 DietPi Home Assistant[2110]: 2026-09-06 20:11:45.238 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of 'homekit_controller'. Setup failed for dependencies: ['bluetooth_adapters']
Sep 06 20:11:45 DietPi Home Assistant[2110]: 2026-09-06 20:11:45.239 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (task: None)
Sep 06 20:11:45 DietPi Home Assistant[2110]: Traceback (most recent call last):
Sep 06 20:11:45 DietPi Home Assistant[2110]:   File "/opt/homeassistant/.venv/lib/python3.14/site-packages/homeassistant/config_entries.py", line 1563, in async_init
Sep 06 20:11:45 DietPi Home Assistant[2110]:     flow, result = await self._async_init(flow_id, handler, context, data)
Sep 06 20:11:45 DietPi Home Assistant[2110]:                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 06 20:11:45 DietPi Home Assistant[2110]:   File "/opt/homeassistant/.venv/lib/python3.14/site-packages/homeassistant/config_entries.py", line 1617, in _async_init
Sep 06 20:11:45 DietPi Home Assistant[2110]:     flow = await self.async_create_flow(handler, context=context, data=data)
Sep 06 20:11:45 DietPi Home Assistant[2110]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 06 20:11:45 DietPi Home Assistant[2110]:   File "/opt/homeassistant/.venv/lib/python3.14/site-packages/homeassistant/config_entries.py", line 1868, in async_create_flow
Sep 06 20:11:45 DietPi Home Assistant[2110]:     handler = await _async_get_flow_handler(
Sep 06 20:11:45 DietPi Home Assistant[2110]:               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 06 20:11:45 DietPi Home Assistant[2110]:         self.hass, handler_key, self._hass_config
Sep 06 20:11:45 DietPi Home Assistant[2110]:         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 06 20:11:45 DietPi Home Assistant[2110]:     )
Sep 06 20:11:45 DietPi Home Assistant[2110]:     ^
Sep 06 20:11:45 DietPi Home Assistant[2110]:   File "/opt/homeassistant/.venv/lib/python3.14/site-packages/homeassistant/config_entries.py", line 4232, in _async_get_flow_handler
Sep 06 20:11:45 DietPi Home Assistant[2110]:     await _load_integration(hass, domain, hass_config)
Sep 06 20:11:45 DietPi Home Assistant[2110]:   File "/opt/homeassistant/.venv/lib/python3.14/site-packages/homeassistant/config_entries.py", line 4209, in _load_integration
Sep 06 20:11:45 DietPi Home Assistant[2110]:     await async_process_deps_reqs(hass, hass_config, integration)
Sep 06 20:11:45 DietPi Home Assistant[2110]:   File "/opt/homeassistant/.venv/lib/python3.14/site-packages/homeassistant/setup.py", line 581, in async_process_deps_reqs
Sep 06 20:11:45 DietPi Home Assistant[2110]:     raise DependencyError(failed_deps)
Sep 06 20:11:45 DietPi Home Assistant[2110]: homeassistant.exceptions.DependencyError: Could not setup dependencies: bluetooth_adapters

Device model : RPi 3 Model B+ (aarch64)

DietPi v10.6.2

So this is a different error, about a different dependency:

@bruceoutdoors
Is there any other error above the ones you pasted? E.g. the bluetooth_adapters component depends on the bluetooth component as well, so probably there is prior error about loading bluetooth, causing the bluetooth_adapters failure. Otherwise, the actual underlying error would be missing in the logs.