Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Error Is Coming When Reading In MR Mode

Error is coming when reading in MR mode

By satishjyoti1998 , 12 July, 2024
Forums
Gurux.DLMS

Hi Mikko,

Please help for below error while reading in MR Mode.

cl = GXDLMSSecureClient()

cl.useLogicalNameReferencing = True
cl.InterfaceType = InterfaceType.HDLC
cl.authentication = Authentication.LOW
cl.clientAddress = 32
cl.serverAddress =1

cl.ciphering.Security = Security.ENCRYPTION
cl.ciphering.SystemTitle = GXCommon.hexToBytes("HEX form")
cl.ciphering.BlockCipherKey = GXCommon.hexToBytes("Hex form")
cl.ciphering.AuthenticationKey = GXCommon.hexToBytes("Hex Form")
cl.password = GXCommon.hexToBytes("Hex Form")

Authentication: 1
ClientAddress: 0x20
ServerAddress: 0x1
TX: 12:37:01 7E A0 07 03 41 93 5A 64 7E
RX: 12:37:01 7E A0 20 41 03 73 3E 9D 81 80 14 05 02 03 40 06 02 03 40 07 04 00 00 00 01 08 04 00 00 00 01 B7 29 7E
TX: 12:37:01 7E A0 44 03 41 10 B3 E1 E6 E6 00 60 36 A1 09 06 07 60 85 74 05 08 01 01 8A 02 07 80 8B 07 60 85 74 05 08 02 01 AC 0A 80 08 49 53 4B 5F 53 45 43 31 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 00 1E 5D FF FF 2D B4 7E
RX: 12:37:02 7E A0 2D 41 03 30 2E 66 E6 E7 00 61 1F A1 09 06 07 60 85 74 05 08 01 03 A2 03 02 01 01 A3 05 A1 03 02 01 01 BE 06 04 04 0E 01 06 02 00 6D 7E
Traceback (most recent call last):
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\Lib\site-packages\gurux_dlms\_GXAPDU.py", line 819, in parsePDU2
_GXAPDU.parseUserInformation(settings, cipher, buff, xml)
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\Lib\site-packages\gurux_dlms\_GXAPDU.py", line 330, in parseUserInformation
_GXAPDU.parseInitiate(False, settings, cipher, data, xml)
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\Lib\site-packages\gurux_dlms\_GXAPDU.py", line 557, in parseInitiate
_GXAPDU.parse(initiateRequest, settings, cipher, data, xml, tag)
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\Lib\site-packages\gurux_dlms\_GXAPDU.py", line 404, in parse
raise GXDLMSConfirmedServiceError(ConfirmedServiceError(data.getUInt8()), ServiceError(data.getUInt8()), data.getUInt8())
gurux_dlms.GXDLMSConfirmedServiceError.GXDLMSConfirmedServiceError: ServiceError Initiate Error exception. Initiate 2

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\Final_08072024.py", line 132, in <module>
cl.parseAareResponse(reply.data)
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\Lib\site-packages\gurux_dlms\GXDLMSClient.py", line 581, in parseAareResponse
self.isAuthenticationRequired = _GXAPDU.parsePDU(self.settings, self.settings.cipher, reply, None) == SourceDiagnostic.AUTHENTICATION_REQUIRED
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\Lib\site-packages\gurux_dlms\_GXAPDU.py", line 655, in parsePDU
ret = _GXAPDU.parsePDU2(settings, cipher, buff, xml)
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\Lib\site-packages\gurux_dlms\_GXAPDU.py", line 826, in parsePDU2
raise GXDLMSException(resultComponent, resultDiagnosticValue)
gurux_dlms.GXDLMSException.GXDLMSException: Connection is permanently rejected

No reason is given.

Profile picture for user Kurumi

Kurumi

2 years ago

Hi, I believe that your…

Hi,

I believe that your meter expects that general protection is used.
Try to add this line:

cl.proposedConformance |= Conformance.GENERAL_PROTECTION

BR,
Mikko

satishjyoti1998

2 years ago

Hi Mikko, I did what you…

