Deye / Sunsynk RS485 Modbus to MQTT Integration Guide
Take control and keep your hybrid inverter data local. Forget the 5 minute cloud latency of factory Wi-Fi loggers and stream battery SOC, grid dynamics and PV metrics locally via Modbus RTU.
1. The Limitation of Default Cloud Loggers
Whether your hybrid inverter is a Deye, Sunsynk or Sol-Ark, local energy orchestration requires high frequency data. The Wi-Fi dongles that come from the factory are dependent on remote servers and usually update every few minutes. For applications like sub-second zero-export prevention, dynamic EV charging, or instant industrial SCADA reporting, local monitoring via the physical layer is mandatory.
The control processor inside these inverters handles communication via a dedicated RS485 interface executing the standard Modbus RTU protocol.
Deye/Sunsynk RS485 Pinout & Register Map
Part A: Physical Port Wiring & Pins
Most Deye/Sunsynk low-voltage and high-voltage inverters provide external connectivity via an RJ45 port labeled BMS, Meter, or RS485. To interface the inverter with a downstream serial master or infrastructure gateway, establish the following 3-wire physical loop:
| Inverter RJ45 Connector Pins | RS485 Master Gateway Terminal | Signal Function |
|---|---|---|
| Pin 7 (or Pin 1 on specific models) | B- (Data-) | Inverted Differential Signal Line |
| Pin 8 (or Pin 2 on specific models) | A+ (Data+) | Non-Inverted Differential Signal Line |
| Pin 6 | GND | Reference Signal Ground (Prevents Common-Mode Shift) |
* Engineering Note: Pin definitions may vary slightly between single-phase residential and commercial three-phase units. If initial data frame requests time out, check your specific model’s terminal block wiring for RS485 A/B pinouts.
🔌 Quick Wiring Reference (Deye/Sunsynk -> Valtoris)
Pin 7
Pin 6
——- Data- ——->
——- GND ——->
T- (RS485 B)
GND
Experiencing CRC Errors or Modbus Timeouts?
If your wiring is correct but you receive random 0x00 frames or CRC check fails, it is not a software issue. Large solar inverters generate massive common-mode voltage noise that destroys differential RS485 signals.
Part B: Core Holding Registers
Configure your communications node to the following baseline parameters: Baud Rate: 9600, Data Bits: 8, Stop Bits: 1, Parity: None. The default target Slave ID is almost universally 1. Deye maps its operational values using Holding Registers (Function Code 0x03):
| Register Address (Dec) | Data Format | Description / Parameter Group | Unit & Multiplier |
|---|---|---|---|
| 590 | S16 (Signed) | Total Active Grid Power (Negative indicates power export to grid) | 1 W |
| 588 | U16 (Unsigned) | Battery State of Charge (SOC) | 1 % |
| 591 | U16 (Unsigned) | Battery Voltage Baseline | 0.01 V |
| 592 | S16 (Signed) | Battery Current Flow (Negative indicates discharging state) | 0.01 A |
| 502 | U16 (Unsigned) | Daily Photovoltaic Generation Accumulator | 0.1 kWh |
The Two’s Complement Sign Trap
Pay close attention to Registers 590 and 592. Because energy can flow bidirectionally (charging/discharging or importing/exporting), Deye uses Signed 16-bit integers (S16). When the inverter is exporting 10 Watts to the grid, the raw Modbus hex register returns 0xFFF6. If you have your data parsing script configured incorrectly for standard Unsigned integers (U16) this will interpret this as 65,526 Watts and break your automation logic right away.
4. Architecture: Microcontroller Scripting vs. Protocol Bridges
Retrieving raw hex frames from a multi-register layout requires an architecture capable of maintaining stable physical timings while translating data formats.
⚙️ Option A: Software Parsing (Python Scripts)
If deploying generic USB-RS485 dongles on a Raspberry Pi, your software loop must explicitly cast the 16-bit register into a signed value.
Python Two’s Complement Decode:Python scripts are acceptable for a home hobbyist. But if you are managing a commercial rooftop or distributed microgrid, 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 StandardDeploying an industrial-grade edge gateway running dedicated serial stack processing directly on silicon removes the scripting layer entirely.
Zero-Code GUI: Use the Valtoris “Add JSON Node” ToolDon’t write scripts, just open the Valtoris Configuration Tool (Vircom). Map your Deye registers using the visual Add JSON Node menu. The hardware does automatic decoding of S16 and decimal shifting.
| Corresponding JSON Keyword | Register Address | Data Format | Decimal Point Places |
|---|---|---|---|
| “grid_active_power_watts” | 590 | Signed int | 0 |
| “battery_soc_percent” | 588 | Unsigned int | 0 |
| “battery_voltage” | 591 | Unsigned int | 2 (Shift) |
| “battery_current_amps” | 592 | Signed int | 2 (Shift) |
- Hardware S16 Parsing: Set the Data Format to “Signed int”. The gateway firmware natively decodes Deye’s Two’s Complement negative values.
- Auto-Scaling: Set Decimal Point Places to “2”. The gateway automatically divides raw data by 100 before pushing the JSON to MQTT.
- Autonomous Operation: Built-in isolation circuitry and hardware watchdogs prevent RS485 bus lockups.
Heading to the inverter site? Take the Cheat Sheet.
Save the official Application Note (PDF) to your tablet for offline access to the pinouts and S16 signed register handling.
Want to Skip the S16 Negative Number Parsing?
Stop wrestling with Python struct unpacking and Two’s Complement math. Order a ready to use Valtoris Edge Gateway with Deye / Sunsynk inverters. We do the Modbus parsing, you just subscribe to clean MQTT JSON.
