Line 65: | Line 65: | ||
WantedBy=multi-user.target | WantedBy=multi-user.target | ||
</pre> | </pre> | ||
== Configuration == | |||
The main configuration file in hass user home directory is ''./home-assistant/configuration.yaml'' and to bind it to 80 port: | |||
default_config: | |||
http: | |||
server_port: 80 | |||
== User interface == | == User interface == |
Revision as of 09:11, 30 March 2023
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. 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.
Project itself provides a lot of pre-made installation images where Rasperry Pi native hardware is the reference target. That's very easy if a RasPi is available and the intended platform. HASS has CCTV-features that are CPU-intensive and the more powerful Raspi's help with those features.
In non-RasPi installations, provided virtual machine images do not run on enterprise Linux (2023) KVM. There is also a manual installation method. At the moment looks like the Fedora Server releases (bare metal or virtual installation) provide the both requirements, the somewhat recent Python versions and slower 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 Python package installation has some limitations, some third-party web-installation methods don't work for example.
Installation
At the moment, there are no premade RPM-packages except the shell tool.
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 . $ 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
For HASS-server itself with Python-venv, recommended way is to use the same method
$ pip install homeassistant-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=/srv/hass/bin/hass -c "/home/hass/.homeassistant" RestartForceExitStatus=100 [Install] WantedBy=multi-user.target
Configuration
The main configuration file in hass user home directory is ./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.