Hello everyone,
since yesterday we have solar panels with a Sungrow SG5.0RT inverter. I want to display the current AC power produced in Home Assistant with Modbus. I have already been successfull reading
Internal temperature
address: 5007
data_type: int16
scale: 0.1
precision: 1
This already shows in HA. For some reason I can’t read the Total output Energy (address 5003). This is all nice to have but I am actually interested in Modbus address 13007 (load power) which I can see in the iSolarCloud app and also directly on the WiNet-S (when entering it’s IP-Address into the browser).
I made a small Python script to read a modbus register:
from pyModbusTCP.client import ModbusClient # pyModbusTCP needs to be installed via pip
import ctypes
address = '0.0.0.0' # IP-Address of the inverter
port = 502 # Port for Modbus
unit_id = 1
auto_open = True
modbus_client = ModbusClient(host=address, port=port, unit_id=unit_id, auto_open=auto_open)
data = modbus_client.read_input_registers(5030, 1) # Reads modbus register 5030
if data:
signed16 = ctypes.c_int16(data[0]).value
signed32 = ctypes.c_int32(data[0]).value
print('Original data: ' + str(data)) # Unchanged data, directly read from Inverter
print('Signed 16: ' + str(signed16))
print('Signed 32: ' + str(signed32))
else:
print('No data returned')
When executing the script, I get a value that matches with the value I was looking for on register 13007. I can see the value I want in the iSolarCloud app and when I enter the IP Address of the WiNet-S in the browser. This seems to be it.
I configured it in the modbus.yaml in Home Assistant like this: