From b3014823c1893df13b47618b8f71044d6e65f003 Mon Sep 17 00:00:00 2001 From: Nigel Dokter Date: Thu, 29 Dec 2016 19:20:50 +0100 Subject: [PATCH] bugfix; updated async client to CRC check --- dsmr_parser/parsers.py | 2 +- dsmr_parser/protocol.py | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/dsmr_parser/parsers.py b/dsmr_parser/parsers.py index 6b513b9..cf91e2c 100644 --- a/dsmr_parser/parsers.py +++ b/dsmr_parser/parsers.py @@ -91,7 +91,7 @@ class TelegramParserV4(TelegramParser): def parse(self, line_values): self.validate_telegram_checksum(line_values) - return super(self, TelegramParserV4).parse(line_values) + return super().parse(line_values) class TelegramParserV2_2(TelegramParser): diff --git a/dsmr_parser/protocol.py b/dsmr_parser/protocol.py index 812d17c..d2270e0 100644 --- a/dsmr_parser/protocol.py +++ b/dsmr_parser/protocol.py @@ -8,9 +8,15 @@ from serial_asyncio import create_serial_connection from . import telegram_specifications from .exceptions import ParseError -from .parsers import TelegramParser, TelegramParserV2_2 -from .serial import (SERIAL_SETTINGS_V2_2, SERIAL_SETTINGS_V4, - is_end_of_telegram, is_start_of_telegram) +from .parsers import ( + TelegramParserV2_2, + TelegramParserV4 +) +from .serial import ( + SERIAL_SETTINGS_V2_2, SERIAL_SETTINGS_V4, + is_end_of_telegram, + is_start_of_telegram +) def create_dsmr_reader(port, dsmr_version, telegram_callback, loop=None): @@ -22,7 +28,7 @@ def create_dsmr_reader(port, dsmr_version, telegram_callback, loop=None): serial_settings = SERIAL_SETTINGS_V2_2 elif dsmr_version == '4': specifications = telegram_specifications.V4 - telegram_parser = TelegramParser + telegram_parser = TelegramParserV4 serial_settings = SERIAL_SETTINGS_V4 serial_settings['url'] = port