Skip to main content
Home
for DLMS smart meters

Main navigation

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

Breadcrumb

  1. Home
  2. AttributeError: 'GXDLMSClient' Has No Attribute 'ciphering'

AttributeError: 'GXDLMSClient' has no attribute 'ciphering'

By KavyaYanamandra, 15 January, 2025
Forums
Gurux.Serial

HI Mikko,

I am attempting to access 16 associations in my meter using the GXDLMS library. During the setup process, I encountered an error when trying to set the ciphering security to Security.NONE. The error message states:

AttributeError: 'GXDLMSClient' object has no attribute 'ciphering'.

Setup Details:

Serial Port: COM3, configured with 9600 baud rate, 8 data bits, no parity, and 1 stop bit.
Client Address: 16
Server Address: 1
Authentication: NONE
Interface Type: HDLC

and I code I wrote is:

import threading
import tkinter as tk
import tkinter.ttk as ttk
from tkinter.constants import *
from gurux_dlms import GXDLMSException, GXDLMSExceptionResponse, GXDLMSConfirmedServiceError
import logging
import gurux_common
from logging.handlers import TimedRotatingFileHandler
from tkinter import messagebox
import datetime
from tkinter import Toplevel
from tkinter import OptionMenu
from tkcalendar import Calendar
import subprocess
from gurux_dlms.enums import Authentication, AssociationResult, SourceDiagnostic
from gurux_dlms.GXDLMSClient import GXDLMSClient
from gurux_dlms import GXReplyData
from gurux_dlms.enums import Security, InterfaceType
from gurux_dlms import GXDLMSConverter
from gurux_dlms import GXByteBuffer, GXReplyData, GXDLMSTranslator
from gurux_net import GXNet
from gurux_serial import GXSerial
import os
from gurux_dlms.objects import GXDLMSObjectCollection
from gurux_dlms.secure.GXDLMSSecureClient import GXDLMSSecureClient
import serial
from gurux_dlms.enums import Security, InterfaceType
from gurux_dlms import GXDLMSReader
from gurux_dlms.GXSettings import GXSettings
from gurux_dlms.GXDLMSReader import GXDLMSReader
from gurux_dlms.objects import *
from datetime import datetime
import time
from tabulate import tabulate
from gurux_dlms import GXDLMSException
from gurux_common import ReceiveParameters, TimeoutException
from gurux_common.enums import TraceLevel
from gurux_dlms.enums import ObjectType
import traceback
from gurux_dlms import GXCiphering
from gurux_dlms.GXCiphering import SecuritySuite
from gurux_dlms.enums.Standard import Standard
from gurux_dlms import ConnectionState
#from profile_generic1 import Text1
global ser, connected, baudrate_selected, comp_selected, str_port
ser = GXSerial(port= "COM3")
ser.__setBaudRate = int(9600)
ser.__setDataBits=8
ser.__setStopBits=1
ser.__setParity=0
ser.open()
print(type(ser))
print(ser)

print("Connection Function called")
print("Connection Function called")
settings=GXSettings()
client=GXDLMSClient()
sc = GXDLMSSecureClient()
settings.media = ser

if ser.isOpen():
print('if - 1')
settings.client.useLogicalNameReferencing = True
settings.client.clientAddress = 16
settings.client.serverAddress = 1
settings.client.authentication = Authentication.NONE
settings.client.interfaceType = InterfaceType.HDLC
settings.trace = TraceLevel.INFO
settings.outputFile = "output.xml"
settings.client.ciphering.security = Security.NONE
if isinstance(settings.media, GXSerial):
print("Serial port opened")
reader = None
reader= GXDLMSReader(settings.client, settings.media, settings.trace, settings.invocationCounter)
reader.initializeConnection()
#o = GXDLMSReader(settings.client, settings.media, , settings.invocationCounter)
print("Initilized")
id = "0.0.1.0.0.255"
d =GXDLMSClock(ln=id)
clock=reader.read(d, 2)
timezone = reader.read(d,3)
print(clock)
print(timezone)

Could you confirm if the GXDLMSClient class supports the ciphering attribute? If so, is there an alternative way to configure the ciphering security? Additionally, if any updates or corrections are required, please guide me on the next steps to resolve this issue.

Regards

Kavya

Profile picture for user Kurumi

Kurumi

1 year 1 month ago

Hi, You must use…

Hi,

You must use GXDLMSSecureClient, not GXDLMSClient.

Check the client example for Python.

