TLDR: Not on your home assistant server (or on it ig, you're running it like in a vm with a container or something iirc, idfk just put it off the server, you'll need a decent bit of space depending how much you're logging and how long, also set up compression or you'll find it one day with a 150GB database, totally didn't happen to me)
- Start this docker compose
services:
timescale:
container_name: timescale-ha
image: timescale/timescaledb-ha:pg16
restart: always # I think this is my only container marked as always on my entire system lol
ports:
- 5433:5432 # Pick whatever port you want, 5432 was in use by another postgres container
environment:
POSTGRES_PASSWORD: postgress_password_here
volumes:
- ./data/:/home/postgres/pgdata/data/
grafana:
container_name: grafana-ha
image: grafana/grafana
restart: unless-stopped
user: 1000:1000
ports:
- 3012:3000 # This is the one you'll be using for grafana (attached screenshot)
volumes:
- ./grafana/:/var/lib/grafana/
pgadmin:
container_name: pgadmin-ha
image: dpage/pgadmin4
restart: unless-stopped
ports:
- 3016:80 # This is your admin interface for the database, basically just whenever you need to do work on it.
environment:
PGADMIN_DEFAULT_EMAIL: example@example.com
PGADMIN_DEFAULT_PASSWORD: your_pgadmin_password_here_not_postgress_password
volumes:
- ./pgadmin:/var/lib/pgadmin
- Note: To use pgadmin, you'll need to add your postgres server in it
- Right click servers, Register->Server, give it a name (ex.
timescale-ha), go to connection, set host name totimescale, leave port5432since we're connecting internally, hit save. Once this is done, or not done, just leave it, you'll know when you need it (aka things are going terribly terribly wrong)
- Now, your timescaledb should be set up and running, if docker logs show otherwise, idk fix it nerd. Head over to your HA install now
- Install LTSS from HACS
- Add this to your HA
configuration.yaml
ltss:
db_url: postgresql://postgres:postgress_password_here@your-server-ip:5433/homeassistant
# idk these were on the github, I don't use any of them
chunk_time_interval: 2592000000000 # The time interval to be used for chunking in TimescaleDB in microseconds. Defaults to 2592000000000 (30 days).
# you can also specifically include and exclude, just read the docs it's easy
- Now, head over to your grafana instance
- Login, set it up, do whatever it needs
- Go to dashboards New -> Import -> Upload dashboard JSON file, then toss in the attached dashboard
- It should show
grafana-postgresql-datasourcewithNo data sources of type PostgreSQL found, click it, thenConfigure a new data source - Click PostgreSQL
- Name it whatever you want, or just leave it who cares, set up the host url as
timescale-ha, database namehomeassistant, usernamepostgres, password as whatever you selected, disable TLS (I guess? idk mine is disabled), set version to 15, check TimescaleDB, hitSave & test - Everything good? Head back to
Dashboards, then select the newly made dashboard, should be good?