From ec1d37ea08ee772bac75d640ac08b9fee8c8363a Mon Sep 17 00:00:00 2001 From: dunajski Date: Mon, 28 Sep 2020 10:22:16 +0200 Subject: [PATCH] Corrects example telegrams. In example telegrams there a few mistakes in header strings. Using '\' in strings have special feature to add to string some non-printable characters, for example to add new line we can add \n for tab \t etc. So whenever we want to just print backslash as normal character we have to add another '\' before. In short string "On\\Off" prints "On\Off" ascii string. In enquired telegrams there are few strings with \2 sign in header, '/ISk5\2MT382-1000\r\n' and when we calculate CRC for whole given telegram part of "..\2.." is interpreted as one character (value 0x02) instead of two characters ('\', '2'). I think in a header in the example enlosed in P1 DSMR Companion Standard /ISk5\2.. stand for printable '\' and '2' character instead of "converted" to special '\2' character. --- test/example_telegrams.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/example_telegrams.py b/test/example_telegrams.py index 2df8606..143b2a4 100644 --- a/test/example_telegrams.py +++ b/test/example_telegrams.py @@ -1,5 +1,5 @@ TELEGRAM_V2_2 = ( - '/ISk5\2MT382-1004\r\n' + '/ISk5\\2MT382-1004\r\n' '\r\n' '0-0:96.1.1(00000000000000)\r\n' '1-0:1.8.1(00001.001*kWh)\r\n' @@ -22,7 +22,7 @@ TELEGRAM_V2_2 = ( ) TELEGRAM_V3 = ( - '/ISk5\2MT382-1000\r\n' + '/ISk5\\2MT382-1000\r\n' '\r\n' '0-0:96.1.1(4B384547303034303436333935353037)\r\n' '1-0:1.8.1(12345.678*kWh)\r\n' @@ -87,7 +87,7 @@ TELEGRAM_V4_2 = ( ) TELEGRAM_V5 = ( - '/ISk5\2MT382-1000\r\n' + '/ISk5\\2MT382-1000\r\n' '\r\n' '1-3:0.2.8(50)\r\n' '0-0:1.0.0(170102192002W)\r\n' @@ -126,5 +126,5 @@ TELEGRAM_V5 = ( '0-1:24.2.1(170102161005W)(00000.107*m3)\r\n' '0-2:24.1.0(003)\r\n' '0-2:96.1.0()\r\n' - '!87B3\r\n' -) + '!6EEE\r\n' +) \ No newline at end of file