Jump to content

Recommended Posts

Posted

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.

Скрытый текст

%C1%F3%F4%E5%F0+%EE%E1%EC%E5%ED%E001.png

(When prompted for reboot - reboot the system.)

 

Separately for owners of Orange Pi Lite:

Скрытый текст

For Home Assistant and wifi modules for it (such as ESPhome), it is advisable to use Client + AP (an access point from OrangePi Lite itself in addition to the client part) - so as not to depend on the router and the Internet.
To do this, you need to use wlan1 (as an AP) and wlan0 is our Client by default. The point is that we should have wlan0 as the leading interface. it sets the channel, the access current on wlan1 must follow wlan0 - i.e. one channel for client and access point.
wlan0 is already configured by default, it remains to pull up the access point:

sudo apt-get -V install dnsmasq-base iptables
sudo nmcli con modify <CLIENT_NAME or CLIENT_UUID of connection> connection.autoconnect-priority 99
sudo nmcli con add type wifi ifname wlan1 con-name Hotspot autoconnect yes ssid Hotspot-orangepilite
sudo nmcli con modify Hotspot 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method shared
sudo nmcli con modify Hotspot wifi-sec.key-mgmt wpa-psk
sudo nmcli con modify Hotspot wifi-sec.psk "1234567890"
sudo nmcli con up Hotspot

(The "connection.autoconnect-priority" option for our existing connection to the router is set to the maximum priority. Pay attention to the brackets <> instead of them should be your data.
If at the beginning instead of Station (wlan0) AP (wlan1) rises to a different channel from wlan0 - then there will be no connection to the station.Next
by the commands: the name of the access point is "Hotspot-orangepilite", the password is "1234567890")

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:

Скрытый текст

%C1%F3%F4%E5%F0+%EE%E1%EC%E5%ED%E001.png

(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

Posted

Step 3 is no longer working, but you can use the following to the same effect:

 

sudo BYPASS_OS_CHECK=true apt install ${PWD}/Downloads/homeassistant-supervised.deb

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines