Raspi - Homeassistant (NO-Docker)

1. boot from SSD
https://www.tomshardware.com/how-to/boot-raspberry-pi-4-usb

sudo apt update -y
sudo apt full-upgrade -y
sudo rpi-update -y
sudo reboot

#IF SSD disk BOOT needed
sudo rpi-eeprom-update -d -a

sudo raspi-config
>Select Boot Options
>Select Boot ROM Version
>Select Latest > OK
>Select No to use the latest boot ROM
>Select Boot Order
>Select USB Boot and click Ok
>Select Finish 
##END IF

2. raspbian change keyboard to us
sudo dpkg-reconfigure keyboard-configuration

3. Network - !!!! no Wifi
sudo nano /boot/wpa_supplicant.conf
#add to file:
country=de
update_config=1
ctrl_interface=/var/run/wpa_supplicant
 
network={
    scan_ssid=1
    ssid="RAIVIoT"
    psk="aklizdog"
}

######

sudo nano /etc/network/interfaces


# interfaces(5) file used by ifup(8) and ifdown(8) Please note that this
# file is written to be used with dhcpcd For static IP, consult
# /etc/dhcpcd.conf and 'man dhcpcd.conf' Include files from
# /etc/network/interfaces.d:
#auto lo
#iface lo inet loopback

auto br0
iface br0 inet static
    metric 100
    address 192.168.100.254
    netmask 255.255.255.0
    gateway 192.168.100.253
    dns-nameservers 8.8.8.8 8.8.4.4

auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
#?    metric 200
    address 10.168.100.254
    netmask 255.255.255.0
    gateway 10.168.100.253
    dns-nameservers 8.8.8.8 8.8.4.4
    wpa-ssid RAIVIoT
    wpa-psk aklizdog
#        wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf


#########################

sudo nano /etc/dhcpcd.conf
On top add (empty lines):
denyinterfaces wlan0 eth0

On end add (empty line+):

interface br0

###### https://wiki.debian.org/BridgeNetworkConnections
create Bridge Eth0 only +(NO)Wifi - enable Wifi/ETH0 simultaneously working on differnet subnets 

sudo apt install bridge-utils

#sudo brctl addbr br0
#sudo ip addr show
#sudo brctl addif br0 eth0 
#sudo brctl addif br0 eth0 wlan0
# OR

sudo nano /etc/systemd/network/bridge-br0.netdev
File contents:
[NetDev]
Name=br0
Kind=bridge

sudo nano /etc/systemd/network/br0-member-eth0.network
File contents:
[Match]
Name=eth0
[Network]
Bridge=br0

sudo nano /etc/systemd/network/br0-member-wlan0.network
File contents:
[Match]
Name=wlan0
[Network]
Bridge=br0
#end OR

sudo systemctl enable systemd-networkd


sudo brctl show
sudo reboot

sudo rm /etc/systemd/network/br0-member-wlan0.network
sudo reboot

######################
sudo systemctl disable dhcpcd
sudo systemctl enable networking
#sudo systemctl disable networking
#sudo systemctl enable dhcpcd

sudo apt-get install -y wavemon

3.5 Install NTP sync
timedatectl list-timezones
sudo timedatectl set-timezone Europe/Prague
sudo apt-get ntpdate
sudo ntpdate 0.europe.pool.ntp.org
sudo crontab -e
10 7   *   *   *    sudo ntpdate 0.europe.pool.ntp.org

4. enable SSH on both cards
sudo nano /etc/ssh/sshd_config
>uncomment: ListenAddress
sudo service ssh restart

5. SSL & Python

sudo apt-get update
sudo apt-get upgrade -y

sudo apt-get install -y build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev
sudo apt-get install -y build-essential checkinstall libreadline-gplv2-dev libncursesw5-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

###Installing OpenSSL
cd /usr/src
curl https://www.openssl.org/source/openssl-1.1.1c.tar.gz | tar xz
cd openssl-1.1.1c/
./config shared --prefix=/usr/local/
make -j 4
sudo make install

#update Python >> 3.8+
cd ~
wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tgz
tar zxf Python-3.9.0.tgz
cd Python-3.9.0
./configure --enable-optimizations --with-openssl=/usr/src/openssl-1.1.1c
make -j 4
sudo su
export LDFLAGS="-L/usr/local/lib/"
export LD_LIBRARY_PATH="/usr/local/lib/"
export CPPFLAGS="-I/usr/local/include -I/usr/local/include/openssl"
make altinstall

sudo python3.9 (enter)
import ssl
quit()
#

sudo apt-get install python3 python3-dev python3-venv python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential libopenjp2-7 libtiff5
python3 --version
#

6. Install HomeAssistant manually:
https://www.home-assistant.io/docs/installation/raspberry-pi/

sudo useradd -rm homeassistant -G dialout,gpio,i2c
cd /srv
sudo mkdir homeassistant
sudo chown homeassistant:homeassistant homeassistant

sudo -u homeassistant -H -s
cd /srv/homeassistant
python3.9 -m venv .
source bin/activate
/srv/homeassistant/bin/python3.9 -m pip install --upgrade pip
python3.9 -m pip install wheel

pip3.9 install homeassistant --use-feature=2020-resolver

hass

# procedure may take anywhere between 5 to 10 minute
# web interface on http://ipaddress:8123.

exit #virtual env

### Activating the virtual environment
sudo -u homeassistant -H -s
source /srv/homeassistant/bin/activate


7. Auto start HASS
sudo nano /etc/systemd/system/home-assistant@homeassistant.service
sudo systemctl --system daemon-reload
sudo systemctl enable home-assistant@homeassistant
#sudo systemctl disable home-assistant@homeassistant
sudo systemctl start home-assistant@homeassistant
#status
sudo systemctl status home-assistant@homeassistant


### To update to the latest version of Home Assistant Core follow these simple steps:

sudo -u homeassistant -H -s
source /srv/homeassistant/bin/activate
pip3 install --upgrade homeassistant


Write a New Comment
Maximum number of characters for comment: 512
 If you cann't see Verification Code clearly.
Write Verification Code(Required field)