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 5 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 5 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

  • 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

  • Service not known error on gprs communication
  • Help Needed: Interfacing Saral 100 Energy Meter with Microcontroller via RS232
  • Connecting Meter to Agent via serial
  • Reading block profile with Compact array
  • DLMS server - serving multiple similar datasets gathered from multiple meters across distinct logical addresses
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin