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
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
May I ask why you add
homeassistant/home-assistant.log*, .homeassistant/tts, .homeassistant/deps, .homeassistant/.db-wal & .homeassistant/.db-shm to /opt/.xfiletool.lst
and
Add .homeassistant/history.db*
to /opt/.xfiletool.lst
it kind of results into linux not backing up any history data, am I correct?
(For me it resulted into hass not retrieving the history data.)
Also it looks like it impacts dependencies, as I see now that a number of integrations to fail on restart (I have to manually reload them to work)
I was thinking about removing these from the file, what would be the impact?
would it be an option to save the history db in
etc/sysconfig/tcedir/persistent/uv
Would it then stay after reboots and not need backup?
Excuse all my questions, I am just trying to learn :-)