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.