{
  "spec_version": 1,
  "slug": "sma-sunny-home-manager-2",
  "manufacturer": "SMA",
  "model": "Sunny Home Manager 2.0 (plant view, unit ID 2)",
  "category": "Protocol gateway",
  "supplier_url": "https://www.sma.de/en/products/monitoring-control/sunny-home-manager-20",
  "default_configuration": {
    "protocol": "modbus_tcp",
    "port": 502,
    "unit_id": 2,
    "addressing": "zero_based",
    "byte_order": "BigEndian",
    "word_order": "HighFirst"
  },
  "coils": [],
  "discrete_inputs": [],
  "input_registers": [
    {
      "address": 30193,
      "count": 2,
      "name": "UTC system time",
      "data_type": "UInt32",
      "units": "s",
      "scale_factor": 1,
      "offset": 0,
      "access": "R",
      "description": "Unix time in seconds."
    },
    {
      "address": 30201,
      "count": 2,
      "name": "System status",
      "data_type": "UInt32",
      "units": "",
      "scale_factor": 1,
      "offset": 0,
      "access": "R",
      "description": "Enum: 307 = OK, 455 = warning, 35 = error."
    },
    {
      "address": 30581,
      "count": 2,
      "name": "Energy drawn from the utility grid",
      "data_type": "UInt32",
      "units": "Wh",
      "scale_factor": 1,
      "offset": 0,
      "access": "R",
      "description": "All phases, accumulated."
    },
    {
      "address": 30583,
      "count": 2,
      "name": "Energy fed into the utility grid",
      "data_type": "UInt32",
      "units": "Wh",
      "scale_factor": 1,
      "offset": 0,
      "access": "R",
      "description": "All phases, accumulated."
    },
    {
      "address": 30865,
      "count": 2,
      "name": "Active power drawn from the utility grid",
      "data_type": "Int32",
      "units": "W",
      "scale_factor": 1,
      "offset": 0,
      "access": "R",
      "description": "All phases."
    },
    {
      "address": 30867,
      "count": 2,
      "name": "Active power fed into the utility grid",
      "data_type": "Int32",
      "units": "W",
      "scale_factor": 1,
      "offset": 0,
      "access": "R",
      "description": "All phases."
    }
  ],
  "holding_registers": [
    {
      "address": 40015,
      "count": 1,
      "name": "Reactive power setpoint Q (percentage of PMAX)",
      "data_type": "Int16",
      "units": "%",
      "scale_factor": 1,
      "offset": 0,
      "access": "W",
      "description": "-100 % to -1 % = load, 0 = no reactive power, +1 % to +100 % = generator."
    },
    {
      "address": 40016,
      "count": 1,
      "name": "Active power setpoint P (percentage of PMAX)",
      "data_type": "Int16",
      "units": "%",
      "scale_factor": 1,
      "offset": 0,
      "access": "W",
      "description": "-100 % to -1 % = load, 0 = no active power, +1 % to +100 % = generator."
    },
    {
      "address": 40024,
      "count": 1,
      "name": "Displacement power factor cos(phi) setpoint",
      "data_type": "UInt16",
      "units": "",
      "scale_factor": 0.0001,
      "offset": 0,
      "access": "W",
      "description": "0.0000 to 1.0000 (the document's FIX4 format)."
    },
    {
      "address": 40025,
      "count": 2,
      "name": "Excitation type of cos(phi)",
      "data_type": "UInt32",
      "units": "",
      "scale_factor": 1,
      "offset": 0,
      "access": "W",
      "description": "Enum: 1041 = overexcited, 1042 = underexcited."
    },
    {
      "address": 40149,
      "count": 2,
      "name": "Active power setpoint for \"plant control\" operating mode",
      "data_type": "Int32",
      "units": "W",
      "scale_factor": 1,
      "offset": 0,
      "access": "W"
    },
    {
      "address": 40151,
      "count": 2,
      "name": "Control of active and reactive power via communication",
      "data_type": "UInt32",
      "units": "",
      "scale_factor": 1,
      "offset": 0,
      "access": "W",
      "description": "Enum for the \"plant control\" operating mode: 802 = active, 803 = inactive."
    },
    {
      "address": 40153,
      "count": 2,
      "name": "Reactive power setpoint for \"plant control\" operating mode",
      "data_type": "Int32",
      "units": "var",
      "scale_factor": 1,
      "offset": 0,
      "access": "W"
    }
  ],
  "combined_registers": [],
  "notes": "Source: SMA Solar Technology \"Modbus Interface for Sunny Home Manager 2.0 - Grid management services\", technical description HM-20-Modbus-NSD-TI-en-12, version 1.2, vendor-hosted at https://files.sma.de/downloads/HM-20-Modbus-NSD-TI-en-12.pdf. The Sunny Home Manager serves three unit IDs: 1 = the Sunny Home Manager itself (identity block 30001-30193 plus the SMA Grid Guard device-assignment table at 42109-43090), 2 = the system/plant view (the registers in this file), 3-247 = the inverters it manages. This seed stores the plant view at unit ID 2, the block that reports grid power and grid energy; the manager's own identity and the device-assignment table need a second device entry at unit ID 1 and are not listed here. Port 502, unit ID 2 from section 6.3; the 30xxx measurement rows are input registers and the 40xxx setpoints holding registers, matching how the SMA profile is carried by the other SMA seeds in this library (the technical description itself only lists both function codes without assigning one to the tables); word order HighFirst because the SMA profile sends 32-bit values high word first. Formats are converted to plain factors: FIX0 = 1, FIX4 = 0.0001. Write-only rows (WO in the document) are the grid-management setpoints; the document warns not to cycle writable parameter registers because they are stored in flash, except for these grid-management setpoints, which may be written cyclically. Every write requires the SMA Grid Guard code to have been entered first. Deliberate omissions: the identity and version block at unit 1 (30001-30057, 30051/30053/30055 enums), the device-assignment table at 42109-43090 (a 4-address stride per device, usable only after a Grid Guard login), and the inverter parameters at unit 3-247 (30233 permanent active power limitation, 30825 reactive-power operating mode, 30831 cos-phi setpoint, 30833 excitation type), which belong to the inverter device entries, not to the manager."
}
