DSMR Reader Add-on for Home Assistant

2022-12-03: DSMR Reader Add-on v1.9.0, DSMR-reader v5.9
Changelog here

1 Like

Problem “solved”.

Vacuum timescale db with pgadmin.
And the error was gone. Was a bit of scared to do this, because it’s a db for dsmr. But did made a backup. And also I remember that dsmr has also his own db. So al history data was save. Timescale did shrink from >500mb to 50mb :joy:

And thanks for the new update @sanderdw. Works great :ok_hand:t2:

1 Like

It may be coincidence, but I’ve just upgraded my HA OS to version 9.4, and now the DSMR Reader add-on (version 1.9.0) is no longer working. It crashes every time I restart it.

image

I’m also struggling to get it back working again. Didn’t had any clue why but upgrading to 9.4 could also be the problem here.

EDIT: Did a reinstall and it start working again but still have problems with and DSMRreader & Z2M. Got my Z2M in ttyUSB0 and my p1 usb dongle in ttyUSB1. I see in the dsmr reader logs while booting it fixes both? Maybe that’s the issue?

[ INFO ] Fixing /dev/ttyUSB* security…
chmod: changing permissions of ‘/dev/ttyUSB0’: Read-only file system
chmod: changing permissions of ‘/dev/ttyUSB1’: Read-only file system

6h later, it worked for a while but after some time my zigbee devices seem uncontrollable. The USB devices shift from ttyUSB0/ttyUSB1 with reboots. Till now the sollution was to change the settings in the apps. As my zigbee devices are important I’ve turned off DSMR reader add-on.

What is the setup you are using? P1 USB receiver directly in this machine?

Maybe try to do a full boot without the usb device attached and afterwards do a full reboot again with the reader attached again (try another usb port as well).

Thanks, that seemed to do the trick.

I’m using a P1 USB dongle plugged into my RPi4. The red LED was flashing every second even when DSMR reader had crashed.

  1. I unplugged the dongle and pulled the power on the RPi4.
  2. I reconnected power to the RPi4.
  3. I waited until HA and the DSMR Reader were fully started, and then reconnected the dongle.

It now seems to be reading in the data and DSMR reader is running correctly.

Hi,

I installed the timescaledb addon and configured it, from the log it seems that it is working.
I also installed this plugin and configured it (configured the correct USB device …/dev/ttyUSB1 in my case) and I could see that it is connecting to the database and things seems working … but I do not get any data and I get the following error:

2022-12-20 22:15:28,451 DEBUG    dsmr_datalogger_api_client read_telegram                    58 | [2022-12-20 22:15:28.450897] Read 0 Byte(s)
2022-12-20 22:15:28,456 ERROR    mixins       run_once                        107 | dsmr_datalogger.management.commands.dsmr_datalogger: [!] Exception raised. Traceback (most recent call last):
  File "/app/dsmr_backend/mixins.py", line 96, in run_once
    self.run(data=self.data, **options)
  File "/app/dsmr_datalogger/management/commands/dsmr_datalogger.py", line 29, in run
    telegram = next(self.telegram_generator)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/dsmr_datalogger/scripts/dsmr_datalogger_api_client.py", line 51, in read_telegram
    raise RuntimeError(
RuntimeError: It took too long to detect a telegram. Check connection params. Bytes currently in buffer: 0

Any idea?
Could the meter be locked on the P1 interface?
I have an E360 Landis+Gyr meter and I bought the USB-P1 cable special for this meter.

Just started with Home Assistant primarily because I wanted to get more insights in my energy usage. I was very happy to find the DSMR-reader and set out to make it work. My HA knowledge on a scale from 1 – 10 is about 2. So it took some trail and error time to get it to work.

For the noobs like me I have some tips for the installation and configuration:

  1. Install HA Addon … : The only thing I added from the standard installation was the ‘dsmrreader’ database in the configuration.

image

  1. Configure the HA…. : I left the Webserver configuration as it was and only added the host data.

  1. Go to Datalogger …… : The standard settings worked for me

After a restart of HA, the P1 data was showing up in DSMR-reader.

Now I wanted to install the Home Assistant integration to get the data in HA and use it in the new Energy dashboard.

I already had the MQTT broker installed. Configured the MQTT setting in HA. Used the same settings in the MQTT broker. Used the same settings again in the ‘DSMR-reader MQTT broker/verbinding’. Restarted HA and everything worked like a charm.

image

Hope this helps somebody.

@sanderw, top werk! Heel erg bedankt.

Thanks for the compliments and instructions :slight_smile:

@sanderdw during our family’s christmas dinner the 3 gourmetsets draw too many and the fuses blew a couple of times…:slight_smile: Now the telegrams seems to be stuck , cannot be delivered.

RuntimeError: It took too long to detect a telegram. Check connection params. Bytes currently in buffer: 12

Is there a way to reset the reader or database, so i have up to date stats??

Was Home Assistant rebooted because of the fuse blow? Most likely the USB port has changed then so try to configure this again. See DSMR Reader Add-on for Home Assistant - #326 by gcoupe as an example.

Yeah, checked that already. Configured the usb adapter by ID, so that didn’t 2022-12-27 09:35:08,515 ERROR mixins run_once 107 | dsmr_datalogger.management.commands.dsmr_datalogger: [!] Exception raised. Traceback (most recent call last):
File “/app/dsmr_backend/mixins.py”, line 96, in run_once
self.run(data=self.data, **options)
File “/app/dsmr_datalogger/management/commands/dsmr_datalogger.py”, line 29, in run
telegram = next(self.telegram_generator)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/app/dsmr_datalogger/scripts/dsmr_datalogger_api_client.py”, line 51, in read_telegram
raise RuntimeError(
RuntimeError: It took too long to detect a telegram. Check connection params. Bytes currently in buffer: 12
Starting DSMR Reader - datalogger…
127.0.0.1 - - [27/Dec/2022:09:35:15 +0100] “GET /about HTTP/1.1” 200 15871 “-” “curl/7.83.1” “-”
Current logging level set to “ERROR”. More information can be found here: Troubleshooting: Enable DEBUG logging — DSMR-reader v5 documentation’’’

Mmm, block quotes from iphone are not ideal…:smiley:

Yes using an id normally should prevent these kind of issues but try to unplug, reboot, plug it again anyway and use the raw usb port to see if it helps.

Hi,

I am new to HA and need some advise.
I want to gain insight in my energy consumption (gas + electricity) by using HA.
I am looking into two possible solutions:

  1. DMSR Reader add-on + DSMR Reader integration
  2. DSMR Slimme Meter integration

Can someone explain me the difference between the two options and give a recommendation?
Is the first option not duplicating the amount of data from the DSMR Reader db to the HA db?
Can both options be used by the HA energy dashboard?

I am thinking about buying an ODROID N2+ device with 128GB eMMC storage for it.
Would that setup work, or is an Intel NUC + SSD needed? The latter would use more power, so is not my initial choice.

Thanks for your help.

Yes with both options you can use the itegrated HA energy dasboard.

With option 1 - DMSR Reader add-on you have all the extra functionality of About DSMR-reader — DSMR-reader v5 documentation such as cost insights by adding your energy contract(s).
With option 2 you are limited to the functionality of the HA energy dashboard.

As for hardware, eMMC storage is sufficient for both options.

Sander,

Thanks for your effort, got it back working again. Did not change anything in the setup, but several reboots made it pop up again…

One other question: recently moved to another new energy companies in NL: Tibber. I dont think there is support for hourly changing tariff in DSMR right now, am i right?? Any ways to get accurate data for daily costs that you know of??

Thanks in advance,
D

Hi,

is there a way to provide non Admin Ha users access to dsmr reader?
thanks in advance

Hi Sander,

I want to change the default password in the DSMR-reader configuration UI (link in top right corner).
After I changed my password then the login works with the new password.
However after a reboot then the new password doesn’t work anymore and I have to use the default one again.
Is this normal? Or can it be fixed?
Thanks,
Jeroen

Yes, to make it persistent just change it in the addon configuration page.