Raspberry Pi 0 W

That’s weird. I’ve exactly the same model with newest bullseye raspbian img and it’s not working here.
Well, I don’t think that this is a good basis anymore for a new installation and will go for a newer pi.

It was never really a viable platform for HA, unless you only have a couple of switches or so. I use it for development. It’s not entirely trivial to get HA to work on it though. You need to compile Python from scratch and when you install HA and dependencies with pip, you will have to build a lot of packages too (which can take a long time), as ARMv6 wheels may not be available. But it does work.

Hey @HeyImAlex … would you be so kind to share your “install” script if you have … to compile it? I have a rpi0-w and I tried myself to compile python… but as you indicated … got stuck when OS didn’t like the upgrade from Python3.9 to Python3.11.

I have tried HASS OS, Conainer Installation … but non of them would be for “decent testing” after few hours/days… everything becames laggy … taking few seconds to switch on/off lights (I guess doesn’t like the docker overload). I had the rpi0-w running for few years without any problem. Then I thought about updating it … and now I got stuck.

I would like to have at least a “running” version that has at least the HACKS integration, but since the “Core” version does not work now after 2022.6.7 … HACKS requires 2022.11.x if I remember properly.

From the Core installation I saw that the latest version “supported” by Python3.9 would be the 2023.1.7 … but somehow as indicated here … is throwing the “Illegal instruction” exception.

Thanks :wink:

I don’t really have a fixed script. I just deal with problems as they come up. There’s lots of small stuff to deal with on the Pi Zero :slight_smile:

First you need to install Python 3.10. A lot of the tutorials you will find on the net about how to do this will fail on the Pi Zero, because it doesn’t have enough resources to compile Python with link time code generation and profile guided optimization. So you need to build it using a more conventional process.

Get the Python sources and untar. I used 3.10.9:

wget www.python.org/ftp/python/3.10.9/Python-3.10.9.tgz
tar xvzf ./Python-3.10.9.tgz
cd Python-3.10.9/

Configure and compile (do not use LTO or it will crash). This will take a very long time.

./configure --with-system-expat --with-system-ffi --without-ensurepip --enable-loadable-sqlite-extensions
make CFLAGS="-fno-semantic-interposition" EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"

You may have to install some dependencies or the build process may fail. I don’t remember which. This is a dev system, there’s tons of stuff I installed on there previously. Usually configure will tell you if dependency is missing. If so, install it with apt and try again.

When successfully compiled, install and test if it works.

sudo make altinstall
python3.10 --version

Next, install Rust and Cargo (see https://rustup.rs/). This is required to build some HA packages that do not have binaries for ARMv6.

Once that works you can create your venv (using the python3.10 explicitly) and install HA over pip, as usual. It may fail with missing dependencies, you may have to install those as they come up. This is also going to take quite a while, but not as long as compiling Python.

Don’t do that on a Pi Zero. It has so little memory, the overhead from containerization alone is going to kill the poor little thing.

Cool sir … much appreciated. Will try to “collect” requirements in the process … and I’ll share them here.
Thanks for your fast reponse

Can someone please link their old image

Hi. I tryed all steps @dudusandi but I get same error like yours. I try to solve this problem and find a solution like this. First uninstall homeassistant.

pip3 uninstall homeassistant

` when its done, use

pip install homeassistant==2021.7.0

` command to install older version of homeassistant. After installation done, use " hass -v " code and continue @dudusandi 's tutorial. (after hass -V code)

They changed method for install, i’m recommend use Docker install method, works perfect, more fast and stable… Install time is only 15minutes on docker. Best then 4 hours of systemD method. And you can use latest version of homeassistant.

I tried Home Assistant in Docker and it works perfect! I wrote a script if you want to use it save as “installha.sh” and run as user “bash installha.sh” it will install docker, hacs, homeassistant and an docker container update script for home assistant on an fresh Raspberry Pi Os Lite.

#!/bin/bash

# Check if the script is being run with sudo
if [ "$EUID" -eq 0 ]; then
    USERNAME="$SUDO_USER"
else
    USERNAME="$USER"
fi

# Update Raspberry Pi OS
sudo apt-get update
sudo apt-get -y upgrade

# Install Docker
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
sudo apt-get -y install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/raspbian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/raspbian \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# Install Home Assistant dependencies and create config folder
sudo apt-get -y install libseccomp2
mkdir /home/"$USERNAME"/homeassistant

# Install Home Assistant Docker
sudo docker run -d \
	--name homeassistant \
	--privileged \
	--restart=unless-stopped \
	-e TZ=Europe/Berlin \
	-v /home/"$USERNAME"/homeassistant:/config \
	-v /run/dbus:/run/dbus:ro \
	--network=host \
	ghcr.io/home-assistant/home-assistant:stable

# Install HACS
sleep 60
cd /home/"$USERNAME"/homeassistant
wget -O - https://get.hacs.xyz | bash -

# Create Home Assistant Update script
cat << 'EOF' | tee /home/"$USERNAME"/ha_update.sh > /dev/null
#!/bin/bash

# Check if the script is being run with sudo
if [ "$EUID" -eq 0 ]; then
    USERNAME="$SUDO_USER"
else
    USERNAME="$USER"
fi

# Pull the Home Assistant container
if ! sudo docker pull ghcr.io/home-assistant/home-assistant:stable | grep -q -e 'Status: Image is up to date'; then
    echo "New image available. Proceeding with container setup..."
    
    # Stop any existing container
    sudo docker stop homeassistant

    # Remove the stopped container
    sudo docker rm homeassistant

    # Run the Home Assistant container
    sudo docker run -d \
        --name homeassistant \
        --privileged \
        --restart=unless-stopped \
        -e TZ=Europe/Berlin \
        -v /home/"$USERNAME"/homeassistant:/config \
	-v /run/dbus:/run/dbus:ro \
        --network=host \
        ghcr.io/home-assistant/home-assistant:stable
else
    echo "No new image available. Home Assistant is up to date."
fi
EOF

# Make ha_update.sh executeable
sudo chmod +x /home/"$USERNAME"/ha_update.sh

echo
echo "Installed Home Assistant Docker"
echo

exit 0
2 Likes

You are amazing, thank you

It is really cute! You is the best. Installed it on rpi0 1 and miplant sensor was added automatically!

Could you make the same script for installing mosquito in a docker ?

Works fine. Thanks a lot. I was really waiting for this solution for a small HA project.
I am only missing the Add-ons menu, so I cannot add File editor or Terminal.
Is there a remedy for that?
At this moment I need to edit the YAML files via a remote SSH Putty session.