Home Assistant

From ArchWiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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.

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.

See also