I’ve just configured an external postgresql for the recorder component.
Postgres is dockerized on another RPI
As a test I stopped the container and checked what happened in HA.
Nothing pretty much. The logbook and history are empty but there is no warning.
So the question is : from HA is it possible to check if the connection to the DB is established and alive. ?
The first idea is to write a script on the RPI to push mqtt (installed on the same RPI than HA) messages about the status of the containers (postgresql and appdaemon so far) but is there a more straight forward method ?
Indeed but I wish there was like a sensor to get status about the recorder db connection.
And also a service to purge the db on demand.
Anyway first I’m going to finish the setup of my docker images and then try to find a way to send back messages (mqtt?) to hass in order to keep an eye on what’s going on with the services in the containers.
If you want to keep your historical data over unstable connection I can suggest you use InfluxDB to record your data. If your connection drops this won’t affect Influx since a connection is open on every state change and closed. Because influx data is submitted via simple HTTP post
The connection is not unstable and it’s running pretty smoothly but I’d like to be notified if it happens.
Nevertheless I’m going to have a look at Influx which could be an alternative.
In the end I want the hass db to be flushed everyday as I’ll set up an ETL to extract and store historical data in a separate database so I can have a better view on the long run, analyse and create statistics.