Skip to content

Instantly share code, notes, and snippets.

@BillyNate
Last active August 9, 2025 21:04
Show Gist options
  • Select an option

  • Save BillyNate/d3124edfa903f288bfc8b7f37a155971 to your computer and use it in GitHub Desktop.

Select an option

Save BillyNate/d3124edfa903f288bfc8b7f37a155971 to your computer and use it in GitHub Desktop.
Home Assistant setup on Raspberry Pi with TinyCore Linux (RAM only OS)

Home Assistant setup on Raspberry Pi with TinyCore Linux (RAM only OS)

‼️ ‼️ ‼️
A rewrite of this guide, using different methods, is now available at gist.github.com/BillyNate/856f62dfc480506e0116220bf24b01b4.
This guide is only kept for archival purposes.
‼️ ‼️ ‼️

These are the steps taken to have Home Assistant 2024.2 on piCore 14
Newer version might work as well (or maybe even better), but have not been tested.

Set up piCore

  1. Download the piCore image
  2. Unpack the .zip file and write the .img file to the SD-Card (using USB Image Tool for example)
  3. Move the SD-Card to the Pi, plug the Pi into the network and plug in the power source
  4. SSH into the Pi (using Putty for example)
    Login using tc / piCore
  5. Execute backup shell command after the first boot to save generated unique SSH keys which will be used during next boots.
  6. Expand the partition:
    1. Start the partition tool: sudo fdisk -u /dev/mmcblk0
    2. List partitions with p command and write down the StartLBA and EndLBA of the second partition
    3. Delete second partition with d than recreate it with n command
      Select p for Primary Partition and 2 for Partition Number
      Use the same starting sector as deleted had and use the default value for Last Cylinder
      Exit fdisk with w command
    4. Reboot the Pi: sudo reboot
    5. After reboot expand the partition: sudo resize2fs /dev/mmcblk0p2 (may take a while)
  7. Optionally install the nano text editor (or keep using vi): tce-load -wi nano
  8. Install tools to create extensions tce-load -wi squashfs-tools liblz4

Install Home Assistant

  1. Install dependencies: tce-load -wi compiletc cmake rust python3.11 python3.11-dev python3.11-pip python3.11-wheel
  2. Install Home Assistant:
    1. Install Home Assistant: pip3 install --user --extra-index-url https://www.piwheels.org/simple homeassistant
    2. Create a temporary directory: mkdir -p /tmp/homeassistant/usr/local/bin /tmp/homeassistant/usr/local/lib/python3.11/site-packages
    3. Move over binary: mv ~/.local/bin/* /tmp/homeassistant/usr/local/bin
    4. Move over package files: mv ~/.local/lib/python3.*/site-packages/* /tmp/homeassistant/usr/local/lib/python3.11/site-packages
    5. Create extension: mksquashfs /tmp/homeassistant /mnt/mmcblk0p2/tce/optional/homeassistant.tcz
    6. Add homeassistant.tcz to /mnt/mmcblk0p2/tce/onboot.lst
  3. Make new directory: mkdir -p ~/.homeassistant/deps
  4. Install Numpy, either:
    • Use the attached wheel:
      1. Download: wget https://gist.github.com/BillyNate/d3124edfa903f288bfc8b7f37a155971/raw/numpy-1.26.4-cp311-cp311-linux_armv7l.whl
      2. Install: pip3 install --prefix ~/.homeassistant/deps numpy*.whl
    • Or build and install:
      1. Run export MAKEFLAGS="-j$(nproc)"
      2. Build & install: pip3 install --prefix ~/.homeassistant/deps numpy==1.26.4 (use version mentioned in requirements_all.txt if higher)
  5. Install more dependencies: tce-load -wi bluez libffi_base-dev openssl-dev openjpeg-dev zlib_base-dev autoconf ffmpeg libtiff libjpeg-turbo-dev libxcb
  6. Add piwheels as source for pip:
    1. Create directory: mkdir ~/.pip
    2. Create file ~/.pip/pip.conf and add:
      [global]
      extra-index-url=https://www.piwheels.org/simple
      
  7. Install frontend seperately:
    1. Install package: pip3 install --user home-assistant-frontend==20240207.1 (use version mentioned in requirements_all.txt)
    2. Create directory for persistent files: mkdir -p /mnt/mmcblk0p2/tce/persistent/.frontend (this is actually on the micro sd-card, not in RAM)
    3. Move frontend files to persistent directory: mv ~/.local/lib/python3.11/site-packages/hass_frontend /mnt/mmcblk0p2/tce/persistent/.frontend
    4. Create symlink: ln -s /mnt/mmcblk0p2/tce/persistent/.frontend ~/.frontend
    5. Set custom frontend directory in ~/.homeassistant/configuration.yaml:
    frontend:
      development_repo: /home/tc/.frontend
    
    1. Move the rest of the files: mv ~/.local/lib/python3.11/site-packages/home_assistant_frontend*.dist-info ~/.homeassistant/deps/lib/python3.11/site-packages/
  8. Install missing dependency: pip3 install --prefix ~/.homeassistant/deps tzdata
  9. Run Home Assistant once: hass -v --skip-pip, this generates the needed configuration
  10. Remove default_config from ~/.homeassistant/configuration.yaml
  11. Run Home Assistant again: hass -v --skip-pip-packages numpy and let it install the needed integrations. Once it says "Starting Home Assistant" it's finished!
  12. Open the web interface and create your basic config. Once done exit through Developer tools -> Services -> Home Assistant Core Integration: Stop
  13. Create an extension:
    1. Create a temporary directory: mkdir -p /tmp/homeassistant-deps/usr/local/
    2. Move over files: mv ~/.homeassistant/deps/* /tmp/homeassistant-deps/usr/local/
    3. Create extension: mksquashfs /tmp/homeassistant-deps /mnt/mmcblk0p2/tce/optional/homeassistant-deps.tcz
    4. Add homeassistant-deps.tcz to /mnt/mmcblk0p2/tce/onboot.lst
  14. Clean up the home directory as much as possible
  15. Add .homeassistant/home-assistant.log*, .homeassistant/tts and .homeassistant/deps to /opt/.xfiletool.lst
  16. Create startup script /opt/hassboot.sh containing su - tc -c "hass -c /home/tc/.homeassistant --skip-pip-packages numpy"
  17. Turn startup script into executable: sudo chmod +x /opt/hassboot.sh
  18. Add /opt/hassboot.sh & to /opt/bootlocal.sh in order to have Home Assistant auto start at boot
  19. Save changes: backup

Use port 80

  1. Install iptables: tce-load -wi iptables
  2. Prepend iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8123 to /opt/hassboot.sh

Install HACS

  1. Install unzip: tce-load -wi unzip
  2. Download latest package: wget https://github.com/hacs/integration/releases/latest/download/hacs.zip
  3. Create directory: mkdir ~/.homeassistant/custom_components/hacs
  4. Unzip package: unzip hacs.zip -d ~/.homeassistant/custom_components/hacs
  5. Clean up the home directory
  6. Restart Home Assistant
  7. Go to Settings > Devices & services > Add integration, and add HACS
  8. Check if everything is installed correctly
  9. Package the deps up again
  10. Save changes: backup

Install Zigbee support

  1. Run Home Assistant as user (instead of from boot)
  2. Add Zigbee Home Automation integration from the interface
  3. Package the deps up again
  4. Save changed configuration: backup

Disable cloud:

https://community.home-assistant.io/t/how-can-i-disable-the-cloud-component/106697/27

@wootmasterslick
Copy link

Hi Billy, thanks for this guide. I am trying to follow it to get home assistant working on my picoreplayer raspberry 5.
I have gotten quite far although at the step where I need to acess the gui site, step 12. Here I run into some (form me) undefinable errors.
As you are the expert in this and nobody els seems to have done this before I have come here for your help.
For now I tried running python 3.12 but there I have problem than no pip is included.
With newer or oldcer versions of HASS I am getting the same messages.
Can you please share your insights in my problem (kan ook in het nederlands).
Thank you so much.

Ps. I posted more info on the hass forum https://community.home-assistant.io/t/can-install-hass-on-picoreplayer-tinycore-linux/873408

@BillyNate
Copy link
Author

Hi @wootmasterslick,

Hopefully you got it already sorted out.
Unfortunately I'm not able to reproduce the errors and look into it. But I updated the guide into a new version.
If you want, you could give the new guide a try.

With best regards

@wootmasterslick
Copy link

wootmasterslick commented Aug 3, 2025

Thanks Billy, I was preparing to build an os and run everything in docker (which would be difficult for picoreplayer) but now I’ll first give your guide a new shot.

ps, do you think it might also be able to run other docker containers on picoreplayer this way? Id like to also have fileserver, video stream torrent etc.

@wootmasterslick
Copy link

wootmasterslick commented Aug 7, 2025

Another update, am now trying your new guide.
but I get this error upon backup command

tc@STREAMER:/etc/sysconfig/tcedir/persistent/uv$ sudo backup
Backup device is set to: mmcblk0p2/tce
Perform backup now? (y/N)y
Backing up files to /mnt/mmcblk0p2/tce/mydata.tgz -
There was an issue, see /tmp/backup_status.
tc@STREAMER:/etc/sysconfig/tcedir/persistent/uv$ nano /tmp/backup_status

in the file is this message

tar: removing leading '/' from member names

Doesnt look ciritical but I’d mention anyway. Any ideas??

Some other observation; I dont have default_config in configuration.yaml at the point you mention to remove it.

@BillyNate
Copy link
Author

Thank you for giving it a shot.
I've never seen this error on backup before. If your files in /home/tc are still intact after a reboot, the back-up works fine.

Don't worry too much about removing default_config, this is mostly my personal preference, it doesn't affect anything critical 😉

@BillyNate
Copy link
Author

Thanks Billy, I was preparing to build an os and run everything in docker (which would be difficult for picoreplayer) but now I’ll first give your guide a new shot.

ps, do you think it might also be able to run other docker containers on picoreplayer this way? Id like to also have fileserver, video stream torrent etc.

I never got Docker working in TinyCore, so I'm not sure if you'll be able to run containers.

Also, I'm starting to wonder if you should really go through all the effort of trying to get everything working on piCorePlayer: That will take you a lot of time since not all Linux packages are available on TinyCore/piCore.
Personally I love TinyCore because it never corrupts my (cheap) micro sd-cards, even through power outages or hard unplugging.
But since you aim to make a larger (file) server on you Pi5, you might want to look into attaching a drive (SSD/HDD) to you pi (which is very doable on a pi5 to my understanding) and run Raspberry Pi OS (or another pi Debian, or if you still want minimal: DietPi?). It shouldn't be hard to get Docker running on this setup. And if the log files etc. are written to a drive you should be fine.
Of course piCorePlayer is harder, since there's no ready made docker container to run, but you could try to figure out what piCorePlayer does (run Logitech Media Server if I remember correctly) and set it up yourself in a container on the pi5 😉

@wootmasterslick
Copy link

Thanks Billy, i have got the picoreplayer and homeassistant now running on a tinycore server. I just love all the features picoreplayer had out of the box and wanted to expand on that. Off course you end up getting more and more ideas leading to it going out of original scope. I have a second sd with RPi Os, maybe when I have time I’ll see what I can do on that. For now I have homesassistant running in screen session as I couldnt get the startup script to work, I have to restart that after reboot though... Su was asking for password and it looks like removing su alltogether leads to executing it and killing it right away…. Odd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment