This is a revisit of https://gist.github.com/BillyNate/d3124edfa903f288bfc8b7f37a155971, but using some different methods.
These are the steps taken to have Home Assistant 2025.7.1 with Python 3.13 on piCore 16
Newer version might work as well (or maybe even better), but have not been tested.
Follow steps of Basic setup of TinyCore/PiCore on a Raspberry Pi
- Install dependencies:
tce-load -wi squashfs-tools - Download, untar, pack, install & cleanup:
mkdir -p ./tmp/usr/local/bin && \ wget https://github.com/astral-sh/uv/releases/latest/download/uv-aarch64-unknown-linux-musl.tar.gz && \ tar xvf uv-aarch64-unknown-linux-musl.tar.gz -C ./tmp/usr/local/bin --strip-components=1 && \ mksquashfs ./tmp /etc/sysconfig/tcedir/optional/uv.tcz && \ echo "uv.tcz" >> /etc/sysconfig/tcedir/onboot.lst && \ tce-load -i uv && \ rm -rf ./tmp uv-aarch64-unknown-linux-musl.tar.gz - UV should now be available:
uv --version - Create persistent UV directory (this goes against the "RAM only", but is our best option):
mkdir -p /etc/sysconfig/tcedir/persistent/uv && \ mkdir ~/.local/share && \ ln -s /etc/sysconfig/tcedir/persistent/uv ~/.local/share/uv - Make sure UV's cache is also in the persistent directory:
- Create
/etc/profile.d/uv.shand addexport UV_CACHE_DIR="$HOME/.local/share/uv/cache" - Add
/etc/profile.d/uv.shto/opt/.filetool.lst - Run
source /etc/profile.d/uv.sh
- Create
- Save:
backup
- Install Python 3.13 through UV:
uv python install 3.13 - Test:
uv run python --version
- Install dependencies:
tce-load -wi compiletc rust bluez openssl-dev openjpeg-dev autoconf ffmpeg libjpeg-turbo-dev - Install Home Assistant:
uv tool install homeassistant(or usehomeassistant==2025.7.1for a specific version) - Save:
backup(only because~/.local/bin/hassis created) - Run Home Assistant once:
uv tool run --from homeassistant hass -v --skip-pip, this generates the needed configuration - Create persistent custom components directory:
mkdir -p /etc/sysconfig/tcedir/persistent/custom_components && \ ln -s /etc/sysconfig/tcedir/persistent/custom_components ~/.homeassistant/custom_components - Optionally: Disable Cloud (Nabu Casa):
- Remove
default_configfrom~/.homeassistant/configuration.yaml - Install Mostly Default Config as
custom_component(see Install HACS on how to install a custom component) - Update
configuration.yaml:mostly_default_config: exclude: - cloud - ...
- Remove
- Run Home Assistant again:
uv tool run --from homeassistant hass -vand let it install the needed integrations. Once it says "Starting Home Assistant" it's finished! - Open the web interface and create your basic config. Once done exit through
Developer tools->Services->Home Assistant Core Integration: Stop - Clean up the home directory as much as possible
- Add
.homeassistant/home-assistant.log*,.homeassistant/tts,.homeassistant/deps,.homeassistant/*.db-wal&.homeassistant/*.db-shmto/opt/.xfiletool.lst - Have Home Assistant start on boot:
- Create startup script
/opt/hassboot.shcontainingsu - tc -c "uv tool run --from homeassistant hass -c /home/tc/.homeassistant" - Turn startup script into executable:
sudo chmod +x /opt/hassboot.sh - Add
/opt/hassboot.sh &to/opt/bootlocal.shin order to have Home Assistant auto start at boot
- Create startup script
- Save:
backup
- Install iptables:
tce-load -wi iptables - Prepend
iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8123to/opt/hassboot.sh - Save:
backup
Home Assistant records data and keeps it in the home-assistant_v2.db file, which keeps on growing in size. To keep user data backups small the recorder data can be kept in a seperate file, not saved on backups:
- Update
~/.homeassistant/configuration.yamlto keep recorder data in seperate file:recorder: db_url: sqlite:////home/tc/.homeassistant/history.db - Add
.homeassistant/history.db*to/opt/.xfiletool.lst - Save:
backup
It's also possible to set the db_url to a remote (MariaDB for example) location
- Install unzip:
tce-load -wi unzip - Download latest package:
wget https://github.com/hacs/integration/releases/latest/download/hacs.zip - Create directory:
mkdir -p ~/.homeassistant/custom_components/hacs - Unzip package:
unzip hacs.zip -d ~/.homeassistant/custom_components/hacs - Clean up the home directory
- Restart Home Assistant
- Go to
Settings>Devices & services>Add integration, and add HACS - Check if everything is installed correctly
- Save:
backup
- Install Mosquitto:
tce-load -wi mosquitto - Create Mosquitto config directory:
mkdir ~/.mosquitto - Create a password file:
mosquitto_passwd -c ~/.mosquitto/pwfile hass(changehassto any username you want) - Create a config at
~/.mosquitto/mosquitto.confcontaining:
connection_messages true
allow_anonymous false
password_file /home/tc/.mosquitto/pwfile
listener 1883
- Test:
mosquitto -c ~/.mosquitto/mosquitto.conf - If everything's good, add to boot:
- Create startup script
/opt/mosqboot.shcontainingsu - tc -c "mosquitto -c /home/tc/.mosquitto/mosquitto.conf -d" - Turn startup script into executable:
sudo chmod +x /opt/mosqboot.sh - Add
/opt/mosqboot.sh &to/opt/bootlocal.shin order to have Home Assistant auto start at boot
- Create startup script
- Save:
backup
If Home Assistant needs to be updated later on:
- Stop the running Home Assistant process
- Upgrade:
uv tool upgrade homeassistant - Save:
backup - Reboot:
sudo reboot
I try to keep the back-up as small as possible for speedy back-ups and quicker boot ups.
This I why I don't like to have logs in the back-up, nor other temporary created files.
The history will only be lost after a reboot. But if you reboot (or maybe hard reset the Pi), without performing a back-up first, the restored history will be outdated anyway. So I see no advantage to adding the history to the back-up.
You could create another persistent directory with a symlink to keep the history.db file. Keep in mind the history.db file gets frequent writes, so this might wear out the micro-sd over time (highly dependent on the quality of the card).
(Personally I'm thinking about running a small SQL server on another Pi to store databases for several applications including the HA history)
I have not experienced integrations to fail because of files missing from the back-up. But we probably don't use the same integrations.
If you feel you need keep any of these files in the back-up, you should do so; it won't do any harm
You might want to take a look at the HA logs to find clues about why some integrations fail to start. 😉
Don't worry about the questions, that's fine. My apologies for being so slow to answer 🫣