How to install Home Assistant Supervised on Armbian 23.02 Jammy
(plus minus, but quite installed on the previous release of Armbian, this is based on Debian 10)
Performed exclusively without a graphical interface, from the console.
Works stably on Orange Pi Lite , including a connected Bluetooth dongle via USB and sensors to it.
1. The first installation of Armbian and the subsequent creation of a user and passwords, the next is required to install all updates via sudo apt update && sudo apt upgrade -y . Then you need to install the Firmware
update through the armbian-config ->System utility as in the screenshot.
(When prompted for reboot - reboot the system.)
Separately for owners of Orange Pi Lite:
2. Next, follow the instructions https://github.com/home-assistant/supervised-installer up to "Step 4"
If we continue to install "Step 4", it will not allow installation and will write in red letters that the current system is not supported and the system must be Debian 11.
3. In this case, it is necessary during the installation, to replace one variable in the system in the /etc/os-release file .
It is necessary to replace in this file
PRETTY_NAME="Armbian 23.02.2 Jammy"
on
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
(from sudo rights, eg "sudo nano /etc/os-release" editor)
4. And continue with "Step 4" in the instructions.
In the installation type selection window, select "qemuarm" for armv7, this is important .
5. After installation, the services for deploying the docker container will immediately load automatically. Note that it took me ~15 minutes ! The progress of the deployment can be monitored indirectly in htop (you can open a window in parallel in another ssh terminal).
6. For autoload, you need to activate autoload services:
sudo systemctl enable hassio-apparmor.service
sudo systemctl enable hassio-supervisor.service
For Bluetooth integration to work, you must install "sudo apt-get -y install bluez" into the system beforehand.
Additionally:
1. The main file(s) of the Home Assistant configuration ( for ex. like configuration.yaml ) on this system will be located along the path /usr/share/hassio/homeassistant/ , in the same folder, if necessary, you need to throw custom_components .
2. If you want to use /dev/ttyUSB0 (or HC-05 ( /dev/rfcomm0 ) for example after auto connect via bluetoothctl ) on your Armbian and in conjunction with Home Assistant, then you need to add rights to your user:
sudo gpasswd --add <user> dialout
sudo newgrp dialout
(Note that the brackets <> should be your data instead. Also, if you will use i2c in the same way as dialout, write i2c )
Working with GPIO from userspace in Armbian
Option 1 (classic)
By default, the OS does not allow gpio to be controlled via sysfs (/sys/class/gpio/) to a non-root user, to fix this you need to do the following:
1. Create a gpio group:
sudo groupadd gpio
2. We give our user access to the gpio group:
sudo usermod -aG gpio <user>
3. Create a rule for udev when the system boots:
sudo nano /etc/udev/rules.d/99-gpio.rules
Paste in the file "/etc/udev/rules.d/99-gpio.rules" the following
SUBSYSTEM=="gpio", KERNEL=="gpiochip*", GROUP="gpio", ACTION=="add", PROGRAM="/bin/sh -c 'chown root:gpio /sys/class/gpio/export /sys/class/gpio/unexport ; chmod 220 /sys/class/gpio/export /sys/class/gpio/unexport'"
SUBSYSTEM=="gpio", KERNEL=="gpio*", GROUP="gpio", ACTION=="add", PROGRAM="/bin/sh -c 'chown root:gpio /sys%p/active_low /sys%p/direction /sys%p/edge /sys%p/value ; chmod 660 /sys%p/active_low /sys%p/direction /sys%p/edge /sys%p/value'"
4. Reboot:
sudo reboot
For Allwinner H3 gpio, the following picture corresponds to the connector:
(Where BCM corresponds to the GPIO number in Armbian, more details can be found here )
It should now be possible to change (monitor) all these gpios non-root , i.e. when we do for example "echo 6 > /sys/class/gpio/export", then it will use the physical 7 pin of the connector as the folder "/sys/class/gpio/gpio6" etc...
Option 2 (recommended)
A new option without any sysfs is to use the built-in Armbian tools like gpiodetect, gpiofind, gpioget, gpioinfo, gpiomon, gpioset (Help).
Additionally:
For Home Assistant, in addition to the classic way, it is much easier to do the second option, for example:
This is a binary_sensor in the form of a pressing to the button (input😞
binary_sensor:
- platform: command_line
name: external_button_state
command: "gpioget gpiochip0 6"
payload_off: "0"
payload_on: "1"
scan_interval: 0.250
(same 7 pin on connector as GPIO6 on Armbian , scan_interval set to 0.250 in seconds - means 250ms)
Or a switch like slide switch 😀 (output) :
switch:
- platform: command_line
switches:
something_change_value:
friendly_name: Test Switch pulling GPIO output
command_on: gpioset -B pull-up gpiochip0 64=1
command_off: gpioset -B pull-down gpiochip0 64=0
command_state: test $(gpioget gpiochip0 64) = 1
(where pin 19 is used on the connector that is GPIO64 on Armbian as an output signal, 0=low[0V] 1=high[3.3V], the test command tests the already set switch value and changes it almost in real time - this is necessary if let's say we have someone else who controls the signal, or it changes dynamically, or in general, another pin can be set for the status)
-----------------
That's all, successful projects for you!
Original link