I am getting errors in my application like the one below. I do not suspect the software to be faulty per-se (?), as it occurs very rarely. I do suspect my cheap USB MBUS adapter or maybe my selfmade adapter cable to flip bits sometimes. The question is, can data integrity somehow checked before processing? As the meter pushes every 10 seconds, I could easily skip one message if its integrity is violated.
Any ideas?
Martin
File "/home/pi/.local/lib/python3.9/site-packages/gurux_dlms/GXDLMSClient.py", line 1125, in getData
raise ex
File "/home/pi/.local/lib/python3.9/site-packages/gurux_dlms/GXDLMSClient.py", line 1122, in getData
ret = GXDLMS.getData(self.settings, reply, data, notify)
File "/home/pi/.local/lib/python3.9/site-packages/gurux_dlms/GXDLMS.py", line 1918, in getData
cls.getPdu(settings, target)
File "/home/pi/.local/lib/python3.9/site-packages/gurux_dlms/GXDLMS.py", line 1647, in getPdu
cls.handleGbt(settings, data)
File "/home/pi/.local/lib/python3.9/site-packages/gurux_dlms/GXDLMS.py", line 1617, in handleGbt
cls.getPdu(settings, data)
File "/home/pi/.local/lib/python3.9/site-packages/gurux_dlms/GXDLMS.py", line 1666, in getPdu
cls.handleGloDedResponse(settings, data, index)
File "/home/pi/.local/lib/python3.9/site-packages/gurux_dlms/GXDLMS.py", line 1800, in handleGloDedResponse
data.data.set(GXCiphering.decrypt(settings.cipher, p, bb))
File "/home/pi/.local/lib/python3.9/site-packages/gurux_dlms/GXCiphering.py", line 84, in decrypt
tmp = GXDLMSChippering.decryptAesGcm(p, data)
File "/home/pi/.local/lib/python3.9/site-packages/gurux_dlms/GXDLMSChippering.py", line 271, in decryptAesGcm
iv = cls.getNonse(invocationCounter, p.systemTitle)
File "/home/pi/.local/lib/python3.9/site-packages/gurux_dlms/GXDLMSChippering.py", line 54, in getNonse
nonce[0:7] = systemTitle
TypeError: cannot convert 'NoneType' object to bytearray
If your meter is using HDLC there is a checksum so the data should be the same that the meter is sending.
It seems like there is no system title on the data that meters sent. Can you catch this exception and add a hex trace here so I can check the bytes? It might be that this is a different message that is sent for some other purpose.
The only way how you can handle this is and clear the buffer in the exception handling and continue reading.
Jan 18 04:27:34 smartmeter smartmeter-datacollector[2261]: DEBUG:smartmeter:HDLC Buffer: 7E A0 8B CE FF 03 13 EE E1 E0 40 00 02 00 00 7A 0C 0B 7D AE FC 69 83 49 F7 AE 02 0B 32 33 C7 72 CB 47 93 20 85 13 C1 BA 28 EF 9F 9D 14 B7 79 28 80 4D 9E 55 6E CF 64 96 1B 96 A1 C2 62 A3 96 15 E4 5F 35 03 98 1E DF 8B E4 0C 02 1C 00 E4 7D 26 03 5A CF B0 C4 AE 3B 3B B4 2F 63 CB 1E EA 6A 98 75 86 25 EE 4B 8F F4 5C E8 66 63 E4 62 B4 65 C1 64 AD 26 C3 E2 47 9A C6 7C 4B A4 DE 49 46 C7 A1 26 25 2D 4C 92 D3 B8 B8 57 93 57 36 7E
Jan 18 04:27:34 smartmeter smartmeter-datacollector[2261]: DEBUG:smartmeter:More DLMS data expected. Not yet ready to be parsed.
Jan 18 04:27:34 smartmeter smartmeter-datacollector[2261]: DEBUG:smartmeter:HDLC Buffer: 7E A0 8B CE FF 03 13 EE E1 E0 40 00 02 00 00 7A 0C 0B 7D AE FC 69 83 49 F7 AE 02 0B 32 33 C7 72 CB 47 93 20 85 13 C1 BA 28 EF 9F 9D 14 B7 79 28 80 4D 9E 55 6E CF 64 96 1B 96 A1 C2 62 A3 96 15 E4 5F 35 03 98 1E DF 8B E4 0C 02 1C 00 E4 7D 26 03 5A CF B0 C4 AE 3B 3B B4 2F 63 CB 1E EA 6A 98 75 86 25 EE 4B 8F F4 5C E8 66 63 E4 62 B4 65 C1 64 AD 26 C3 E2 47 9A C6 7C 4B A4 DE 49 46 C7 A1 26 25 2D 4C 92 D3 B8 B8 57 93 57 36 7E 7E A0 30 CE FF 03 13 86 F8 E0 C0 00 03 00 00 1F EC 96 AE 74 5A 37 02 C3 37 48 D5 64 7D 18 34 9E 71 78 45 D9 9B B8 AA E9 72 35 18 73 2B 30 8D F7 76 7E
I got the following:
Jan 18 04:27:34 smartmeter smartmeter-datacollector[2261]: File "/home/pi/.local/lib/python3.9/site-packages/gurux_dlms/GXDLMS.py", line 1191, in handleReadResponse
Jan 18 04:27:34 smartmeter smartmeter-datacollector[2261]: raise Exception("HandleReadResponse failed. Invalid tag.")
Jan 18 04:27:34 smartmeter smartmeter-datacollector[2261]: Exception: HandleReadResponse failed. Invalid tag.
Jan 18 04:27:35 smartmeter systemd[1]: smartmeter-datacollector.service: Main process exited, code=exited, status=1/FAILURE
Jan 18 04:27:35 smartmeter systemd[1]: smartmeter-datacollector.service: Failed with result 'exit-code'.
Prior to this, the application was running for some days without any problems.
Any hints?
Hi,
Hi,
If your meter is using HDLC there is a checksum so the data should be the same that the meter is sending.
It seems like there is no system title on the data that meters sent. Can you catch this exception and add a hex trace here so I can check the bytes? It might be that this is a different message that is sent for some other purpose.
The only way how you can handle this is and clear the buffer in the exception handling and continue reading.
BR,
Mikko
After this data:
After this data:
Jan 18 04:27:34 smartmeter smartmeter-datacollector[2261]: DEBUG:smartmeter:HDLC Buffer: 7E A0 8B CE FF 03 13 EE E1 E0 40 00 02 00 00 7A 0C 0B 7D AE FC 69 83 49 F7 AE 02 0B 32 33 C7 72 CB 47 93 20 85 13 C1 BA 28 EF 9F 9D 14 B7 79 28 80 4D 9E 55 6E CF 64 96 1B 96 A1 C2 62 A3 96 15 E4 5F 35 03 98 1E DF 8B E4 0C 02 1C 00 E4 7D 26 03 5A CF B0 C4 AE 3B 3B B4 2F 63 CB 1E EA 6A 98 75 86 25 EE 4B 8F F4 5C E8 66 63 E4 62 B4 65 C1 64 AD 26 C3 E2 47 9A C6 7C 4B A4 DE 49 46 C7 A1 26 25 2D 4C 92 D3 B8 B8 57 93 57 36 7E
Jan 18 04:27:34 smartmeter smartmeter-datacollector[2261]: DEBUG:smartmeter:More DLMS data expected. Not yet ready to be parsed.
Jan 18 04:27:34 smartmeter smartmeter-datacollector[2261]: DEBUG:smartmeter:HDLC Buffer: 7E A0 8B CE FF 03 13 EE E1 E0 40 00 02 00 00 7A 0C 0B 7D AE FC 69 83 49 F7 AE 02 0B 32 33 C7 72 CB 47 93 20 85 13 C1 BA 28 EF 9F 9D 14 B7 79 28 80 4D 9E 55 6E CF 64 96 1B 96 A1 C2 62 A3 96 15 E4 5F 35 03 98 1E DF 8B E4 0C 02 1C 00 E4 7D 26 03 5A CF B0 C4 AE 3B 3B B4 2F 63 CB 1E EA 6A 98 75 86 25 EE 4B 8F F4 5C E8 66 63 E4 62 B4 65 C1 64 AD 26 C3 E2 47 9A C6 7C 4B A4 DE 49 46 C7 A1 26 25 2D 4C 92 D3 B8 B8 57 93 57 36 7E 7E A0 30 CE FF 03 13 86 F8 E0 C0 00 03 00 00 1F EC 96 AE 74 5A 37 02 C3 37 48 D5 64 7D 18 34 9E 71 78 45 D9 9B B8 AA E9 72 35 18 73 2B 30 8D F7 76 7E
I got the following:
Jan 18 04:27:34 smartmeter smartmeter-datacollector[2261]: File "/home/pi/.local/lib/python3.9/site-packages/gurux_dlms/GXDLMS.py", line 1191, in handleReadResponse
Jan 18 04:27:34 smartmeter smartmeter-datacollector[2261]: raise Exception("HandleReadResponse failed. Invalid tag.")
Jan 18 04:27:34 smartmeter smartmeter-datacollector[2261]: Exception: HandleReadResponse failed. Invalid tag.
Jan 18 04:27:35 smartmeter systemd[1]: smartmeter-datacollector.service: Main process exited, code=exited, status=1/FAILURE
Jan 18 04:27:35 smartmeter systemd[1]: smartmeter-datacollector.service: Failed with result 'exit-code'.
Prior to this, the application was running for some days without any problems.
Any hints?
Martin K
Hi,
Hi,
There are three blocks, but from the hex log, it seems that the meter isn't sending block #1 at all and sends block #2 twice.
For now, I would say that just ignore this error. I believe that the client application is capable to show the next push message without problems.
BR,
Mikko