Home Assistant Add-on: PostgreSQL + TimescaleDB

Yes it is (author speeking here)
It doesn’t get a lot of commits at the moment because:

  1. It’s pretty stable (and needs to be, people rely on this as it’s a database)
  2. My focus was on a healhcare project for my aunt ( link)

But… recently someone has helped with removing a roadblock for TimescaleDb Tools integration, so it’s about time for it’s 6 months release cycle.

Can I help you with something specific or some advice/question?

Thank you for your quick reply and that’s great to hear!
I bought a mini server as a replacement for my raspberry pi, and I’m now reconsidering and redoing everything I configured in HA on the pi.
I prefer Postgresql over MariaDB (as I can use it for other purposes as well) but, as you said, people rely on it, so it needs to be supported, and since MariaDB is an official plugin, it felt like it might be the safer option.
However, your response convinced me to go with your add-on :slight_smile:
Thanks!

PS: I found out that the last commit on the MariaDB add-on was 7 months ago :wink:

Installed and everything works great out-of-the-box!
I do get a message in pgAdmin4 that a new version is available:
image

I guess the add-on needs to be upgraded for this?

Hi @danieldotnl ,

Thank you for your kind words!

The pgAdmin plugin is just a wrapper around pgAdmin for convenience and ‘feature completeness’.
It follows roughly the same release cycle as the postgresql plugin, but since pgAdmin is updated more frequently, it will show such a message about 2 weeks after I just tested and launched the latest version :rofl:.

I will try to find time to give that one also an update.

If you insist on using the latest of the latest, you could ofcourse just install the latest pgAdmin on your workstation.
The plugin is merely there so you always have the option of ‘accesing postgres from anywhere’.

If you need any assistance, please let me know. I am more then happy to help you if I can.

1 Like

I try to install the Hassio pgadmin4 addon. After i try to start the addon and look in the log it looks ok. However, when i try to open the web-ui it stops direct and reports 502: bad gateway. I tried several times to reinstall the addon but same results. Below you’ll find the logs:

Add-on version: 2.1.1
You are running the latest version of this add-on.
System: Home Assistant OS 11.4 (aarch64 / raspberrypi3-64)
Home Assistant Core: 2024.1.3
Home Assistant Supervisor: 2023.12.1

Please, share the above information when looking for help
or support in, e.g., GitHub, forums or the Discord chat.

cont-init: info: /etc/cont-init.d/00-banner.sh exited 0
cont-init: info: running /etc/cont-init.d/01-log-level.sh
cont-init: info: /etc/cont-init.d/01-log-level.sh exited 0
cont-init: info: running /etc/cont-init.d/nginx.sh

After the web-ui the following log lines are added:

cont-init: info: /etc/cont-init.d/nginx.sh exited 0
cont-init: info: running /etc/cont-init.d/pgadmin4.sh
s6-rc: fatal: timed out
s6-sudoc: fatal: unable to get exit status from server: Operation timed out
/run/s6/basedir/scripts/rc.init: warning: s6-rc failed to properly bring all the services up! Check your logs (in /run/uncaught-logs/current if you have in-container logging) for more information.
prog: fatal: stopping the container.

Is this the compete log?
Can you try another port number in the configuration, to make sure you don’t have a port-conflict?

tried several different ports. The only positive effect from switching away from port 80 is the fact that the application is not shutting down (see logs below) I’m still getting the 502 bad gateway.

cont-init: info: /etc/cont-init.d/00-banner.sh exited 0
cont-init: info: running /etc/cont-init.d/01-log-level.sh
cont-init: info: /etc/cont-init.d/01-log-level.sh exited 0
cont-init: info: running /etc/cont-init.d/nginx.sh
cont-init: info: /etc/cont-init.d/nginx.sh exited 0
cont-init: info: running /etc/cont-init.d/pgadmin4.sh

You can’t use port 80, because that is already in use for the normal Home Assistant UI.

Are you also getting this when using pgAdmin from the menu (on the left). The logging looks very imcomplete. Do you have the complete logs for me?

Also, is the sidebar menu working?

It looks like it takes too long to startup pgAdmin, hence the timeouts What hardware are you using?

The side bar menu works fine. Pgpadmin4, however gave the same result as starting from the setup menu.
These are all the log the addon give:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/00-banner.sh


Add-on: pgAdmin4
A PostgreSQL Management and Query tool

Add-on version: 2.1.1
You are running the latest version of this add-on.
System: Home Assistant OS 11.4 (aarch64 / raspberrypi3-64)
Home Assistant Core: 2024.1.3
Home Assistant Supervisor: 2023.12.1

Please, share the above information when looking for help
or support in, e.g., GitHub, forums or the Discord chat.

cont-init: info: /etc/cont-init.d/00-banner.sh exited 0
cont-init: info: running /etc/cont-init.d/01-log-level.sh
cont-init: info: /etc/cont-init.d/01-log-level.sh exited 0
cont-init: info: running /etc/cont-init.d/nginx.sh

I’m running on a RPI 3 with an extra USB-HD. Everything works smoothly except the pgadmin4

I have just released version 3.0.1. Can you try with that one please?

Please upgrade the addon to 3.0.1 and try that one. I have upgraded pgAdmin to the latest 8.2.

No more warnings, thank you! :partying_face:

1 Like

Amazing Add-ons! I had postgres, pgadmin and ltss running quite quickly and I am now going through the documentation and that thread to figure out how to install postgis and how it does work, make sure backups are working, connect to Grafana and draft a 1st dashboard…
Question - Has anyone already documented a way to migrate some years long influxdb records to that postgress DB?
I’d love not to have my actual Long time state storage split in 2 separate DBs.
Thank you!

Hi @cben0ist ,

Yeah, some people have successfully used Outflux to port the data over to timescale: GitHub - timescale/outflux: Export data from InfluxDB to TimescaleDB

I know of this documented case: Migrating from InfluxDB to TimescaleDB on a Raspberry Pi - Share your Projects! - Home Assistant Community (home-assistant.io)

Hi.

Has anyone actually try to restore data dumped from this into e.g. a locally running postgres server?

I am having huge problems with that. All I wanted was running a local DB in a docker, and restore the dumped backup, but I am unable to find a suitable docker image with timescaledb+postgis and without that, the restore fails. I was hoping that I could use the addon image, but without success - it fails on start up as it’s expecting HA API.

Thanks!

(author here) Perhaps I can assist.
Can I send you a discord invite so we could discuss your usecase?

Sure, thanks!

Btw. my goal is simple. I want to validate that I can recover from a DB failure based on my DB dumps I do every day.

I found out that it’s harder than I thought due to requiring both timescaledb+postgis. From the lack of any mention in this thread I suspect not many people have actually done this.

You can reach me on this discord server:

Just grab a channel.