HI,
Thanks a lot, I got my setup working now thanks to this upload!
The modbus library works a little different now and I use Python3.
Here’s the Python3 code to do a basic test of the RS485 interface:
to install pymodbus:
pip3 install pymodbus (in ssh)
the script:
from pymodbus.client import ModbusSerialClient as ModbusClient
pv_volts=0.0
pv_power=0.0
Wh_today=0
inverter = ModbusClient(method='rtu', port='/dev/ttyUSB0', baudrate=9600, stopbits=1, parity='N', bytesize=8, timeout=1)
inverter.connect()
rr = inverter.read_input_registers(1,54)
inverter.close()
# for i in range(54):
# value=rr.registers[i]
# print(i, 0 + float(value))
value=rr.registers[2]
pv_volts=pv_volts+(float(value)/10)
value=rr.registers[35]
pv_power=pv_power+(float(value)/10)
value=rr.registers[53]
Wh_today=Wh_today+(float(value)*100)
print('pv_volts: ', pv_volts)
print('pv_power: ', pv_power)
print('Wh_today: ', Wh_today)