From a6c76fe7e18f50f90fc00f6cff97454deddff38c Mon Sep 17 00:00:00 2001 From: Mario Coray Date: Thu, 9 Sep 2021 23:21:38 +0200 Subject: [PATCH 1/4] update gurux-dlms to 1.0.107; freeze minor version nr of dependencies --- Pipfile | 6 +++--- Pipfile.lock | 8 ++++---- setup.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Pipfile b/Pipfile index 086e49b..05b07e3 100644 --- a/Pipfile +++ b/Pipfile @@ -4,9 +4,9 @@ verify_ssl = true name = "pypi" [packages] -aioserial = "~=1.3" -asyncio-mqtt = "~=0.10" -gurux-dlms = "~=1.0.104" +aioserial = "~=1.3.0" +asyncio-mqtt = "~=0.10.0" +gurux-dlms = "==1.0.107" [dev-packages] autopep8 = "*" diff --git a/Pipfile.lock b/Pipfile.lock index 3cac8ba..417da60 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "6367536ce38b926f5f7a646fc0f4e4c4c3824b1423e351cea5d9f271149a6bb9" + "sha256": "5068628c6c80cf3a86a2726b752f8aa084ba8e94b4c074bf225c82f5e131ea91" }, "pipfile-spec": 6, "requires": { @@ -34,11 +34,11 @@ }, "gurux-dlms": { "hashes": [ - "sha256:71a6f47e2b1526ac8ab10d0c0ee00fd819d758103dd3c4f5590ff67e2df2ad41", - "sha256:82c78a70f3650e094007128ef6a9102aeabb366c4363a96847652212985bee33" + "sha256:77defe59bca3f2df0111998652c2665d0241b55cea1662c2c6e7503424a66282", + "sha256:e8bf152addf13fb877538b61562911c20dfa39e96fc466073aed27ce14ac2695" ], "index": "pypi", - "version": "==1.0.104" + "version": "==1.0.107" }, "paho-mqtt": { "hashes": [ diff --git a/setup.py b/setup.py index f971c00..0ac62d9 100644 --- a/setup.py +++ b/setup.py @@ -51,7 +51,7 @@ install_requires=[ "aioserial==1.3.0", "asyncio-mqtt==0.10.0", - "gurux-dlms==1.0.104", + "gurux-dlms==1.0.107", "paho-mqtt==1.5.1", "pyserial==3.5", ], From aa440e70750acdc87f72c6fc5835c40466f9ea13 Mon Sep 17 00:00:00 2001 From: Mario Coray Date: Thu, 9 Sep 2021 23:23:12 +0200 Subject: [PATCH 2/4] use double quotes (pipenv-setup policy) --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 0ac62d9..c03a6b6 100644 --- a/setup.py +++ b/setup.py @@ -55,7 +55,7 @@ "paho-mqtt==1.5.1", "pyserial==3.5", ], - scripts=['bin/smartmeter-datacollector'], + scripts=["bin/smartmeter-datacollector"], zip_safe=True, dependency_links=[], ) From 9e85c1807e0c2bf73748c2e9298487252ef04aef Mon Sep 17 00:00:00 2001 From: Mario Coray Date: Thu, 9 Sep 2021 23:25:38 +0200 Subject: [PATCH 3/4] reduce max HDLC buffer size to 5KB (~10x default L+G meter message) --- smartmeter_datacollector/smartmeter/hdlc_dlms_parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smartmeter_datacollector/smartmeter/hdlc_dlms_parser.py b/smartmeter_datacollector/smartmeter/hdlc_dlms_parser.py index 561ce98..81a8bd3 100644 --- a/smartmeter_datacollector/smartmeter/hdlc_dlms_parser.py +++ b/smartmeter_datacollector/smartmeter/hdlc_dlms_parser.py @@ -21,7 +21,7 @@ class HdlcDlmsParser: - HDLC_BUFFER_MAX_SIZE = 10000 + HDLC_BUFFER_MAX_SIZE = 5000 def __init__(self, cosem_config: CosemConfig, block_cipher_key: str = None) -> None: if block_cipher_key: From 8cc89f8368f91fe3e7ab7680ae38a8b9cc03e0c9 Mon Sep 17 00:00:00 2001 From: Mario Coray Date: Thu, 9 Sep 2021 23:26:21 +0200 Subject: [PATCH 4/4] specify interface type in gurux client --- .../smartmeter/hdlc_dlms_parser.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/smartmeter_datacollector/smartmeter/hdlc_dlms_parser.py b/smartmeter_datacollector/smartmeter/hdlc_dlms_parser.py index 81a8bd3..bee10bb 100644 --- a/smartmeter_datacollector/smartmeter/hdlc_dlms_parser.py +++ b/smartmeter_datacollector/smartmeter/hdlc_dlms_parser.py @@ -10,7 +10,7 @@ from typing import Any, Dict, List, Optional, Tuple from gurux_dlms import GXByteBuffer, GXDateTime, GXDLMSClient, GXReplyData -from gurux_dlms.enums import ObjectType, Security +from gurux_dlms.enums import InterfaceType, ObjectType, Security from gurux_dlms.objects import GXDLMSClock, GXDLMSData, GXDLMSObject, GXDLMSRegister from gurux_dlms.secure import GXDLMSSecureClient @@ -25,13 +25,16 @@ class HdlcDlmsParser: def __init__(self, cosem_config: CosemConfig, block_cipher_key: str = None) -> None: if block_cipher_key: - self._client = GXDLMSSecureClient(True) + self._client = GXDLMSSecureClient( + useLogicalNameReferencing=True, + interfaceType=InterfaceType.HDLC) self._client.ciphering.security = Security.ENCRYPTION self._client.ciphering.blockCipherKey = GXByteBuffer.hexToBytes(block_cipher_key) else: - self._client = GXDLMSClient(True) + self._client = GXDLMSClient( + useLogicalNameReferencing=True, + interfaceType=InterfaceType.HDLC) - # self._client.settings.standard = Standard.IDIS use IDIS for ISKRA meter? self._hdlc_buffer = GXByteBuffer() self._dlms_data = GXReplyData() self._cosem = cosem_config