Install Home Assistant on a Raspberry Pi

First setup a basic raspberry pi. Then follow the steps in the manual home assistant installation.

In this case the commands on the home assistant guide did not install some packages, but we can install them manually.

sudo apt-get install libopenjp2-7-dev
sudo apt-get install libtiff-tools

After testing using the “hass” command and checking the page at the raspberry pi’s ip address + :8123, then need to set home assistant to run in the background as a daemon using another guide they provided.

Raspberry Pi Home Server

Setup a raspberry pi home server using Windows, raspberry pi OS Lite, balena etcher, WIFI and SSH. Get a basic local linux server running at home.

First we need a raspberry pi (3), an SD card (32GB+ recomended), an SD card reader (e.g. a USB SD card reader) and a power supply for the pi (USB power can be unstable).

Plug in the SD card to a Windows machine and format it using PowerShell. Type:

diskpart
list disk # Look for which disk number is the SD card using the details
select disk <disk_number_here>
detail disk # Check you have selected the right disk
clean # Wipe the disk clean
exit

Then open Windows disk management tool (e.g. search for disk management), right click the SD card and new volume. Use FAT32. Name the drive letter P for Pi

Then download balena etcher and the raspbian lite Linux distribution, and user balena etcher to burn raspbian onto the SD card. Remove the SD card when etcher has checked and confirmed it wrote successfully, then re-insert after a few seconds.

Go back into PowerShell and cd P:\ or change into whatever you named the SD card.

To enable SSH on first boot create type New-Item SSH. Then create a configuration file for the WIFI settings using New-Item wpa_supplicant.conf.

Open wpa_supplicant.conf with a command like code wpa_supplicant.conf or notepad wpa_supplicant.conf and then add this information where ssid is the name of your router and psk is the router password.

country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
 ssid="YOURSSID"
 scan_ssid=1
 psk="YOURPASSWORD"
 key_mgmt=WPA-PSK
}

The SD card is now ready to go in the raspberry pi for first boot. After a few minutes it will show up on your router page. Log into the pi using ssh pi@raspberrypi password: raspberry or use pi@ipaddress e.g. pi@192.168.1.52

14. If we have used the pi on this network before and get this warning:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: POSSIBLE DNS SPOOFING DETECTED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The ECDSA host key for raspberrypi has changed,
and the key for the corresponding IP address 192.168.0.27
is unknown. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Then type ssh-keygen -R raspberrypi or ssh-keygen -R <pi-ip_address> to reset it, then try log in again.

Once logged in change the password using passwd command, and do a sudo apt-get update and then sudo apt-get -y upgrade to update the the raspberry pi.