Hass.io on Raspbian with SSD Boot, I2C, 1Wire and shell commands as hassbian alternative

Hello everyone,
I decided to migrate from hassbian to Hass.io but on my conditions.

Very important for me was be able to boot from SSD, of course good microSD card like sandisk extreme pro will handle also great, but SSD drive will be much more durable.
Also had some scripts on hassbian and didn’t work on Hass.os that’s why i decided to run Hass.io on raspbian from SSD Drive.

There are few steps to make everything work just like You expect.

  1. Download latest Raspbian Lite and prepare bootable microSD card with balena etcher, after everything is complete create on boot partition empty file ssh to enable ssh login
  2. Boot the system, go to raspi-config and enable in interfacing options 1 Wire and I2C
  3. Reboot system, check is system availaible from SSH
  4. Prepare with balena etcher bootable USB SSD drive and also create empty ssh file on boot partition
  5. Plug the usb drive to Raspberry, list partitions fdisk -l to make sure that your USB SSD drive is visible in system
  6. type nano /boot/cmdline.txt and change root=PARTUUID to root=/dev/sd2
  7. Reboot system, if You did fine those steps You should boot from SSD
    You should check partition size fdisk -l and it is not full size of pchysical size of drive
  8. Before installing Hass.io you have to expand filesystem but on SSD to make it work You have to do:

cp /usr/bin/raspi-config ~
sed -i ‘s/mmcblk0p/sda/’ ~/raspi-config
sed -i ‘s/mmcblk0/sda/’ ~/raspi-config
~/raspi-config

  1. After system reboot when You check partition size fdisk -l You will se full size of partition
    Now standard command

Now, when system is booted from USB SSD once again enable I2C and 1Wire in raspi-config

After reboot check if You Can see I2C devices → apt-get install i2c-tools → 2cdetect -y 1

Update system before installing Docker and Hass.IO

apt-get update
apt-get upgrade

Here are steps to install Docker and then install Hass.io so I will not duplicate it

Installation - Home Assistant

  1. How to run commandline scripts on Hass.io just like on hassbian ?
    Basicly Hass.io and Raspbian are separated systems but theres no problem to run shell command from Hass.io on Raspbian.
    Log into home assistant, install OpenSSH, set SSH port for ex. 22222 and start addod
  2. Log into Hass.io using SSH and port 22222 and run those commands

mkdir /config/.ssh
It will create folder inside home assistant folder

ssh-keygen
and as path for save keys set /config/.ssh/id_rsa
Save it without password !

Now You have to share saved keys with raspbian with the following command
ssh-copy-id -i /config/.ssh/id_rsa [TARGET USER]@[TARGET IP]

Once when it’s done You Just have to create shell_command in home assistant

gammu_sms: ssh -i /config/.ssh/id_rsa -o “StrictHostKeyChecking=no” [email protected] ’ gammu sendsms TEXT “{{ sms_number }}” -text “{{ sms_topic }}” ’

It’s working great even when I create variables in home assistant and system is reading values from input text !

Enabling I2C and 1 Wire was very tricky, long time couldn’t understand why Raspbian can’t list I2C devices, but it was issue with SSD drive. In Raspberry Pi 3 You can boot even without SD Card, but on Raspberry pi 4 system is booting from microSD Card for a short moment, and rest part of booting is from USB SSD Drive, but before it’s booting from USB SSD it’s takeing boot configuration from SD Card, so it;s very importand to enable I2C and 1 Wire it in raspi-config when system is booted from microSD.
I Think it’s only matter of time and when native boot from USB will be added to Rpi4 It will be easier.

I Home it will help all hassbian users to migrate to better Hass.io !

When I tried using Rapsbian+HassIO (via Alternative install) I wasn’t able to configure 1wire sensors. I opened an issue but got no reply. Do you need anything special to pass those devices to the hassio container?

Thank you very much for the tutorial! I hope I can migrate back to Raspbian as I also need RTC on my HA.

Hello, in my case the issue with I2C and 1Wire was caused by doubled boot from microSD and then from USB. But i gues if You will boot from microSD and You are using device wchich doesn’t need to be enabled in raspi-config it should appear in Hass.io automaticly. The same situation with raspberry Pi GPIO pins. I couldn’t access to 1Wire interface but GPIO pins were active without any additional steps. So i guess theres no restrictions for docker container to limit access to host hardware. If im wrong You could try also to grant all priviliges to docker, i tried with some command found in internet but no luck. In my case it wasn’t necessary.
One thing in know, You cannot stop progres. Hass.io represent the progres that’s why i decided to adopt in new environment.
Good Luck :wink:

I did have GPIO working fine, but not 1wire. So, for what you know, all the /dev should be available to the Hass.io container?

Yeah, me too! I have a Hassbian installation at home and I’m happy with it, but I decided to use Hass.io as it’s the future, unfortunately while more supported and modern maybe lacks some docs for specific configurations. Also, maybe due to the microSD I have, it’s much slower than Hassbian.

You Can relly try with SSD. For now im using SSD on USB 2.0 because had no luck to find good USB 3.0 adapter. I ordered M2 SSD and will try on USB 3.0. The only issue is when im rebooting homeassistant, it’s rebooting very slow, and most of this time i can se theres no read write on drive. Meaybe It’s time to find better platform with M2 slot on in ? But In this case You will learn to walk and speak again before You will learn how to run interfaces of this platform :wink: