My solar panels are connected to an Omnik Inverter (5000tl2). That company has gone bankrupt and the available documentation does not specify the use of the USB port or the registers on the inverter itself.
I am trying to read data thats on the inverter without the use of the wifi module. I connected my Pi 2B+ to the USB port, installed pymodbus and tried this code (courtesy of Fasthook) which is originally meant for another brand (GROWATT):
import subprocess
from time import strftime
import time
from pymodbus.client.sync import ModbusSerialClient as ModbusClient
client = ModbusClient(method='rtu', port='/dev/ttyUSB0', baudrate=9600, stopbits=1, parity='N', bytesize=8, timeout=1)
client.connect()
rr = client.read_input_registers(1,44)
rr = client.read_input_registers(2,1) #Watts delivered by panels (DC side)
value=rr.registers
pv_watts=float(value[0])/10
rr = client.read_input_registers(3,1) # Volts on DC side
value=rr.registers
pv_volts=float(value[0])/10
rr = client.read_input_registers(4,1) # Amps on DC side??? Not sure.
value=rr.registers
pv_amps=float(value[0])/10
rr = client.read_input_registers(12,1) #watts delivered by inverter to net
value=rr.registers
out_watts=float(value[0])/10
rr = client.read_input_registers(13,1) # frequency of AC
value=rr.registers
ac_hz=float(value[0])/100
rr = client.read_input_registers(14,1) # volts on AC side delivered by inverter
value=rr.registers
ac_volts=float(value[0])/10
rr = client.read_input_registers(27,1) # Total energy production today
value=rr.registers
Wh_today=float(value[0])*100
rr = client.read_input_registers(29,1) # Total energy production in inervter storage
value=rr.registers
Wh_total=float(value[0])*100
rr = client.read_input_registers(32,1) # Inverter temperature
value=rr.registers
current_temp=float(value[0])/10
client.close()
I also started PyModBus Debugging that gives me:
- DEBUG:pymodbus.transaction:Current transaction state - IDLE
- DEBUG:pymodbus.transaction:Running transaction 1
- DEBUG:pymodbus.transaction:SEND: 0x0 0x4 0x0 0x1 0x0 0x2c 0xa1 0xc6
- DEBUG:pymodbus.client.sync:New Transaction state SENDING
- DEBUG:pymodbus.transaction:Changing transaction state from SENDING to WAITING FOR REPLY
- DEBUG:pymodbus.transaction:Transaction failed. (Modbus Error: [Invalid Message] Incomplete message received, expected at least 2 bytes (0 received))
- DEBUG:pymodbus.framer.rtu_framer:Frame - [b] not ready
- DEBUG:pymodbus.transaction:Getting transaction 0
- DEBUG:pymodbus.transaction:Changing transaction state from PROCESSING REPLY to TRANSACTION_COMPLETE
This error is from: rr = client.read_input_registers(1,44)
My guess is that the registers from a GROWATT are different from the Omnik. That is not surprising :) As i can't find any documentation on the Omnik itself... how can i determine the right code for my Omnik Inverter?
Many thanks for any help on this!
Bart