DSMR Reader Add-on for Home Assistant

Getting the same error as @prier on 3 out of my 4 HA setups. Only a rollback gets it working again.

This works, not knowing what it’s doing

I also got “migration database failed”, restoring backup now…

Can you try this solution DSMR Reader Add-on for Home Assistant - #472 by Mobiledude ?

It says password error, so try to catch the password in the backup? Or reset the password in the TimescaleDB app.

Tried it, I get:

django.db.utils.OperationalError: connection to server at “77b2833f-timescaledb” (fd0c:ac1e:2100::b), port 5432 failed: FATAL: no pg_hba.conf entry for host “fd0c:ac1e:2100::7”, user “postgres”, database “dsmrreader”, no encryption

[ FAIL ] init-dsmr-and-db | Database migration failed
s6-rc: warning: unable to start service init-dsmr-and-db: command exited 1
django.db.utils.OperationalError: connection to server at “77b2833f-timescaledb” (fd0c:ac1e:2100::b), port 5432 failed: FATAL: no pg_hba.conf entry for host “fd0c:ac1e:2100::7”, user “postgres”, database “dsmrreader”, no encryption

[ FAIL ] init-dsmr-and-db | Database migration failed
s6-rc: warning: unable to start service init-dsmr-and-db: command exited 1

Could you explain to me how to apply that?

Hey Sander,

I do know it’s was struggeling about the password. But the strange thing is that i didn’t change anything. And when i remove the password from the config tab, its getting in a boot loop.

Old config (working with the backup setting back):

DSMRREADER_ADMIN_PASSWORD: admin
DJANGO_DATABASE_NAME: dsmrreader
DJANGO_DATABASE_USER: postgres
DJANGO_DATABASE_PASSWORD: homeassistant
DJANGO_DATABASE_HOST: 77b2833f-timescaledb
DJANGO_DATABASE_PORT: “5432”
DSMRREADER_OPERATION_MODE: standalone
DSMRREADER_REMOTE_DATALOGGER_API_HOSTS: http(s)://<YOUR_DSMR_HOST>:
DSMRREADER_REMOTE_DATALOGGER_API_KEYS: <YOUR_API_KEY>
DSMRREADER_REMOTE_DATALOGGER_SERIAL_PORT: /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AK47CNJV-if00-port0
DSMRREADER_REMOTE_DATALOGGER_INPUT_METHOD: serial
DSMRREADER_REMOTE_DATALOGGER_SERIAL_BAUDRATE: “115200”
DSMRREADER_REMOTE_DATALOGGER_NETWORK_HOST: x.x.x.x
DSMRREADER_REMOTE_DATALOGGER_NETWORK_PORT: x
DSMRREADER_REMOTE_DATALOGGER_SLEEP: “0.5”
DSMRREADER_LOGLEVEL: ERROR
DJANGO_FORCE_SCRIPT_NAME: “”
DJANGO_STATIC_URL: static/

New config (with this i’ll get the password error)

WEBSERVER: Ingress
DSMRREADER_ADMIN_USER: admin
DSMRREADER_ADMIN_PASSWORD: admin
DJANGO_DATABASE_NAME: dsmrreader
DJANGO_DATABASE_USER: postgres
DJANGO_DATABASE_PASSWORD: homeassistant
DJANGO_DATABASE_HOST: 77b2833f-timescaledb
DJANGO_DATABASE_PORT: “5432”
CONTAINER_RUN_MODE: standalone
DSMRREADER_REMOTE_DATALOGGER_API_HOSTS: http(s)://<YOUR_DSMR_HOST>:
DSMRREADER_REMOTE_DATALOGGER_API_KEYS: <YOUR_API_KEY>
DSMRREADER_REMOTE_DATALOGGER_SERIAL_PORT: /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AK47CNJV-if00-port0
DSMRREADER_REMOTE_DATALOGGER_INPUT_METHOD: serial
DSMRREADER_REMOTE_DATALOGGER_SERIAL_BAUDRATE: “115200”
DSMRREADER_REMOTE_DATALOGGER_SERIAL_BYTESIZE: “8”
DSMRREADER_REMOTE_DATALOGGER_NETWORK_HOST: x.x.x.x
DSMRREADER_REMOTE_DATALOGGER_NETWORK_PORT: x
DSMRREADER_LOGLEVEL: ERROR
DJANGO_TIME_ZONE: Europe/Amsterdam
DJANGO_SECRET_KEY: dsmrreader
DJANGO_FORCE_SCRIPT_NAME: “”
DJANGO_STATIC_URL: static/
DJANGO_X_FRAME_OPTIONS: ALLOWALL
DJANGO_CSRF_TRUSTED_ORIGINS: ``https://my-home-assistant-url.duckdns.org

And if i remove the password for the postgres database, its getting in a bootloop. And the thing that is strange is the next error in de log, what is not showing if the password is filled in like it should be.

[ FAIL ] init-validate | Missing or invalid configuration for mode: standalone (1 problem(s))

It’s look like it’s not getting the settings you copied in the timescale config.

check if its still there in de config. Because if you copy the whole piece, it won’t accept the save because there is standard all ready a rule “init_commands” in the timescale config (edit with Yaml)

