How to remotely reset logged data on SDM630V2 Modbus power meter

1,760 views
Skip to first unread message

Tony Kuiper

unread,
Apr 22, 2019, 12:07:01 AM4/22/19
to pymodbus
Hi there...

I have been reading data off an SDM630 for a little while now and would like to get a daily kwh usage number.
There is a register on the meter (30073 Import since last reset 0x048) which shows the aggregated kwh going through the meter.
I would like to reset this at midnight each night to get a daily figure.

I have tried a few ways of writing to the holding register (40217 reset logged data 0x0d8) to send it a code 2 to reset to zero but it wont take.
The subsequent read of the import register still shows the same aggregating value.

The script does not fail to execute however.

(some of the code may be superfluous as its recycled)

#!/usr/bin/env python
import sys
import httplib
import signal
import socket
import time
from pymodbus.constants import Endian
from pymodbus.constants import Defaults
from pymodbus.payload import BinaryPayloadDecoder
from pymodbus.client.sync import ModbusSerialClient as ModbusClient
from pymodbus.transaction import ModbusRtuFramer

DEBUG = 1
client = ModbusClient(method='rtu', port='/dev/ttyUSB0', stopbits=1, bytesize=8, timeout=0.55, baudrate=9600, parity='N')
client.connect()
global M1Exp, M1Imp, REGVALUE

client.write_register(0x0d8, 2, unit=1)
time.sleep(5)

checkregs = client.read_input_registers(0x048, 4, unit=1)
checkholds = client.read_holding_registers(0x0D8, 2, unit=1)
decoder1 = BinaryPayloadDecoder.fromRegisters(checkregs.registers, byteorder=Endian.Big, wordorder=Endian.Big)
decoder2 = BinaryPayloadDecoder.fromRegisters(checkholds.registers, byteorder=Endian.Big, wordorder=Endian.Big)
REGVALUE = decoder2.decode_32bit_float()
M1Imp = decoder1.decode_32bit_float()
M1Exp = decoder1.decode_32bit_float()

print "REGVALUE: %.2f M1Exp: %.2f M1Imp: %.2f" % (REGVALUE, M1Exp, M1Imp)



Has anyone done this remotely with this meter and could they share the code line to make it stick?

Thanks


Eastron Modbus Registers.pdf

Galen Collins

unread,
Apr 22, 2019, 11:37:19 AM4/22/19
to pymo...@googlegroups.com
After reading the documentation, it says it wants 'function code 16' which would be WriteMultipleRegistersRequest
Next, check what byte order you have your device set as (register 40041 value 2141 will be in big endian 0x085d / little endian 0x5d08)

So you may need to write your value in little endian (0x0200)

```
client.write_registers(0x00d8, [0x0002], unit=0x01)
client.write_registers(0x00d8, [0x0200], unit=0x01)
```

--
You received this message because you are subscribed to the Google Groups "pymodbus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pymodbus+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tony Kuiper

unread,
Apr 22, 2019, 3:16:15 PM4/22/19
to pymodbus
Thanks for that! I'll give that a go.
I'm still getting my head around the whole modbus world and havent gotten my head around all the terminology related to using modbus devices (big and little Endian etc... )

Appreciate the help!

Tony 
To unsubscribe from this group and stop receiving emails from it, send an email to pymo...@googlegroups.com.

Tony Kuiper

unread,
Apr 22, 2019, 8:08:05 PM4/22/19
to pymodbus
Gets more interesting!

I have found the meter seems to have a hardware issue. It wouldn't reset using the suggested codes.
I went to the meter physically and tried to reset via the hardware panel itself and it wont do it from there either.
I have put it to the supplier (Eastron) for advice as the other registers can be changed from the panel itself without issue, so this is odd.
The only thing I havent tried is to power off the modbus connection (Rasp Pi) or physically disconnect the modbus connection (the wiring) to the meter.

If this fails I'll need to figure out how to do this mathematically ie grab the total import or export at midnight, store it somewhere as a value and then calculate the daily via subtraction etc...

Tony
Reply all
Reply to author
Forward
0 new messages