2016-08-22 09:23:36 +02:00

2.2 KiB

layout, title, description, date, sidebar, comments, sharing, footer, logo, ha_category, ha_release
layout title description date sidebar comments sharing footer logo ha_category ha_release
page Recorder Instructions how to configure the data recorder for Home Assistant. 2016-05-21 09:00 true false true true home-assistant.png History pre 0.7

The recorder component is storing details in a database which then are handled by the history component.

Home Assistant uses SQLAlchemy as Object Relational Mapper (ORM). This means that you can now use any SQL backend for the recorder that is supported by SQLAlchemy, like MySQL, MariaDB, or PostgreSQL.

The default database engine is SQLite which doesn't require any configuration. The database is stored in your Home Assistant configuration directory (.homeassistant) and called home-assistant.db.

To setup the recorder component in your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry
recorder:
  purge_days: 14

Configuration variables:

  • purge_days (Optional): Delete events and states older than x days.
  • db_url (Optional): The URL which point to your database.
Database engine db_url
SQLite sqlite:///PATH/TO/DB_NAME
MySQL mysql://SERVER_IP/DB_NAME
MySQL mysql://user:password@SERVER_IP/DB_NAME
PostgreSQL postgresql://SERVER_IP/DB_NAME
PostgreSQL postgresql://scott:tiger@SERVER_IP/DB_NAME

{% linkable_title Installation notes %}

Not all Python bindings for the choosen database engine can be installed directly. This section contains additional details which should help you to get it working.

{% linkable_title MYSQL %}

For MySQL you may have to install a few dependencies:

$ sudo apt-get install libmysqlclient-dev
$ pip3 install mysqlclient