Experimentation install of Homeassistiant on a Zero 2W
I have a few more things I want to experiment with on Homeassistant and some with ESPHome. Having unused stuff on my primary Homeassistant starts to annoy me, so I will install Homeassistant on a Raspberry PI Zero 2W for short term experimentation.
I will not use the installation instructions for Raspberry PIs on the Homeassistant site. Mainly because I generate my Raspberry PI images with Ansible and want to use one of these images as starting point.
Because Homeassistant requires Python 3.12 and the default on the current Raspberry PI OS is Python 3.11, I chose to use Docker and not run Homeassistant via systemd. So my starting point is Install Home Assistant Container.
I am aware that the Zero 2W has not enough RAM, so a swapfile is probably a good idea. Raspberry PI seems to have a default way to handle swap (dphys-swapfile), but I want to use the same way I use on other systems, so I ignore that there is already an existing swap with 200M as default.
All commands for future me:
# get system up to date sudo apt-get update && sudo apt-get upgrade -y # add 1GB of swap sudo fallocate -l 1G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile sudo swapon --show # register in fstab to persist for next boot echo "/swapfile none swap sw 0 0" | sudo tee -a /etc/fstab # install docker curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh # sudo every time is fine for me sudo docker ps
This is the compose file from the Homeassistant instructions with only the config line modified:
services: homeassistant: container_name: homeassistant image: "ghcr.io/home-assistant/home-assistant:stable" volumes: - /home/pi/.homeassistant:/config - /etc/localtime:/etc/localtime:ro - /run/dbus:/run/dbus:ro restart: unless-stopped privileged: true network_mode: host
Finally use the docker-compose.yml to start Homeassistant:
# pull image sudo docker compose pull # run it (in the background) sudo docker compose up -d # to view logs sudo docker compose logs -f
The container runs in host mode, so it is visible in the local network.
A http://<ip-address-of-pi>:8123
works for me.
Then follow the onboarding.
For me my ESPHome devices were found at the end of the onboarding and I installed some of them to have some data in.
My dashboard looks like this after the setup:
This feels like a good starting point for further Homeassistant experiments.