Simplyfiy and format read_regs examle

This commit is contained in:
Paul Warren 2024-10-12 21:37:24 +11:00
parent 0ffe44b9ad
commit 054bed735b

View file

@ -8,37 +8,11 @@ from pymodbus.client.tcp import ModbusTcpClient
fronius1 = ModbusTcpClient("172.19.107.211", port=502, timeout=10)
fronius1.connect()
print(froniusreg.ID.getValue(fronius1))
print(froniusreg.L.getValue(fronius1))
# Some strings
print(froniusreg.Mn.getValue(fronius1))
print(froniusreg.Md.getValue(fronius1))
print(froniusreg.Vr.getValue(fronius1))
print(froniusreg.SN.getValue(fronius1))
print(froniusreg.DA.getValue(fronius1))
soc = froniusreg.scaledStateOfCharge.getValue(fronius1)
print(" SOC: %s%%" % soc)
discharge = froniusreg.scaledOutWRte.getValue(fronius1)
print(" DRate: %d%%" % discharge)
charge = froniusreg.scaledInWRte.getValue(fronius1)
print(" CRate: %d%%" % charge)
mode = froniusreg.StorCtl_Mode.getValue(fronius1)
print(" Mode: %d" % mode)
reserve = froniusreg.scaledReserve.getValue(fronius1)
print(" Res: %d" % reserve)
rate = froniusreg.scaledMaxChaRte.getValue(fronius1)
print(" rate: %d" % rate)
rate = froniusreg.scaledMaxWChaGra.getValue(fronius1)
print(" WGra rate: %d" % rate)
revert = froniusreg.InOutWRte_RvrtTms.getValue(fronius1)
print("Timer: %d" % revert)
print(" Manufacturer: %s" % froniusreg.Mn.getValue(fronius1))
print(" Model: %s" % froniusreg.Md.getValue(fronius1))
print(" Version: %s" % froniusreg.Vr.getValue(fronius1))
print(" SOC: %s%%" % froniusreg.scaledStateOfCharge.getValue(fronius1))
print(" Discharge Rate: %d%%" % froniusreg.scaledOutWRte.getValue(fronius1))
print(" Charge Rate: %d%%" % froniusreg.scaledInWRte.getValue(fronius1))
print(" Reserve: %d%%" % froniusreg.scaledReserve.getValue(fronius1))
print("Max Charge rate: %dW" % froniusreg.scaledMaxChaRte.getValue(fronius1))