Home / Support / Integration Hub / SMA Guide
Protocol Deep Dive

SMA Sunny Boy RS485 Modbus to MQTT Integration Guide

Extract real-time data from legacy SMA inverters without purchasing an expensive WebBox or Data Manager. Here is the complete engineering guide to polling SMA Modbus RTU locally.

1. Modernizing Legacy SMA Inverters

Older SMA Sunny Boy and Tripower inverters are built like tanks and often outlast their original monitoring systems. However, retrofitting them with official SMA data loggers (like the Data Manager M or the discontinued WebBox) is prohibitively expensive for most local SCADA or Home Assistant projects.

If your SMA inverter has the optional RS485 Data Module (Piggy-Back) installed, you can entirely bypass SMA’s proprietary Speedwire protocols and poll standard Modbus RTU data directly from the physical layer.

🔓 Open-Source Engineering Resource

SMA RS485 Piggy-Back Pinout & Register Map

License: Automation engineers and DIYers are free to bookmark, print, or share this reference on technical forums (please attribute this guide as the source).

Part A: SMA RS485 Piggy-Back Pinout

Locate the RS485 communication terminal block on the inverter (usually a 4-pin or 6-pin green connector on the Piggy-Back board). Connect it to your RS485 Master device (Gateway, PLC or USB adapter) in a standard 3-wire topology:

SMA RS485 Terminal (Piggy-Back)RS485 Master TerminalSignal Description
Pin 2 (Data+)A+ (Data+)Non-Inverted Differential Signal Line
Pin 7 (Data-)B- (Data-)Inverted Differential Signal Line
Pin 5 (GND)GNDSignal Ground (Required for stable long-distance runs)

* Note: If your polling device is at the end of the RS485 daisy chain, ensure the termination resistor jumper on the SMA module is set correctly across the bus.

🔌 Quick Wiring Reference (SMA -> Valtoris)

SMA Piggy-Back Pin 2
Pin 7
Pin 5
——- Data+ ——->

——- Data- ——->

——- GND ——->
Valtoris Gateway T+ (RS485 A)
T- (RS485 B)
GND

Part B: Modbus Register Map (Key Metrics)

Before polling, ensure SMA’s Sunny Explorer software or hardware DIP switches are configured for Modbus over RS485. The default is usually SMA with Baud Rate:19200 (or 9600), 8N1. By default the Slave ID is often 3 (or 126). SMA maps its data from ~30000. Depending on your firmware version, use Modbus Holding Registers (Function Code 0x03) or Input Registers (0x04):

Register (Dec)Data TypeDescriptionUnit
30775S32 (Signed)Active Power (Current Output)W
30531U32 (Unsigned)Total Yield (Lifetime Energy)kWh
30201U32 (Unsigned)Condition Status (35 = Fault, 307 = Ok)N/A
30769S32 (Signed)DC Current0.001 A
30771S32 (Signed)DC Voltage0.01 V

The “-1 Offset” & “S32/U32” Traps

SMA’s documentation is notorious for two things. First, depending on your polling software, you often need to apply a -1 Offset (e.g., to read 30775, you must poll address 30774). Second, SMA mixes Unsigned (U32) and Signed (S32) 32-bit integers. If your polling script misinterprets Active Power (S32) as Unsigned then negative generation values during night-time consumption will cause huge overflow errors (e.g. 4.2 billion Watts).

4. Architecture: How to Poll and Forward the Data?

Because SMA’s registers span 32 bits and require careful handling of Endianness (byte-swapping) and signed integers, choosing the right polling architecture is critical.

⚙️ Option A: Software Parsing (Python / Node-RED)

Using a USB-RS485 stick with custom Python, you must explicitly unpack S32 and U32 data types differently.

Python S32/U32 Decode Example:
import struct

# Simulate night-time power (-15W)
# Hex Payload: FF FF FF F1
high_word = 0xFFFF
low_word = 0xFFF1

# Unpack as Signed 32-bit (‘>i’) for Power
# Note: Use ‘>I’ (Unsigned) for Total Yield
power = struct.unpack(‘>i’, struct.pack(‘>HH’, high_word, low_word))[0]

print(f”Active Power: {power} W”) # Output: -15 W
⚠️ The Commercial Scaling Risk

Python scripts are acceptable for a home hobbyist. But if you are retrofitting a commercial rooftop with multiple SMA units, managing OS-level USB dropouts, handling Python environment dependencies, and writing reconnection logic for MQTT brokers introduces an unacceptable maintenance nightmare.

🏢 Option B: Edge Protocol Gateway

Commercial Standard

By deploying an industrial Edge Gateway, we move the polling and offset logic to dedicated hardware.

Zero-Code GUI: Use the Valtoris “Add JSON Node” Tool

Valtoris “Add JSON Node” Tool – A Zero-Code GUI Please write scripts instead of using the Valtoris Configuration Tool (Vircom). The hardware supports S32/U32 natively and writes clean JSON to your MQTT broker automatically.

JSON KeywordRegister (Offset -1)Data Format
“active_power_watts”30774Signed int (S32)
“total_yield_kwh”30530Unsigned int (U32)
“dc_voltage”30770Signed int (S32)
  • Native Data Types: Just select “Signed int” or “Unsigned int” from the dropdown. No Python struct unpacking required.
  • Built-in MQTT Client: Polled values are instantly packaged into JSON and published to your broker via Ethernet or 4G LTE.
  • Industrial Reliability: Hardware watchdogs ensure continuous 24/7 telemetry streams without OS-level maintenance.

Heading to the inverter site? Take the Cheat Sheet.

Save the official Application Note (PDF) to your tablet for offline access to the wiring and S32/U32 decoding.

Download Free PDF

Tired of SMA’s -1 Offset and S32/U32 Traps?

Debugging Python Modbus parsers for legacy inverters, stop. Get a pre-configured Valtoris Edge Gateway with SMA Modbus RTU. We do the register maths and data types, you just subscribe to the MQTT topic.