December 28, 20187 yr Hi, I installed an energy meter Eastron SDM230, before my Infini 3KW+ inverter to monitor actual energy import and export which also includes the power that the inverter is drawing. The meter supports MODBUS output, so I can get real time data from the energy meter. I used some MODBUS software and confirmed that the energy meter is sending data to my Windows 10 PC. However I don't really know how to log the data and use it to form a chart in which I can track daily and monthly import and export of energy. Is there a software that can do this? Alternatively, I was wondering if I can send the energy meter data directly to PVOUTPUT.ORG. Can this be done? Would like some guidance this.
December 30, 20187 yr I'm going to paste you a python script that can be used to poke modbus registers, I call it modbusrtu.py (I have another one for TCP). It's hacky, no proper validation of arguments, it's what I use for internal development stuff. It assumes you're running Linux or MacOS. Speed is hardcoded at 9600 baud, slaveid is hardcoded as 1. Change if needed. Needs the pymodbus extension. import sys from pymodbus.client.sync import ModbusSerialClient as ModbusClient from pymodbus.pdu import ExceptionResponse def main(): if len(sys.argv) < 5: print "Usage: {} port read|write register count" return modbus = ModbusClient(method='rtu', port=sys.argv[1], baudrate=9600, timeout=1) if not modbus.connect(): logger.error("Cannot connect to modbus") return action = sys.argv[2] if action not in ("read", "write"): print "Read or Write?" return register = sys.argv[3] if register.startswith('0x'): register = int(register, 16) else: register = int(register) count = int(sys.argv[4]) if action == "read": r = modbus.read_holding_registers(register, count, unit=1) if isinstance(r, ExceptionResponse): print r else: print r.registers total = 0 for _ in reversed(r.registers): total <<= 16 total |= _ print "{} (0x{:X})".format(total, total) elif action == "write": v = int(sys.argv[5]) payload = [] while v > 0: payload.append(v & 0xFFFF) v >>=16 while len(payload) < count: payload.append(0) print "Writing {} to register {:X}".format(payload, register) if len(payload) > 1: r = modbus.write_registers(register, payload, unit=1) else: r = modbus.write_register(register, payload[0], unit=1) print r if __name__ == "__main__": main() So you can call that as follows, assuming you have a usb-rs485 adapter on ttyUSB0: python modbusrtu.py /dev/ttyUSB0 read 0xC 2 That should show the power on L1. See full list of registers here. Also see alternate implementation here. You could combine this code with some "python requests" (another extension) code to post to pvoutput.
December 31, 20187 yr Author Thanks for pointing me in the right direction. I have no experience working with scripts, so it might take me a while to get the hang of it. I also found another script link below for Eastron energy meters. In your opinion which one of these would be better/easier to implement considering that I have absolutely no experience with python. https://github.com/jrbenito/eastron-pvoutput
December 31, 20187 yr 3 hours ago, bluwater said: absolutely no experience with python What language do you have experience with? :-) Essentially you just have to get a modbus library (one that can do RTU, that is serial comms), and then use function 3 (read holding registers) or function 4 (read input registers), but so far most of these meters seems to respond identically to both kinds of calls. Then just use the right slave id (probably zero or one), register address (seems this meter starts at zero), and ask for any range of registers (this one seems to support up to 40). Then simply decode. Byte order appears to be little-endian (ie the small part of a 2-byte response is on the left). If you have no programming experience, then it's probably best to start with the project you posted :-)
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.