bugfix; updated async client to CRC check

This commit is contained in:
Nigel Dokter 2016-12-29 19:20:50 +01:00
parent 4b392522c3
commit b3014823c1
2 changed files with 11 additions and 5 deletions

View File

@ -91,7 +91,7 @@ class TelegramParserV4(TelegramParser):
def parse(self, line_values): def parse(self, line_values):
self.validate_telegram_checksum(line_values) self.validate_telegram_checksum(line_values)
return super(self, TelegramParserV4).parse(line_values) return super().parse(line_values)
class TelegramParserV2_2(TelegramParser): class TelegramParserV2_2(TelegramParser):

View File

@ -8,9 +8,15 @@ from serial_asyncio import create_serial_connection
from . import telegram_specifications from . import telegram_specifications
from .exceptions import ParseError from .exceptions import ParseError
from .parsers import TelegramParser, TelegramParserV2_2 from .parsers import (
from .serial import (SERIAL_SETTINGS_V2_2, SERIAL_SETTINGS_V4, TelegramParserV2_2,
is_end_of_telegram, is_start_of_telegram) 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): 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 serial_settings = SERIAL_SETTINGS_V2_2
elif dsmr_version == '4': elif dsmr_version == '4':
specifications = telegram_specifications.V4 specifications = telegram_specifications.V4
telegram_parser = TelegramParser telegram_parser = TelegramParserV4
serial_settings = SERIAL_SETTINGS_V4 serial_settings = SERIAL_SETTINGS_V4
serial_settings['url'] = port serial_settings['url'] = port