Hi Mikko,

I did what you suggested but still error is coming see below code (settings to read meter in MR mode) and error:

cl.useLogicalNameReferencing = True
cl.InterfaceType = InterfaceType.HDLC
cl.authentication = Authentication.LOW
cl.clientAddress = 32
cl.serverAddress =1
cl.Password = "ISK_SEC1".encode()
cl.ciphering.Security = Security.ENCRYPTION
cl.ciphering.SystemTitle = GXByteBuffer.hexToBytes("49534B3030303031")
cl.ciphering.AuthenticationKey = GXByteBuffer.hexToBytes("000102030405060708090A0B0C0D0E0F")
cl.ciphering.BlockCipherKey = GXByteBuffer.hexToBytes("000102030405060708090A0B0C0D0E0F")
GXDLMSObject.validateLogicalName("0.0.43.1.2.255")
cl.proposedConformance = Conformance.GENERAL_PROTECTION

Authentication: 0
ClientAddress: 0x10
ServerAddress: 0x1
TX: 17:46:13 7E A0 07 03 21 93 0F 01 7E
RX: 17:46:13 7E A0 20 21 03 73 73 98 81 80 14 05 02 03 40 06 02 03 40 07 04 00 00 00 01 08 04 00 00 00 01 B7 29 7E
TX: 17:46:13 7E A0 2B 03 21 10 FB AF E6 E6 00 60 1D A1 09 06 07 60 85 74 05 08 01 01 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 00 1E 5D FF FF B3 E2 7E
RX: 17:46:14 7E A0 37 21 03 30 6C 7C E6 E7 00 61 29 A1 09 06 07 60 85 74 05 08 01 01 A2 03 02 01 00 A3 05 A1 03 02 01 00 BE 10 04 0E 08 00 06 5F 1F 04 00 00 00 10 03 40 00 07 D1 F0 7E
TX: 17:46:14 7E A0 19 03 21 32 6F D8 E6 E6 00 C0 01 C1 00 01 00 00 60 01 00 FF 02 00 89 A0 7E
RX: 17:46:14 7E A0 1B 21 03 52 1F 24 E6 E7 00 C4 01 C1 00 0A 09 55 53 30 30 30 30 30 33 32 3A 10 7E
Meter Sr. No is: US0000032
TX: 17:46:14 7E A0 19 03 21 54 5F DE E6 E6 00 C0 01 C1 00 01 00 00 2B 01 02 FF 02 00 0B B6 7E
RX: 17:46:14 7E A0 15 21 03 74 69 CE E6 E7 00 C4 01 C1 00 06 00 00 04 C1 98 A8 7E
Invovation counter Value is: 1217
DisconnectRequest
TX: 17:46:14 7E A0 07 03 21 53 03 C7 7E
RX: 17:46:14 7E A0 20 21 03 73 73 98 81 80 14 05 02 03 40 06 02 03 40 07 04 00 00 00 01 08 04 00 00 00 01 B7 29 7E
Authentication: 1
ClientAddress: 0x20
ServerAddress: 0x1
TX: 17:46:16 7E A0 07 03 41 93 5A 64 7E
RX: 17:46:17 7E A0 20 41 03 73 3E 9D 81 80 14 05 02 03 40 06 02 03 40 07 04 00 00 00 01 08 04 00 00 00 01 B7 29 7E
TX: 17:46:17 7E A0 3C 03 41 10 2E 5E E6 E6 00 60 2E A1 09 06 07 60 85 74 05 08 01 01 8A 02 07 80 8B 07 60 85 74 05 08 02 01 AC 02 80 00 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 40 00 00 03 40 BC 72 7E
RX: 17:46:17 7E A0 2D 41 03 30 2E 66 E6 E7 00 61 1F A1 09 06 07 60 85 74 05 08 01 03 A2 03 02 01 01 A3 05 A1 03 02 01 01 BE 06 04 04 0E 01 03 00 AA 30 7E
Traceback (most recent call last):
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\Lib\site-packages\gurux_dlms\_GXAPDU.py", line 819, in parsePDU2
_GXAPDU.parseUserInformation(settings, cipher, buff, xml)
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\Lib\site-packages\gurux_dlms\_GXAPDU.py", line 330, in parseUserInformation
_GXAPDU.parseInitiate(False, settings, cipher, data, xml)
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\Lib\site-packages\gurux_dlms\_GXAPDU.py", line 557, in parseInitiate
_GXAPDU.parse(initiateRequest, settings, cipher, data, xml, tag)
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\Lib\site-packages\gurux_dlms\_GXAPDU.py", line 404, in parse
raise GXDLMSConfirmedServiceError(ConfirmedServiceError(data.getUInt8()), ServiceError(data.getUInt8()), data.getUInt8())
gurux_dlms.GXDLMSConfirmedServiceError.GXDLMSConfirmedServiceError: ServiceError Initiate Error exception. Service 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\Final_08072024.py", line 191, in <module>
readdataMR()
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\Final_08072024.py", line 140, in readdataMR
cl.parseAareResponse(reply.data)
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\Lib\site-packages\gurux_dlms\GXDLMSClient.py", line 581, in parseAareResponse
self.isAuthenticationRequired = _GXAPDU.parsePDU(self.settings, self.settings.cipher, reply, None) == SourceDiagnostic.AUTHENTICATION_REQUIRED
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\Lib\site-packages\gurux_dlms\_GXAPDU.py", line 655, in parsePDU
ret = _GXAPDU.parsePDU2(settings, cipher, buff, xml)
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\Lib\site-packages\gurux_dlms\_GXAPDU.py", line 826, in parsePDU2
raise GXDLMSException(resultComponent, resultDiagnosticValue)
gurux_dlms.GXDLMSException.GXDLMSException: Connection is permanently rejected

No reason is given.

satishjyoti1998

2 years ago

Sorry, I did this but still…

Sorry, I did this but still error is coming.

settings.client.proposedConformance |= Conformance.GENERAL_PROTECTION

Profile picture for user Kurumi

Kurumi

2 years ago

Hi, You need to add the…

Hi,

You need to add the proposed conformance like this:

cl.proposedConformance = cl.proposedConformance | Conformance.GENERAL_PROTECTION

BR,
Mikko

satishjyoti1998

2 years ago

Hi Mikko, I did what you…

Hi Mikko,

I did what you suggested but still error is coming. Please find below my settings for client please check and suggest where I am doing mistakes.

client = GXDLMSSecureClient(useLogicalNameReferencing = True,clientAddress = 32, serverAddress = 1, forAuthentication = Authentication.LOW, password = bytes("ISK_SEC1",'utf-8'), interfaceType = InterfaceType.HDLC)

client.proposedConformance = client.proposedConformance | Conformance.GENERAL_PROTECTION

client.invocationCounter = "0.0.43.1.2.255"
client.ciphering.Security = Security.ENCRYPTION
client.SystemTitle = bytes("ISK00001".encode('utf-8'))
client.SystemTitle = bytes("ISK00001".encode('utf-8'))
client.ciphering.authenticationKey = bytes.fromhex("000102030405060708090A0B0C0D0E0F")
client.ciphering.blockCipherKey = bytes.fromhex("000102030405060708090A0B0C0D0E0F")

media = GXSerial(port="COM5")
media.baudRate = 9600
media.open()

reader = GXDLMSReader(client = client , media = media , trace = 0x8, invocationCounter = 0)

