ndokter / dsmr_parser

Library to parse Dutch Smart Meter Requirements (DSMR) telegrams.
MIT License
110 stars 64 forks source link

add special option for Landis+Gyr E360 (DMSR 5 with serial version 4) #82

Closed Lennart99 closed 2 years ago

Lennart99 commented 3 years ago

Recently I tried setting up the dsmr integration for Home Assistant (https://www.home-assistant.io/integrations/dsmr/) for the Landis+Gyr E360 SMR 5.0 meter we have. I found that I would get a lot of errors when using version 5 while I would miss information when using 4, while I can see this information when reading the serial messages myself. I therefore tried to set the serial version to 4 and the protocol version to 5. This seems to work really well for me.

Because of this, I have added an option for this in the library. I called the option "4+" for now, suggestions for the name are welcome. I have also tested it in Home Assistant by slightly changing the integration to accept the "4+" version.

alex-mikhaylov commented 2 years ago

Hi @Lennart99, I have the same meter and facing issues with the integration, my telegrams are not being read at all. I would like to try out your fix on my instance and it doesn't look like it will be merged with anytime soon. How can I apply your fix locally?

Lennart99 commented 2 years ago

Yeah, it's a shame the author doesn't respond. you should probably first try it with just the library and no HA, as that makes debugging a lot easier Using telegram_specifications.V5 and SERIAL_SETTINGS_V4 has the same effect as my proposed setting.

from dsmr_parser import telegram_specifications
from dsmr_parser.clients import SerialReader, SERIAL_SETTINGS_V4

serial_reader = SerialReader(
    device='/dev/ttyUSB0',
    serial_settings=SERIAL_SETTINGS_V4,
    telegram_specification=telegram_specifications.V5
)

for telegram in serial_reader.read():
    print(telegram)

This works with the normal version of the library