I got it working by adapting timescale:

  1. Removing homeassistant under ‘timescale_enabled’
  2. Adding the init_commands

1 Like

Thanks that helped, i got it upgraded now to 6.0.2

2 Likes

I have a problem since I installes un update yesterday, At firest I thought it was an update for DSMR Reader bu I'm not sure. Might have a HA Core as well, notsure.
Anuway, the DSMR Reader wont start. In Settings, Apps, DSMR Reader. The start button keeps running (blue), so it is starting indefinitely. The DSMR Reader log says:

Blockquote
File "/opt/venv/lib/python3.14/site-packages/django/db/backends/base/base.py", line 256, in connect
self.connection = self.get_new_connection(conn_params)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/opt/venv/lib/python3.14/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/opt/venv/lib/python3.14/site-packages/django/db/backends/postgresql/base.py", line 332, in get_new_connection
connection = self.Database.connect(**conn_params)
File "/opt/venv/lib/python3.14/site-packages/psycopg2/init.py", line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: connection to server at "77b2833f-timescaledb" (fd0c:ac1e:2100::8), port 5432 failed: FATAL: no pg_hba.conf entry for host "fd0c:ac1e:2100::e", user "postgres", database "dsmrreader", no encryption
[ FAIL ] init-dsmr-and-db | Database migration failed
s6-rc: warning: unable to start service init-dsmr-and-db: command exited 1

To me it looks as if it has someting to do with timescaledb. Is this the case? if yes, how can I solve this

Adrie de Regt

Look in above posts for the solution.

Sander,

Can you point me to a number?

I added both init-commands

Timnscale log now shows:

Blockquote
[05:10:36] NOTICE: TimescaleDb is running!
2026-05-08 03:12:53.082 UTC [381] FATAL: password authentication failed for user "postgres"
2026-05-08 03:12:53.082 UTC [381] DETAIL: User "postgres" does not have a valid SCRAM secret.
Connection matched file "/data/postgres/pg_hba.conf" line 130: "host all all ::/0 scram-sha-256"
2026-05-08 03:15:35.079 UTC [262] LOG: checkpoint starting: time
2026-05-08 03:15:37.519 UTC [262] LOG: checkpoint complete: wrote 27 buffers (0.2%); 0 WAL file(s) added, 0 removed, 0 recycled; write=2.421 s, sync=0.009 s, total=2.441 s; sync files=20, longest=0.007 s, average=0.001 s; distance=98 kB, estimate=98 kB; lsn=8B/384BFC68, redo lsn=8B/384BFBD8
2026-05-08 03:18:05.658 UTC [539] FATAL: password authentication failed for user "postgres"
2026-05-08 03:18:05.658 UTC [539] DETAIL: User "postgres" does not have a valid SCRAM secret.
Connection matched file "/data/postgres/pg_hba.conf" line 130: "host all all ::/0 scram-sha-256"

DSMR Reader log still show:

Blockquote
django.db.utils.OperationalError: connection to server at "77b2833f-timescaledb" (fd0c:ac1e:2100::e), port 5432 failed: FATAL: password authentication failed for user "postgres"
[ FAIL ] init-dsmr-and-db | Database migration failed

Adrie de Regt

Checked as advised. Next step would be to set password in TimesscaleDB. How can I do this?

Adrie de Regt

For help regarding the timescale app there is a dedicated tread here Home Assistant Add-on: PostgreSQL + TimescaleDB - #181 by tldp

I think i have the solution for you. I did also had a lot of troubles, but i have it running now on 2 different machines with the same error's you have.

it's a bit of work, but if you have some knowhow of ssh, it's easy.

### Step 1: Temporary "Trust" Access

To fix the password, you first need to get into the database without a password.

1. SSH (with "Advanced SSH & Web Terminal" app) and fill in this command : 'docker exec -it addon_77b2833f_timescaledb bash'
2. Open your `pg_hba.conf` file: 'nano /data/postgres/pg_hba.conf'
3. Go to line 130 (1 from the bottum)
4. **Temporarily** change the method from `scram-sha-256` to `trust`.

> [!WARNING] Setting a method to `trust` allows **anyone** to connect without a password. Only do this long enough to fix the user, and ensure your firewall blocks external traffic during this window.
`Bash# Example change in pg_hba.conf
host    all             all             ::/0            trust`


### Step 2: Update the Password

Now that you can get in, you need to set a password that generates a proper SCRAM secret.

1. Connect to the database: `psql -U postgres`
2. Ensure your session is set to generate SCRAM hashes: `SET password_encryption = 'scram-sha-256';`
3. Update the password: `ALTER USER postgres WITH PASSWORD 'homeassistant';`
4. Exit: `\q`

---

### Step 3: Restore Security

Don't leave the door unlocked!

1. Go back into `pg_hba.conf`.
2. Change `trust` back to `scram-sha-256`.
3. Reload PostgreSQL app

And then start DSMR Reader App, and this did do the fix for me

3 Likes

I will try this. Thank you

Adrie de Regt

I have done as you suggested and it is working again now.
Thanks for your assistance.

Adrie de Regt

1 Like

Good to hear that it’s working Adrie. And thanks for the feedback :sign_of_the_horns: