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?
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.
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.
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?
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
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.
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
Self.client - from what…
Self.client - from what class we take it? And this client is GXDLMSClient?
Hi, Use GXDLMSReader.py and…
Hi,
Use GXDLMSReader.py and the client is GXDLMSClient.
BR,
Mikko
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?
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
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?
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
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.
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
Thank you for fast responce…
Thank you for fast responce. Method write from GXDLMSReader or GXDLMSClient?
Thank you very much for help…
Thank you very much for help. Finally I figured it out.