https://github.com/Gurux/Gurux.DLMS.Python/tree/master/Gurux.DLMS.Clien…

BR,
Mikko

KavyaYanamandra

1 year 1 month ago

Hi Mikko, I am working on a…

Hi Mikko,

I am working on a Python application using the Gurux GXDLMS library and need assistance with managing the invocation counter dynamically. Specifically, the counter value should be retrieved from the 16 association (logical name: 0.0.43.1.3.255) and then updated dynamically in the 48 association. The update can either use the exact value retrieved from the 16 association or apply an increment (e.g., adding +1 or +10 to the retrieved value). I would appreciate guidance or examples on how to implement this functionality effectively to ensure accurate and dynamic updates.

####
as this is code i wrote individually for 16 association and read the invocation counter from the meter:
#####

# Initialize GXSerial connection
ser = GXSerial(port="COM3")
ser.__setBaudRate = int(9600)
ser.__setDataBits = 8
ser.__setStopBits = 1
ser.__setParity = 0
ser.open()

if ser.isOpen():
print("Serial port opened")

# Initialize settings and secure client
settings = GXSettings()
client = GXDLMSSecureClient()

# Assign the client and media to settings
settings.client = client
settings.media = ser
settings.trace = TraceLevel.INFO
settings.outputFile = "output.xml"
# Client properties
client.useLogicalNameReferencing= True
client.clientAddress=16
client.serverAddress=1
client.forAuthentication=Authentication.NONE
client.password=None
client.interfaceType=InterfaceType.HDLC

try:
# Initialize GXDLMSReader
reader = GXDLMSReader(client, ser, TraceLevel.INFO, invocationCounter=1)
reader.initializeConnection()

invocation_counter = GXDLMSData("0.0.43.1.3.255")
#invocation_counter = reader.invocationCounter
#invocation_counter += 10 # Or +1 as needed
invocation_counter = reader.read(invocation_counter,2)

# Use the updated invocation counter in subsequent requests
# reader.invocationCounter = invocation_counter

print("Updated Invocation Counter:", invocation_counter)

except Exception as ex:
print("Error during connection or reading:", ex)
finally:
ser.close()

##############################################
and this is my settings of 48 association i gave in my application:

settings = GXSettings()
global disc
settings.media = ser
reader = None
reader= GXDLMSReader(settings.client, settings.media, settings.trace, settings.invocationCounter)
settings.client.ciphering.security= Security.AUTHENTICATION_ENCRYPTION
settings.client.ciphering.blockCipherKey = bytes(str(Entry4.get()), encoding="UTF-8")
settings.client.ciphering.authenticationKey = bytes(str(Entry5.get()), encoding='UTF-8')
settings.client.ciphering.dedicatedKey = bytes(str(Entry6.get()), encoding="UTF-8")
settings.client.password = str(Entry1.get())
settings.client.clientAddress = 48
settings.client.serverAddress = 1
settings.trace = TraceLevel.INFO
settings.outputFile = "output.xml"
settings.client.ciphering.Security = SecuritySuite.AES_GCM_128
settings.client.hdlcSettings.DEFAULT_WINDOWS_SIZE_TX = 1
settings.client.hdlcSettings.DEFAULT_WINDOWS_SIZE_RX = 1
settings.client.isAuthenticationRequired = SourceDiagnostic.AUTHENTICATION_REQUIRED
settings.client.authentication = Authentication.HIGH

Regards

Kavya

Profile picture for user Kurumi

Kurumi

1 year 1 month ago

Hi Kavya, I can help you…

Hi Kavya,

I can help you with DLMS problems, but I can't help you with programming questions. Check the client example. It will do, what you want to do.

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Thu, 02/19/2026 - 11:51
    gurux.dlms.cpp 9.0.2602.1901
  • Sun, 02/01/2026 - 19:47
    gurux.dlms.cpp 9.0.2602.0101
  • Tue, 01/20/2026 - 10:38
    gurux.dlms.java 4.0.89
  • Wed, 01/14/2026 - 14:29
    Gurux.DLMS.Python 1.0.196
  • Mon, 12/29/2025 - 10:38
    Gurux.Serial.Android 3.0.5

New forum topics

  • Gurux C library DLMS book edition support
  • Help with connection and read with landis+gyr e650 + CU-E22 using python
  • Preestablished connection
  • RJ11 to RS232 Pin out SECURE Premier 300
  • GENUS sugam 3 PH bidirectional
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin