DSMR Reader Add-on for Home Assistant

2024-04-16: DSMR Reader Add-on v 1.11.1, DSMR-reader v5.11
Changelog here

2 Likes

I experience an issue, possibly related to this reported issue.
The quick and dirty solution is to restart the add-on periodically. A small blueprint is a temporary solution:

alias: DSMR reader herstart
description: ""
trigger:
  - platform: time_pattern
    minutes: /10
condition: []
action:
  - service: hassio.addon_restart
    metadata: {}
    data:
      addon: 0826754b_dsmr_reader
mode: single

Bssed on the reported issue i created a new release as stability is essential. @EDouna , can you let me know if the issue is temperarly resolved with this release?

2024-04-17: DSMR Reader Add-on v 1.11.2, DSMR-reader v5.11
Changelog here

On it. Downloading and I will monitor it - I’ll keep you posted.

At first sight this seems to stabilize my situation. Further details are shared on Github. Thanks Sander!

2024-04-22: DSMR Reader Add-on v1.11.3, DSMR-reader v5.11
Changelog here

1 Like

@broekieman ik heb dit net gepost: How to get Homewizard P1 meter telegrams into DSMR Reader using automations - Share your Projects! - Home Assistant Community (home-assistant.io)

I run the latest addon. and when I use ingress link to check dsmr everything went well. If i want to login i got a error.
I use nginx proxy manager to enter my domain: https://domainxxx.nl
Ho can I solve this?

Verboden (403)

CSRF-verificatie mislukt. Aanvraag afgebroken.

U ziet deze melding, omdat deze HTTPS-website vereist dat uw webbrowser een ‘Referer header’ meestuurt, maar deze ontbreekt. Deze header is om veiligheidsredenen vereist om er zeker van te zijn dat uw browser niet door derden wordt gekaapt.

Als u ‘Referer’-headers in uw browser hebt uitgeschakeld, schakel deze dan weer in, op zijn minst voor deze website, of voor HTTPS-verbindingen, of voor ‘same-origin’-aanvragen.

Als u de tag gebruikt of de header ‘Referrer-Policy: no-referrer’ opneemt, verwijder deze dan. De CSRF-bescherming vereist de ‘Referer’-header voor strenge referer-controle. Als u bezorgd bent om privacy, gebruik dan alternatieven zoals <a rel=“noreferrer” …> voor koppelingen naar websites van derden.

1 Like

Team,

What state_class should my DSMR entities have?

Currently the have a state_class of total_increasing

However, if you read the documentation explaining the differences between the 3 state_classes, it looks like I should be using total instead? Quote:

TOTAL The state represents a total amount that can both increase and decrease, e.g. a net energy meter. Statistics of the accumulated growth or decline of the sensor’s value since it was first added is updated every 5 minutes. This state class should not be used for sensors where the absolute value is interesting instead of the accumulated growth or decline, for example remaining battery capacity or CPU load; in such cases state class measurement should be used instead.|
TOTAL_INCREASING Similar to total, with the restriction that the state represents a monotonically increasing positive total which periodically restarts counting from 0, e.g. a daily amount of consumed gas, weekly water consumption or lifetime energy consumption. Statistics of the accumulated growth of the sensor’s value since it was first added is updated every 5 minutes. A decreasing value is interpreted as the start of a new meter cycle or the replacement of the meter.

Reading this it looks like the “_increasing” total has the ability to reset itself to zero

  1. “as start of a new cycle” (which should never happen with an energy meter?)
  2. “which periodically restarts counting from 0” - which you never want from the main energy meter?
  3. “the replacement of a meter”, which hardly ever happens? (and couldn’t that be done with state_class: total?

So the question is: should the main energy meters have state_class TOTAL ?

Same problem. seems to be a problem at dsmr-reader, see link below.
I have not found a solution for this add-on.

https://github.com/dsmrreader/dsmr-reader/issues/2001

When restarting HA it takes about 45 minutes before DSMR reader is available.
During this time non of the sensors are updated too.

Any idea what can cause this ?

Hi all,

about three weeks ago all of a sudden the add-on stopped working. I tried a lot already (changing configurations, looking at this forum, reinstall the add-on and integration, use a different P1 cable), but the last message processed is three weeks ago. The error message I get is:

2024-11-12 11:58:43,631 ERROR    mixins       run_once                        107 | dsmr_datalogger.management.commands.dsmr_datalogger: [!] Exception raised. Traceback (most recent call last):
  File "/app/dsmr_datalogger/scripts/dsmr_datalogger_api_client.py", line 39, in read_telegram
    serial_handle = serial.serial_for_url(
                    ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/serial/__init__.py", line 90, in serial_for_url
    instance.open()
  File "/usr/local/lib/python3.11/site-packages/serial/serialposix.py", line 336, in open
    self._update_dtr_state()
  File "/usr/local/lib/python3.11/site-packages/serial/serialposix.py", line 713, in _update_dtr_state
    fcntl.ioctl(self.fd, TIOCMBIS, TIOCM_DTR_str)
OSError: [Errno 5] I/O error
The above exception was the direct cause of the following exception:
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 43, in read_telegram
    raise RuntimeError("Failed to connect: {}", error) from error
RuntimeError: ('Failed to connect: {}', OSError(5, 'I/O error'))
2024-11-12 11:58:43,632 INFO     mixins       _stop                           138 | dsmr_datalogger.management.commands.dsmr_datalogger: Exiting on next run...

Does anyone know what to do?

Hi Jaap, can you dubbel check the usb port configuration? Sometimes it can happen that the p1 usb reader pops up on a other internal USB bus. Go to settings → System → hardware → All hardware and lookup the correct USB port in the list:

This is mine:

Hi Sander,

Thanks for your response!
It looks the same:

.

And what are your current settings in the addon?




Hi, I’m looking to recalculate my prices. I found out that to do that, I need to do this first:

Note: Need to perform commands on the commandline? After entering the container bash ("docker exec -it addon_0826754b_dsmr_reader bash ") you need to execute this command ". /cli-helper.sh " to apply the settings correctly from the addon Configuration tab.

and then sudo su - dsmr
./manage.py dsmr_stats_recalculate_prices

However, I get lost in the first step.

When I go to the HA Console in Proxmox and do “docker exec -it addon_0826754b_dsmr_reader bash”

I get Error while executing rootCmd: unknown shorthand flag: ‘i’ in -it

When I do it in the SSH and Terminal add on, or in the Portainer console of the DSMR container, I just get bash: docker: command not found

Where and how should I do this?

Looks fine indeed. Try a power off, remove the P1 USB, power on, shut down again, plug the P1 USB back in and power on?

Yes, so that command is used to get into the addon cli. So you are using Proxmox, not sure what your setup is like? Can you do a ‘docker ps’ command? You should see the addon somewhere.

“Did you try Turning it off and on again?”… Haha this actually worked! I restarted HA a few times, but was not aware this does not restart the Raspberry. I now restarted the Raspberry and that fixed it.

Thanks a lot!

1 Like