Quickstart
These steps take one rack from standby to 7 kW discharge and back. For a first run, a Modbus tool is all you need. In your EMS, walk the SunSpec map instead of using these addresses: see the Register reference.
- Connect. Modbus TCP to the gateway’s IP address, port 502, Unit ID 100 + the rack’s number: 101 for rack 1. Registers 40000 and 40001 read
SunS. - Check it can run.
701_InvStreads 3 (running) or 7 (standby). At 6 the rack is in fault: see Resetting a fault. - Start. Write
704_WSetEna= 1. Once is enough: the rack keeps it. - Set the power. Write
704_WSet= 70, both registers with function code 16. The register holds W / 100, so this is 7 kW discharge; −70 charges 7 kW. - Check.
701_InvStreads 3 and701_Wabout 70. - Stop. Write
704_WSet= 0. The rack goes to standby:701_InvStreads 7.
| Step | Point | Address | Value |
|---|---|---|---|
| 1 | SunS |
40000–40001 | read |
| 2, 5 | 701_InvSt |
40074 | read |
| 3 | 704_WSetEna |
40299 | 1 |
| 4, 6 | 704_WSet |
40301–40302 | 70, then 0 |
| 5 | 701_W |
40080 | read |
The same in Python
Section titled “The same in Python”With pymodbus 3.10 or later:
from pymodbus.client import ModbusTcpClient
UNIT = 101 # rack 1
client = ModbusTcpClient("192.0.2.100", port=502)client.connect()
def read(address, count=1): return client.read_holding_registers(address, count=count, device_id=UNIT).registers
def write(address, values): client.write_registers(address, values, device_id=UNIT) # function code 16
def int32(value): raw = value & 0xFFFFFFFF return [raw >> 16, raw & 0xFFFF] # high word first
def int16(raw): return raw - 0x10000 if raw >= 0x8000 else raw
assert read(40000, 2) == [0x5375, 0x6E53], "not a SunSpec device"
write(40299, [1]) # 704_WSetEna = 1write(40301, int32(round(7000 / 100))) # 704_WSet: 7 kW discharge
inv_st = read(40074)[0] # 701_InvStwatts = int16(read(40080)[0]) * 100 # 701_W, W_SF = 2print(f"InvSt {inv_st}, {watts} W")
write(40301, int32(0)) # standbyclient.close()