Sidehistorik
Install postgres via Docker (with data in /opt/pgdata)
Kodeblok |
---|
docker run -d \ --name postgres \ --restart always \ -p 5432:5432 \ -e POSTGRES_PASSWORD=****** \ -e PGDATA=/var/lib/postgresql/data/pgdata \ -v /opt/pgdata:/var/lib/postgresql/data \ postgres |
Add the User and Database
Kodeblok |
---|
psql -U postgres -h 10.0.0.183 |
Kodeblok |
---|
CREATE ROLE hauser WITH LOGIN PASSWORD '******' VALID UNTIL 'infinity'; CREATE DATABASE homeassistant WITH ENCODING 'UTF-8' OWNER=hauser CONNECTION LIMIT=-1; |
Add the configuration to the secrets file
Kodeblok |
---|
hadbconfig: postgresql://hauser:*****@10.0.0.183/homeassistant |
Add the config to configuration.yaml for "recorder"
Kodeblok |
---|
recorder: purge_keep_days: 30 db_url: !secret hadbconfig |
And restart Home Assistant