SunSpec SunSpec Model 5 — Secure Write Request Modbus TCP template

SunSpec Model 5 — Secure Write Request

SunSpec Model 5 is the Secure Write Request model defined by the SunSpec Alliance for authenticated, tamper-resistant register writes over Modbus TCP. Rather than writing individual registers directly, a client populates up to 40 offset/value pairs (off1 through off40, val1 through val40), sets a UNIX timestamp (ts), millisecond component (ms), sequence number (seq), role (role), algorithm identifier (alg), and active-pair count (n), then triggers execution by writing the execute register (x). The model prevents replay attacks through sequence numbers and timestamps. It is used wherever DER devices require credential-controlled write access under standards such as IEEE 1547-2018.

Protocol
Modbus TCP
Connection
Ethernet, Modbus TCP
Registers
89, read and write
Brand
SunSpec
Last updated

Registers (89)

89 read, 87 write

NameUnitAccessAddress (Hidden until you enter your email)Function (hidden)Type (hidden)
idRead
lRead
xRead and write
off1Read and write
val1Read and write
off2Read and write
val2Read and write
off3Read and write
val3Read and write
off4Read and write
val4Read and write
off5Read and write
val5Read and write
off6Read and write
val6Read and write
off7Read and write
val7Read and write
off8Read and write
val8Read and write
off9Read and write
val9Read and write
off10Read and write
val10Read and write
off11Read and write
val11Read and write
off12Read and write
val12Read and write
off13Read and write
val13Read and write
off14Read and write
val14Read and write
off15Read and write
val15Read and write
off16Read and write
val16Read and write
off17Read and write
val17Read and write
off18Read and write
val18Read and write
off19Read and write
val19Read and write
off20Read and write
val20Read and write
off21Read and write
val21Read and write
off22Read and write
val22Read and write
off23Read and write
val23Read and write
off24Read and write
val24Read and write
off25Read and write
val25Read and write
off26Read and write
val26Read and write
off27Read and write
val27Read and write
off28Read and write
val28Read and write
off29Read and write
val29Read and write
off30Read and write
val30Read and write
off31Read and write
val31Read and write
off32Read and write
val32Read and write
off33Read and write
val33Read and write
off34Read and write
val34Read and write
off35Read and write
val35Read and write
off36Read and write
val36Read and write
off37Read and write
val37Read and write
off38Read and write
val38Read and write
off39Read and write
val39Read and write
off40Read and write
val40Read and write
tsRead and write
msRead and write
seqRead and write
roleRead and write
algRead and write
nRead and write

Loading registers…

Send your device list

If a device is not in the library yet, we build the template for free as soon as we have the register data.

Use cases

  • Verify that sequence numbers increment correctly across successive secure write cycles to confirm replay-attack protection is active.
  • Monitor the execute register (x) state after each write transaction to confirm the device acknowledged and applied the payload.
  • Track the timestamp (ts) and millisecond (ms) fields to audit when configuration changes were committed to a DER device.
  • Alert on unexpected role values in the role register to detect unauthorised clients attempting writes to protected parameters.
  • Compare the active-pair count (n) against expected values to verify the correct number of register writes was submitted per transaction.

Installation

  1. Enable Modbus TCP on the target SunSpec-compliant DER device and confirm the device supports Model 5 by scanning its SunSpec model map starting at the SunS identifier.

  2. Connect the device to the same TCP/IP network as the ModbusCloud Gateway, ensuring port 502 (or the device-configured Modbus TCP port) is reachable from the Gateway.

  3. In your ModbusCloud portal, add the Gateway, import this SunSpec Model 5 template, and assign the correct unit ID and base Modbus address matching your device's model map location.

  4. Read back the id register (address 0) and confirm it returns 5, then read the l register to verify model length before performing any write operations.

Things to watch for

Why does the device reject my write to the execute register (x)?

The device validates the full payload before accepting the execute trigger. Ensure the sequence number (seq) is strictly greater than the previous request, the timestamp (ts) is current and within the device's accepted time window, and the role register matches a permitted client role. Any mismatch causes the device to refuse the transaction.

The gateway connects but all offset and value registers read as zero. What now?

Offset and value registers are only populated after a write transaction is staged. A freshly powered device or one that has processed no requests will return zeros. Confirm the device's SunSpec model map includes Model 5 at the base address you configured, and use a Modbus scanner to verify the model ID register returns 5.

How do I know which offset/value pairs are actually active in a given request?

Read the n register (address 89). It holds the count of valid pairs in the current request. Pairs beyond index n contain placeholder zeros and should be ignored. Always read n first before interpreting off and val registers to avoid processing stale or uninitialised slots.

Are there risks to writing the offset/value pairs and execute register carelessly?

Yes. Writing incorrect offset values or out-of-range values can overwrite protected device parameters, trip protection limits, or cause the device to fault. Always stage and review all offset/value pairs before triggering execution with x. Confirm the target device documentation supports each intended register address before issuing a live write.

Want to see how it works?

Electrician working in an open distribution board