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. Python GXDLMSCLient ReleaseRequest

Python GXDLMSCLient releaseRequest

By JanEef , 20 February, 2025
Forums
Gurux.DLMS

Hi,

I'm having an issue gracefully disconnecting from a device using the python package.

When I invoke the releaseRequest the following buffer is sent to the the meter:
DEBUG:root:TX: 00 01 00 01 00 01 00 09 62 03 80 01 00 03 80 01 00

This disconnect request fails because the last 4 sections of the buffer is repeated.

Using the GXDLMSDirector application disconnect and then inspecting the logs the buffer sent by the application is:
00 01 00 01 00 01 00 05 63 03 80 01 00

The last 4 sections are not repeated and the disconnect is done succesfully.
Reading through the python client I've noticed that the buffer is indeed repeated and when removing the offending code the disconnect is done successfully.

This is the method in question:
https://github.com/Gurux/Gurux.DLMS.Python/blob/master/Gurux.DLMS.pytho…

Is this a bug in the package or am I missing something?

Kind regards,
Jan

JanEef

1 year 3 months ago

def releaseRequest(self): …

    def releaseRequest(self):
        if (self.settings.connected & ConnectionState.DLMS) == 0:
            return None
        buff = GXByteBuffer()
        
        # This section is repeated below
        buff.setUInt8(3)
        buff.setUInt8(0x80)
        buff.setUInt8(1)
        buff.setUInt8(00)
        
        # Restore default values.
        self.maxReceivePDUSize = self.initializePduSize
        self.settings.setCtoSChallenge(self.initializeChallenge)
        if self.useProtectedRelease:
            # Increase IC.
            if self.settings.cipher and self.settings.cipher.isCiphered:
                self.settings.cipher.invocationCounter = (
                    self.settings.cipher.invocationCounter + 1
                )
            _GXAPDU.generateUserInformation(
                self.settings, self.settings.cipher, None, buff
            )
            buff.setUInt8(len(buff) - 1, 0)
        else:
        	# The additional bytes are added here
            buff.setUInt8(3)
            buff.setUInt8(0x80)
            buff.setUInt8(1)
            buff.setUInt8(0)

        if self.useLogicalNameReferencing:
            p = GXDLMSLNParameters(
                self.settings, 0, Command.RELEASE_REQUEST, 0, buff, None, 0xFF
            )
            reply = GXDLMS.getLnMessages(p)
        else:
            reply = GXDLMS.getSnMessages(
                GXDLMSSNParameters(
                    self.settings, Command.RELEASE_REQUEST, 0xFF, 0xFF, None, buff
                )
            )
        self.settings.connected = self.settings.connected & ~ConnectionState.DLMS
        return reply
Profile picture for user Kurumi

Kurumi

1 year 3 months ago

Hi, Thank you for pointing…

Hi,

Thank you for pointing this out. This is now fixed to version 1.0.174.

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Tue, 06/09/2026 - 11:16
    gurux.dlms.java 4.0.95
  • Tue, 06/09/2026 - 10:03
    Gurux.DLMS.Python 1.0.199
  • Mon, 06/08/2026 - 13:39
    gurux.dlms.cpp 9.0.2606.0801
  • Mon, 06/01/2026 - 10:15
    gurux.dlms.cpp 9.0.2606.0101
  • Thu, 05/28/2026 - 16:06
    gurux.dlms.java 4.0.94

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin