{
  "spec_version": 1,
  "slug": "huawei-sun2000",
  "manufacturer": "Huawei",
  "model": "SUN2000 (with Smart Dongle / SmartLogger, Modbus TCP)",
  "category": "Solar inverter",
  "supplier_url": "https://solar.huawei.com/en/download",
  "default_configuration": {
    "protocol": "modbus_tcp",
    "port": 502,
    "unit_id": 0,
    "addressing": "zero_based",
    "byte_order": "BigEndian",
    "word_order": "HighFirst"
  },
  "coils": [],
  "discrete_inputs": [],
  "input_registers": [],
  "holding_registers": [
    {
      "address": 30000,
      "count": 15,
      "name": "Model",
      "data_type": "Ascii",
      "units": "",
      "scale_factor": 1,
      "offset": 0,
      "access": "R",
      "description": "Inverter model string, e.g. \"SUN2000-8KTL-M1\". Up to 30 characters."
    },
    {
      "address": 30015,
      "count": 10,
      "name": "Serial number (SN)",
      "data_type": "Ascii",
      "units": "",
      "scale_factor": 1,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 30025,
      "count": 10,
      "name": "Part number (PN)",
      "data_type": "Ascii",
      "units": "",
      "scale_factor": 1,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 30070,
      "count": 1,
      "name": "Model ID",
      "data_type": "UInt16",
      "units": "",
      "scale_factor": 1,
      "offset": 0,
      "access": "R",
      "description": "Numeric model code; the mapping is in the \"Supported Models\" table of Huawei's interface definitions."
    },
    {
      "address": 30071,
      "count": 1,
      "name": "Number of PV strings",
      "data_type": "UInt16",
      "units": "",
      "scale_factor": 1,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 30072,
      "count": 1,
      "name": "Number of MPP trackers",
      "data_type": "UInt16",
      "units": "",
      "scale_factor": 1,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 30073,
      "count": 2,
      "name": "Rated power (Pn)",
      "data_type": "UInt32",
      "units": "kW",
      "scale_factor": 0.001,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 30075,
      "count": 2,
      "name": "Maximum active power (Pmax)",
      "data_type": "UInt32",
      "units": "kW",
      "scale_factor": 0.001,
      "offset": 0,
      "access": "R",
      "description": "Nominal AC output power; useful as the 100 % reference for power limiting."
    },
    {
      "address": 32000,
      "count": 1,
      "name": "State 1",
      "data_type": "Hex",
      "units": "",
      "scale_factor": 1,
      "offset": 0,
      "access": "R",
      "description": "Bit field: 0 = standby, 1 = grid-connected, 2 = grid-connected normally, 3 = derating by power rationing, 4 = derating for internal reasons, 5 = normal stop, 6 = stop due to fault, 7 = stop due to power rationing, 8 = shutdown, 9 = spot check."
    },
    {
      "address": 32002,
      "count": 1,
      "name": "State 2",
      "data_type": "Hex",
      "units": "",
      "scale_factor": 1,
      "offset": 0,
      "access": "R",
      "description": "Bit field: 0 = locking status (0 locked, 1 unlocked), 1 = PV connection, 2 = DSP data collection."
    },
    {
      "address": 32003,
      "count": 2,
      "name": "State 3",
      "data_type": "UInt32",
      "units": "",
      "scale_factor": 1,
      "offset": 0,
      "access": "R",
      "description": "Bit field: 0 = off-grid (0 on-grid, 1 off-grid), 1 = off-grid switch."
    },
    {
      "address": 32008,
      "count": 1,
      "name": "Alarm 1",
      "data_type": "Hex",
      "units": "",
      "scale_factor": 1,
      "offset": 0,
      "access": "R",
      "description": "Alarm bit field; see the alarm table in Huawei's interface definitions."
    },
    {
      "address": 32016,
      "count": 1,
      "name": "PV1 voltage",
      "data_type": "Int16",
      "units": "V",
      "scale_factor": 0.1,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 32017,
      "count": 1,
      "name": "PV1 current",
      "data_type": "Int16",
      "units": "A",
      "scale_factor": 0.01,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 32018,
      "count": 1,
      "name": "PV2 voltage",
      "data_type": "Int16",
      "units": "V",
      "scale_factor": 0.1,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 32019,
      "count": 1,
      "name": "PV2 current",
      "data_type": "Int16",
      "units": "A",
      "scale_factor": 0.01,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 32064,
      "count": 2,
      "name": "Input power (DC)",
      "data_type": "Int32",
      "units": "kW",
      "scale_factor": 0.001,
      "offset": 0,
      "access": "R",
      "description": "Total DC input power of all strings."
    },
    {
      "address": 32066,
      "count": 1,
      "name": "Grid voltage A-B / phase A voltage",
      "data_type": "UInt16",
      "units": "V",
      "scale_factor": 0.1,
      "offset": 0,
      "access": "R",
      "description": "Line-to-line voltage on three-phase models, phase voltage on single-phase models."
    },
    {
      "address": 32067,
      "count": 1,
      "name": "Grid voltage B-C / phase B voltage",
      "data_type": "UInt16",
      "units": "V",
      "scale_factor": 0.1,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 32068,
      "count": 1,
      "name": "Grid voltage C-A / phase C voltage",
      "data_type": "UInt16",
      "units": "V",
      "scale_factor": 0.1,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 32069,
      "count": 1,
      "name": "Phase A voltage",
      "data_type": "UInt16",
      "units": "V",
      "scale_factor": 0.1,
      "offset": 0,
      "access": "R",
      "description": "Invalid on single-phase models."
    },
    {
      "address": 32070,
      "count": 1,
      "name": "Phase B voltage",
      "data_type": "UInt16",
      "units": "V",
      "scale_factor": 0.1,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 32071,
      "count": 1,
      "name": "Phase C voltage",
      "data_type": "UInt16",
      "units": "V",
      "scale_factor": 0.1,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 32072,
      "count": 2,
      "name": "Phase A current",
      "data_type": "Int32",
      "units": "A",
      "scale_factor": 0.001,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 32074,
      "count": 2,
      "name": "Phase B current",
      "data_type": "Int32",
      "units": "A",
      "scale_factor": 0.001,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 32076,
      "count": 2,
      "name": "Phase C current",
      "data_type": "Int32",
      "units": "A",
      "scale_factor": 0.001,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 32080,
      "count": 2,
      "name": "Active power (AC)",
      "data_type": "Int32",
      "units": "kW",
      "scale_factor": 0.001,
      "offset": 0,
      "access": "R",
      "description": "Total AC output power; this is the register most monitoring tools use."
    },
    {
      "address": 32082,
      "count": 2,
      "name": "Reactive power",
      "data_type": "Int32",
      "units": "kvar",
      "scale_factor": 0.001,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 32084,
      "count": 1,
      "name": "Power factor",
      "data_type": "Int16",
      "units": "",
      "scale_factor": 0.001,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 32085,
      "count": 1,
      "name": "Grid frequency",
      "data_type": "UInt16",
      "units": "Hz",
      "scale_factor": 0.01,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 32087,
      "count": 1,
      "name": "Internal temperature",
      "data_type": "Int16",
      "units": "°C",
      "scale_factor": 0.1,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 32089,
      "count": 1,
      "name": "Device status",
      "data_type": "UInt16",
      "units": "",
      "scale_factor": 1,
      "offset": 0,
      "access": "R",
      "description": "0x0000 initialising, 0x0100 starting, 0x0200 on-grid, 0x0201 grid-connected power limited, 0x0203 off-grid running, 0x0300+ shutdown (fault, command, OVGR, communication lost, ...), 0x0401+ grid scheduling, 0x0500 spot check, 0x0A00 off-grid charging, 0xA000 standby: no irradiation."
    },
    {
      "address": 32090,
      "count": 1,
      "name": "Fault code",
      "data_type": "UInt16",
      "units": "",
      "scale_factor": 1,
      "offset": 0,
      "access": "R",
      "description": "Current fault code; 0 = no fault."
    },
    {
      "address": 32106,
      "count": 2,
      "name": "Accumulated energy yield",
      "data_type": "UInt32",
      "units": "kWh",
      "scale_factor": 0.01,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 32114,
      "count": 2,
      "name": "Daily energy yield",
      "data_type": "UInt32",
      "units": "kWh",
      "scale_factor": 0.01,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 37100,
      "count": 1,
      "name": "Meter status",
      "data_type": "UInt16",
      "units": "",
      "scale_factor": 1,
      "offset": 0,
      "access": "R",
      "description": "0 = offline, 1 = normal, 2 = abnormal."
    },
    {
      "address": 37101,
      "count": 2,
      "name": "Meter voltage, phase A",
      "data_type": "Int32",
      "units": "V",
      "scale_factor": 0.1,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 37103,
      "count": 2,
      "name": "Meter voltage, phase B",
      "data_type": "Int32",
      "units": "V",
      "scale_factor": 0.1,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 37105,
      "count": 2,
      "name": "Meter voltage, phase C",
      "data_type": "Int32",
      "units": "V",
      "scale_factor": 0.1,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 37107,
      "count": 2,
      "name": "Meter current, phase A",
      "data_type": "Int32",
      "units": "A",
      "scale_factor": 0.01,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 37109,
      "count": 2,
      "name": "Meter current, phase B",
      "data_type": "Int32",
      "units": "A",
      "scale_factor": 0.01,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 37111,
      "count": 2,
      "name": "Meter current, phase C",
      "data_type": "Int32",
      "units": "A",
      "scale_factor": 0.01,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 37113,
      "count": 2,
      "name": "Meter active power",
      "data_type": "Int32",
      "units": "W",
      "scale_factor": 1,
      "offset": 0,
      "access": "R",
      "description": "Positive = feeding into the grid, negative = drawn from the grid."
    },
    {
      "address": 37115,
      "count": 2,
      "name": "Meter reactive power",
      "data_type": "Int32",
      "units": "var",
      "scale_factor": 1,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 37117,
      "count": 1,
      "name": "Meter power factor",
      "data_type": "Int16",
      "units": "",
      "scale_factor": 0.001,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 37118,
      "count": 1,
      "name": "Meter grid frequency",
      "data_type": "Int16",
      "units": "Hz",
      "scale_factor": 0.01,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 37119,
      "count": 2,
      "name": "Meter energy, feed-in (export)",
      "data_type": "Int32",
      "units": "kWh",
      "scale_factor": 0.01,
      "offset": 0,
      "access": "R",
      "description": "Energy fed by the inverter into the grid; Huawei calls this the positive active electricity."
    },
    {
      "address": 37121,
      "count": 2,
      "name": "Meter energy, drawn (import)",
      "data_type": "Int32",
      "units": "kWh",
      "scale_factor": 0.01,
      "offset": 0,
      "access": "R",
      "description": "Energy supplied from the grid; Huawei calls this the reverse active power."
    },
    {
      "address": 37125,
      "count": 1,
      "name": "Meter type",
      "data_type": "UInt16",
      "units": "",
      "scale_factor": 1,
      "offset": 0,
      "access": "R",
      "description": "0 = single phase, 1 = three phase."
    },
    {
      "address": 37758,
      "count": 2,
      "name": "Battery rated capacity",
      "data_type": "UInt32",
      "units": "Wh",
      "scale_factor": 1,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 37760,
      "count": 1,
      "name": "Battery state of charge (SOC)",
      "data_type": "UInt16",
      "units": "%",
      "scale_factor": 0.1,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 37762,
      "count": 1,
      "name": "Battery running status",
      "data_type": "UInt16",
      "units": "",
      "scale_factor": 1,
      "offset": 0,
      "access": "R",
      "description": "0 = offline, 1 = standby, 2 = running, 3 = fault, 4 = sleep mode."
    },
    {
      "address": 37763,
      "count": 1,
      "name": "Battery bus voltage",
      "data_type": "UInt16",
      "units": "V",
      "scale_factor": 0.1,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 37764,
      "count": 1,
      "name": "Battery bus current",
      "data_type": "Int16",
      "units": "A",
      "scale_factor": 0.1,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 37765,
      "count": 2,
      "name": "Battery charge/discharge power",
      "data_type": "Int32",
      "units": "W",
      "scale_factor": 1,
      "offset": 0,
      "access": "R",
      "description": "Positive = charging, negative = discharging."
    },
    {
      "address": 37780,
      "count": 2,
      "name": "Total battery charge (lifetime)",
      "data_type": "UInt32",
      "units": "kWh",
      "scale_factor": 0.01,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 37782,
      "count": 2,
      "name": "Total battery discharge (lifetime)",
      "data_type": "UInt32",
      "units": "kWh",
      "scale_factor": 0.01,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 37784,
      "count": 2,
      "name": "Current-day battery charge",
      "data_type": "UInt32",
      "units": "kWh",
      "scale_factor": 0.01,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 37786,
      "count": 2,
      "name": "Current-day battery discharge",
      "data_type": "UInt32",
      "units": "kWh",
      "scale_factor": 0.01,
      "offset": 0,
      "access": "R"
    },
    {
      "address": 40000,
      "count": 2,
      "name": "System time",
      "data_type": "UInt32",
      "units": "s",
      "scale_factor": 1,
      "offset": 0,
      "access": "RW",
      "description": "Epoch seconds, local time."
    },
    {
      "address": 40120,
      "count": 1,
      "name": "Fixed active power derating",
      "data_type": "UInt16",
      "units": "kW",
      "scale_factor": 0.1,
      "offset": 0,
      "access": "RW",
      "description": "Setpoint for grid-scheduling active power limitation; takes effect with the matching control mode."
    },
    {
      "address": 40122,
      "count": 1,
      "name": "Reactive power compensation (PF)",
      "data_type": "Int16",
      "units": "",
      "scale_factor": 0.001,
      "offset": 0,
      "access": "RW",
      "description": "Target power factor, e.g. 950 = 0.95. Range (-1, -0.8] and [0.8, 1]."
    },
    {
      "address": 40123,
      "count": 1,
      "name": "Reactive power compensation (Q/S)",
      "data_type": "Int16",
      "units": "",
      "scale_factor": 0.001,
      "offset": 0,
      "access": "RW",
      "description": "Reactive power as a fraction of Smax, range [-1, 1]."
    },
    {
      "address": 40125,
      "count": 1,
      "name": "Active power percentage derating",
      "data_type": "UInt16",
      "units": "%",
      "scale_factor": 0.1,
      "offset": 0,
      "access": "RW",
      "description": "Active power limit in % of Pmax for grid-scheduling by percentage."
    },
    {
      "address": 40126,
      "count": 2,
      "name": "Fixed active power derating (W)",
      "data_type": "UInt32",
      "units": "W",
      "scale_factor": 1,
      "offset": 0,
      "access": "RW",
      "description": "Active power limit as an absolute value in W."
    },
    {
      "address": 47075,
      "count": 2,
      "name": "Maximum charging power",
      "data_type": "UInt32",
      "units": "W",
      "scale_factor": 1,
      "offset": 0,
      "access": "RW",
      "description": "Upper limit for battery charging, capped by the inverter's rated charge power (37046)."
    },
    {
      "address": 47077,
      "count": 2,
      "name": "Maximum discharging power",
      "data_type": "UInt32",
      "units": "W",
      "scale_factor": 1,
      "offset": 0,
      "access": "RW",
      "description": "Upper limit for battery discharging, capped by the inverter's rated discharge power (37048)."
    },
    {
      "address": 47081,
      "count": 1,
      "name": "Charging cutoff capacity (max SOC)",
      "data_type": "UInt16",
      "units": "%",
      "scale_factor": 0.1,
      "offset": 0,
      "access": "RW",
      "description": "Default 100 %; range 90-100 %."
    },
    {
      "address": 47082,
      "count": 1,
      "name": "Discharging cutoff capacity (min SOC)",
      "data_type": "UInt16",
      "units": "%",
      "scale_factor": 0.1,
      "offset": 0,
      "access": "RW",
      "description": "Default 15 %; range 12-20 %."
    },
    {
      "address": 47087,
      "count": 1,
      "name": "Charge from grid",
      "data_type": "UInt16",
      "units": "",
      "scale_factor": 1,
      "offset": 0,
      "access": "RW",
      "description": "0 = disabled, 1 = enabled (LUNA2000 AC charging from the grid)."
    },
    {
      "address": 47100,
      "count": 1,
      "name": "Forcible charge/discharge",
      "data_type": "UInt16",
      "units": "",
      "scale_factor": 1,
      "offset": 0,
      "access": "RW",
      "description": "0 = stop, 1 = charge, 2 = discharge. Requires a forcible charge/discharge period (47083) and mode (47246)."
    },
    {
      "address": 47415,
      "count": 1,
      "name": "Active power control mode",
      "data_type": "UInt16",
      "units": "",
      "scale_factor": 1,
      "offset": 0,
      "access": "RW",
      "description": "0 = unlimited, 1 = DI active scheduling, 5 = zero power to grid, 6 = power-limited (kW), 7 = power-limited (%)."
    },
    {
      "address": 47418,
      "count": 1,
      "name": "Maximum feed-in grid power",
      "data_type": "UInt16",
      "units": "%",
      "scale_factor": 0.1,
      "offset": 0,
      "access": "RW",
      "description": "Export limit in % of the plant capacity; only applied when the active power control mode is 7."
    }
  ],
  "combined_registers": [
    {
      "id": "pv1-power-calculated",
      "label": "PV1 power (calculated)",
      "operator": "*",
      "operand_a": {
        "register_type": "holding_registers",
        "register_address": 32016
      },
      "operand_b": {
        "register_type": "holding_registers",
        "register_address": 32017
      },
      "units": "W",
      "scale_factor": 1,
      "offset": 0,
      "description": "PV1 voltage x PV1 current. Huawei publishes per-string voltage and current but no per-string power register."
    },
    {
      "id": "pv2-power-calculated",
      "label": "PV2 power (calculated)",
      "operator": "*",
      "operand_a": {
        "register_type": "holding_registers",
        "register_address": 32018
      },
      "operand_b": {
        "register_type": "holding_registers",
        "register_address": 32019
      },
      "units": "W",
      "scale_factor": 1,
      "offset": 0,
      "description": "PV2 voltage x PV2 current."
    }
  ],
  "notes": "Modbus TCP must be enabled on the inverter (Communication settings, installer/maintenance access) and the registers are served by the Smart Dongle (SDongleA-05, port 502) or a SmartLogger. Unit ID 0 addresses the directly connected device, which is the default in Huawei's interface definitions; some dongle firmware versions answer on unit ID 1 instead, and downstream devices behind a SmartLogger use their own address (the SmartLogger can also expose the data on port 6607). All registers are holding registers: read-only values with function code 3, settings written with 6/16. Address numbers are Huawei's register numbers used as wire addresses. \"Gain\" in Huawei's tables is applied here as the scale factor (gain 10 -> 0.1, gain 100 -> 0.01, gain 1000 -> 0.001). The meter block (37100-37138) is only populated when a Smart Power Sensor / DTSU666 is connected. The battery block (37758-37786) is the aggregate view of all battery units and is only present on hybrid (M1) models with LUNA2000 or LG RESU; battery unit 1 has its own registers at 37000-37025 and unit 2 at 37700-37755. Writes are range-checked by the inverter, and repeatedly written settings can be rejected while the dongle is busy, so keep the polling interval for RW registers long. Source: Huawei \"Solar Inverter Modbus Interface Definitions\", issue 05 (2023-02-16)."
}
