
import struct import binascii import time from pymodbus.constants import Endian from pymodbus.payload import BinaryPayloadDecoder from pymodbus.payload import BinaryPayloadBuilder from struct import * from pymodbus.client.sync import ModbusTcpClient import logging logging.basicConfig() log = logging.getLogger() #log.setLevel(logging.DEBUG) host = '192.168.1.204' port = 502 client = ModbusTcpClient(host, port) client.connect() for x in range(0, 300): rr = client.read_input_registers(0x0000,2,unit=1) assert(rr.function_code < 0x80) # test that we are not an error print "-----------------------------" print rr print rr.registers print "-----------------------------" print format(rr.registers[0], '02x') print format(rr.registers[1], '02x') print "-----------------------------" # PYTHON FLOAT IEEE 754 decoder = BinaryPayloadDecoder.fromRegisters(rr.registers, endian=Endian.Big) print ("Voltage is ", decoder.decode_32bit_float(), "V") print "-----------------------------" time.sleep(1)





KMtronic Modbus RS485 RTU Serial to Modbus LAN TCP/IP Module Converter
Well explained. Can you please send the python code to extract data from L&T ER300P Energy meter. I’m not finding its register addresses anywhere in internet.
Unfortunately we have only SDM230 Modbus Meter. Will try to find L&T ER300P and if we get will post result.