From Fedora Project Wiki

Revision as of 14:25, 20 April 2023 by Tuju (talk | contribs)

Home Assistant (HASS) is a localized home automation server system that doesn't depend on any external cloud service nor network connections. It has a web as well mobile device (iPhone, Android, tablets) user interfaces for different use cases. However, there is no native GUI user interface for embedded local displays. It's written with Python and it has wide home automation hardware support, called integrations.

By its nature home automation installations are used for long periods which conflicts with the fast pace of Linux operating system life cycles. HASS is also written with the latest Python features which are not available in enterprise type of Linux variants. There are no premade packages for any Fedora camp distribution. These combined it's hard to install and get running on enterprise Linux and Fedora itself would have to be constantly upgraded.

Installation types

This is confusing. For the newcomers, worth of explaning simply if that is even possible.

Project has produced something called core and supervisor. Core can be used without supervisor, which maintains core and the surrounding operating system. System without supervisor has also some functional limitations, mainly when installing additional features to the core. The whole idea of Home Assistant is to integrate hundreds of different eletrical systems and IoT-hardware into one complete system. Only few of them are supported by the core, rest are installed via these additional features.

Some of the additional features are available through HACS (HA Community Store), some directly from Github service for example.

Home Assistant OS

Project provides many pre-made full installation images (from bare metal to the user interface) where a Rasperry Pi native hardware is the reference target. That's very easy installation type if the RasPi is available and the intended platform. HASS has CCTV-features that are CPU-intensive and the more powerful Raspis help with those features.

Alternative to bare metal, installation images also include pre-made containers images (KVM or Docker). Provided kvm-virtual machine images do not run on enterprise Linux (now, in 2023) KVM.

All full installations are called just plain Home Assistant or Home Assistant OS which mean operating system + core + superviser regardless where it runs.

Home Assistant Core

Alternative to pre-made installation images, there are manual installations for operating systems which include core, but not supervisor. For these installations there are few methods available:

  • python-package via pip (system python or venv)
  • git checkout (system python or venv)

At the moment looks like the Fedora Server OS-releases (bare metal or virtual installation) provide all the requirements, the somewhat recent Python versions and slower OS release cycle where it can be manually installed with Python package installer pip tool. Python package-method is also easy to update with HASS monthly updates.

Manual installation has some limitations, some third-party web-installation methods don't work. While the HACS-itself works fine, HACS custom repository add -functionality does not.

Home Assistant Supervised

Lastly, there is manual supervised installation type that includes core and supervisor but it requires Debian and Docker, which doesn't apply here. It is a manual installation that results the same as pre-installed images provide and has no core's limitations.

Further reading about installation types and their limitations:

Installing core type

These instructions are for the Home Assistant Core -installation type described before, using Python virtual enviroment and Python-package pip-installation method on Fedora Server distribution.

At the moment, there are no premade RPM-packages except the shell tool. Packaging and maintaining those packages would require a lot of work since HASS releases an update in every month.

By default hass binds to TCP 8123 port, but with authbind it can be set to 80. This must be set in systemd service file as well in HASS configuration where to bind the port number.

Prefix # means exceuted as root, $ exceuted as user hass.

Server with Python package installer

Package dependencies. Manual installation with pip also compiles some Python-modules and hence development packages are needed for runtime environment.

# dnf install -y python3 python3-devel python3-pip openssl authbind

Python package name is homeassistant. Should be noted, that it's available in different Python version repositories, but older Python versions have old HASS versions which don't get updated anymore. They install but are years old and should not be used as all the documentation, discussions and integrations have moved on. The correct way to solve this is to change Python, that is a distribution version (enterprsise vs fedora server) with newer Python.

# adduser hass
# mkdir /srv/hass
# chown hass:hass /srv/hass

Python virtual environment and pip package installation:

$ cd /srv/hass
$ python -m venv .
$ source /srv/hass/bin/activate
$ pip install homeassistant
$ pip install homeassistant-cli

Authbind configuration:

# touch /etc/authbind/byport/{80,443}
# chmod 777 /etc/authbind/byport/{80,443}
# chown hass:hass /etc/authbind/byport/{80,443}

Shell

On any Fedora or enterprise type of Linux there is a RPM package:

# dnf install -y home-assistant-cli


homepage explains the required $HASS_SERVER and $HASS_TOKEN variables.

Systemd

Systemd file /etc/systemd/system/hass.service. It assumes the manual installation directory.

[Unit]
Description=Home Assistant
After=network-online.target

[Service]
Type=simple
User=hass
WorkingDirectory=/home/hass/.homeassistant
ExecStart=/usr/bin/authbind --deep /srv/hass/bin/hass -c "/home/hass/.homeassistant"
RestartForceExitStatus=100

[Install]
WantedBy=multi-user.target
# chkconfig hass on
# service hass start

Configuration

The main configuration file in hass user home directory is /home/hass/.home-assistant/configuration.yaml and to bind it to 80 port:

default_config:

http:
  server_port: 80

User interface

Web interface is in port 8123 by default which is blocked by the firewalld service.

  • Apple iPhone and tablet client in Apple Store.

Security

If the system is connected to the Internet, it should be secured properly to prevent unauthorized use.

See also

Terminology

  • Home Assistant - project name and complete system running Home Assistant OS.
  • Home Assistant OS - complete system installed from pre-made installation images: os + core + supervisor.
  • HASS - abbreviation of Home ASSistant.
  • HAOS - abbreviation of Home Assistant Operating System.
  • hassio - old name that was changed to Home Assistant OS.
  • core - base daemon software withtout supervisor.
  • supervisor - management software supervising core daemons.
  • supervised - type of system that runs core under supervisor.

External links