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. GXDLMSData

GXDLMSData

By alnardn , 2 October, 2023
Forums
Gurux.DLMS

Hello! Is it possible to manipulate relay blocker using dlms library for python? For example, I need to turn on relay blocker, how can I make it through code?

Profile picture for user Kurumi

Kurumi

2 years 8 months ago

Hi, I believe that you need…

Hi,

I believe that you need disconnect control to do it.
Because I don't know what meter you are using, you need to read the association view and check if GXDLMSDisconnectControl is included.

Then you can use remoteDisconnect and remoteReconnect methods to close the valve.

BR,
Mikko

alnardn

2 years 8 months ago

Thanks for your answer! I…

Thanks for your answer! I checked these methods in GXDLMSDisconnectContol.py, what is parameter named client? This parameter has method "method" and i don't undestand for what object parameter relates.

Profile picture for user Kurumi

Kurumi

2 years 8 months ago

Hi, You can use it like this…

Hi,

You can use it like this:

d = GXDLMSDisconnectControl("YOUR_OBIS_CODE")
#Or find disconnect control from the self.client.objects if you have read the association view.

#Disconnect
self.readDataBlock(d.remoteDisconnect(self.client), reply)
#Reconnect
self.readDataBlock(d.remoteReconnect(self.client), reply)

BR,
Mikko

alnardn

2 years 8 months ago

Self.client - from what…

Self.client - from what class we take it? And this client is GXDLMSClient?

Profile picture for user Kurumi

Kurumi

2 years 8 months ago

Hi, Use GXDLMSReader.py and…

Hi,

Use GXDLMSReader.py and the client is GXDLMSClient.

BR,
Mikko

alnardn

2 years 8 months ago

Thank you! I tried to call…

Thank you! I tried to call remoteReconnect like you recommended, but it failed with error that this method takes only two arguments. I read one more time script GXDLMSDisconnectControl.py and used it as "rele.remoteReconnect(client)". Anyway connection was not established. There is my code:
client = GXDLMSClient(clientAddress=48)
settings = GXSettings()
settings.getParameters(['', '-S', 'COM15', '-c', '48', '-s', '1'])
reader = GXDLMSReader(settings.client, settings.media, settings.trace, settings.invocationCounter)
settings.media.open()
reader.initializeConnection()
rele = GXDLMSDisconnectControl("0.0.96.3.10.255")
rele.remoteReconnect(client)
print(rele.controlState)
# prints DISCONNECTED
Where did i make mistake?

Profile picture for user Kurumi

Kurumi

2 years 8 months ago

Hi, You need to change at…

Hi,

You need to change at least this:

rele.remoteReconnect(client)
to

self.readDataBlock(rele.remoteReconnect(settings.client), reply)

remoteReconnect only generates the bytes. It doesn't send them to the meter.

BR,
Mikko

alnardn

2 years 8 months ago

And how to change mode of…

It worked, but remoteReconnect changes relay state to "ready for reconnection", is there a way to exactly turn on rele?

Profile picture for user Kurumi

Kurumi

2 years 8 months ago

Hi, You need to change…

Hi,

You need to change control_mode to 2 or 4.. Then the relay is connected directly without manual intervention.

BR,

Mikko

alnardn

2 years 8 months ago

How can I change the mode? I…

How can I change the mode? I saw another topic on forum https://www.gurux.fi/Gurux.DLMS.Objects.GXDLMSDisconnectControl and read comments below. I didn't understand what is lector.write(rele,4), for example.

Profile picture for user Kurumi

Kurumi

2 years 8 months ago

Hi, You can change it like…

Hi,

You can change it like this:

rele = GXDLMSDisconnectControl("0.0.96.3.10.255")
rele.controlMode = ControlMode.MODE_2
self.write(rele, 4)

BR,
Mikko

alnardn

2 years 8 months ago

Thank you for fast responce…

Thank you for fast responce. Method write from GXDLMSReader or GXDLMSClient?

alnardn

2 years 8 months ago

Thank you very much for help…

Thank you very much for help. Finally I figured it out.

  • 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