Home Assistant

From ArchWiki

Home Assistant is an open source home automation software that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts.

Install

Install the home-assistant package.

Home Assistant Supervised

Refer to Home Assistant Supervised.

Configuration

Configuration files are stored at /var/lib/hass/. If no configuration exists, a default configuration will be written at startup.

Usage

To start Home Assistant, start/enable home-assistant.service.

The first start may take up to 20 minutes because the required packages will be downloaded and installed.[1] You can see the progress in the logs.

Tip: Follow the first-time update process using journalctl:
# journalctl -fu home-assistant

By default, the web interface is available at http://localhost:8123.

Note: The web interface requires the home-assistant-frontend Python package.

Using MariaDB

By default, SQLite is used for the recorder/history integration within Home Assistant. A noticeable performance boost is achievable by using MariaDB (especially for larger setups). Home assistant uses SQLAlchemy which means that any backend is supported, like MySQL, MariaDB, PostgreSQL, or MS SQL Server. Here we only discuss MariaDb, for others please refer to the recorder integration documentation.

If not already installed, please refer to MariaDB for installation details.

Install the python-mysqlclient package dependency.

Create a new database, the example below shows a single username per service, with wildcard access to all databases having the username as a prefix e.g.:

$ mysql -u root -p
CREATE USER 'username'@'localhost' IDENTIFIED BY 'some_pass' ;
CREATE DATABASE username;
GRANT ALL PRIVILEGES ON username.* TO 'username'@'localhost';
FLUSH PRIVILEGES;
quit;

Add to your configuration file:

/var/lib/hass/configuration.yaml
recorder:
  db_url: !secret recorder_mariadb_url

Add to your secrets file (if not using a Unix socket, see the recorder integration documentation for alternative URLs):

/var/lib/hass/secrets.yaml
recorder_mariadb_url: "mysql://USER:PASSWORD@localhost/DATABASE?unix_socket=/var/run/mysqld/mysqld.sock&charset=utf8mb4"

Finally, restart the home-assistant.service. The database should now start to populate. For more information refer to the recorder integration documentation.

Troubleshooting

No access to USB devices

In the default installation, the Home Assistant may not have the necessary access to work with some devices, such as a Zigbee USB dongle. This is because such devices are controlled by the uucp system group.

Edit the home-assistant.service and add SupplementaryGroups=uucp to it so that the default hass user belongs to the right group.

Then, after a daemon-reload and restart of home-assistant.service it should be up and running.[2]

Bluetooth integration not working

If you are experiencing issues with Bluetooth integration and the below error message appears in your log it is because that the Bluetooth integration connects over dbus and there is an old systemd bug.

Config entry 'Bluetooth' for bluetooth integration not ready yet: DBus connection broken: [Errno 32] Broken pipe; try restarting `bluetooth` and `dbus`; Retrying in background

A solution is to switch to dbus-broker.

Alternatively, add a system user and group hass:

# useradd -U -r -s /usr/bin/nologin hass

Use a drop-in file for home-assistant.service

/etc/systemd/system/home-assistant.service.d/override.conf
[Service]
DynamicUser=false

See also