Authentication: 1
ClientAddress: 0x20
ServerAddress: 0x1
Standard: 0
TX: 19:43:53 7E A0 07 03 41 93 5A 64 7E
RX: 19:43:53 7E A0 20 41 03 73 3E 9D 81 80 14 05 02 03 40 06 02 03 40 07 04 00 00 00 01 08 04 00 00 00 01 B7 29 7E
TX: 19:43:53 7E A0 44 03 41 10 B3 E1 E6 E6 00 60 36 A1 09 06 07 60 85 74 05 08 01 01 8A 02 07 80 8B 07 60 85 74 05 08 02 01 AC 0A 80 08 49 53 4B 5F 53 45 43 31 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 40 1E 5D FF FF 0F 75 7E
RX: 19:43:53 7E A0 2D 41 03 30 2E 66 E6 E7 00 61 1F A1 09 06 07 60 85 74 05 08 01 03 A2 03 02 01 01 A3 05 A1 03 02 01 01 BE 06 04 04 0E 01 06 02 00 6D 7E
Traceback (most recent call last):
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\Lib\site-packages\gurux_dlms\_GXAPDU.py", line 819, in parsePDU2
_GXAPDU.parseUserInformation(settings, cipher, buff, xml)
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\Lib\site-packages\gurux_dlms\_GXAPDU.py", line 330, in parseUserInformation
_GXAPDU.parseInitiate(False, settings, cipher, data, xml)
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\Lib\site-packages\gurux_dlms\_GXAPDU.py", line 557, in parseInitiate
_GXAPDU.parse(initiateRequest, settings, cipher, data, xml, tag)
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\Lib\site-packages\gurux_dlms\_GXAPDU.py", line 404, in parse
raise GXDLMSConfirmedServiceError(ConfirmedServiceError(data.getUInt8()), ServiceError(data.getUInt8()), data.getUInt8())
gurux_dlms.GXDLMSConfirmedServiceError.GXDLMSConfirmedServiceError: ServiceError Initiate Error exception. Initiate 2

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\Final_08072024.py", line 106, in <module>
reader.initializeConnection() # First command start from here
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\GXDLMSReader.py", line 312, in initializeConnection
self.client.parseAareResponse(reply.data)
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\Lib\site-packages\gurux_dlms\GXDLMSClient.py", line 581, in parseAareResponse
self.isAuthenticationRequired = _GXAPDU.parsePDU(self.settings, self.settings.cipher, reply, None) == SourceDiagnostic.AUTHENTICATION_REQUIRED
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\Lib\site-packages\gurux_dlms\_GXAPDU.py", line 655, in parsePDU
ret = _GXAPDU.parsePDU2(settings, cipher, buff, xml)
File "C:\Users\s_paliwal\AppData\Local\Programs\Python\Python311\Lib\site-packages\gurux_dlms\_GXAPDU.py", line 826, in parsePDU2
raise GXDLMSException(resultComponent, resultDiagnosticValue)
gurux_dlms.GXDLMSException.GXDLMSException: Connection is permanently rejected

No reason is given.

Profile picture for user Kurumi

Kurumi

2 years ago

Hi, Your connection is not…

Hi,

Your connection is not secured. Change this line:

client.ciphering.Security = Security.ENCRYPTION
to:

client.ciphering.security = Security.ENCRYPTION

BR,
Mikko

satishjyoti1998

2 years ago

Hi Kurumi, I already change…

Hi Kurumi,

I already change it to client.ciphering.security = Security.ENCRYPTION

but still same error is coming. Please help me to resole the issue.

Regards
Satish

satishjyoti1998

2 years ago

Hi Mikko, Now this issue has…

Hi Mikko,

Now this issue has been resolved.

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Mon, 07/27/2026 - 12:37
    gurux.dlms.cpp 9.0.2607.2701
  • Thu, 07/23/2026 - 16:19
    gurux.dlms.java 4.0.96
  • Thu, 07/09/2026 - 14:34
    Gurux.DLMS.Python 1.0.201
  • Fri, 06/26/2026 - 16:32
    Gurux.Service 3.0.2606.2601
  • Wed, 06/24/2026 - 08:36
    Gurux.DLMS.Python 1.0.200

New forum topics

  • gurux_dlms.GXDateTime.GXDateTime object Error in Python
  • T_APPL_DATA_LN_N1 subtest 3 fails on an LN-only server regardless of the response to a non-existing-object GET
  • Version mismatch between Gurux.DLMS 9.x and Gurux.Common/Gurux.Serial 8.x
  • Service not known error on gprs communication
  • Help Needed: Interfacing Saral 100 Energy Meter with Microcontroller via RS232
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin