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

Deye / Sunsynk RS485 Modbus to MQTT Integration Guide

Own your hybrid inverter data locally and take control. Skip 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.

🔓 Open-Source Engineering Resource

Deye/Sunsynk RS485 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: 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 PinsRS485 Master Gateway TerminalSignal 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 6GNDReference 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.

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.

See how to fix this with a 2500V Isolated RS485 Hub

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 FormatDescription / Parameter GroupUnit & Multiplier
590S16 (Signed)Total Active Grid Power (Negative indicates power export to grid)1 W
586U16 (Unsigned)Battery State of Charge (SOC)1 %
591U16 (Unsigned)Battery Voltage Baseline0.01 V
592S16 (Signed)Battery Current Flow (Negative indicates discharging state)0.01 A
502U16 (Unsigned)Daily Photovoltaic Generation Accumulator0.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:
import struct

# Deye exporting 10W returns 0xFFF6 hex (65526 decimal)
raw_register_val = 65526

# Pack as unsigned short (H), unpack as signed short (h)
signed_watt = struct.unpack(‘h’, struct.pack(‘H’, raw_register_val))[0]

print(f”Grid Power: {signed_watt} W”) # Output: -10 W
⚠️ The Commercial Scaling Risk

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 Standard

Deploying an industrial-grade edge gateway running dedicated serial stack processing directly on silicon removes the scripting layer entirely.

  • Silicon Parsing: The gateway firmware natively supports signed integers (S16) and scaling factors, so it can convert raw hex directly into negative decimals, no extra coding required.
  • Cloud Ready JSON: Converts data into structured JSON streams pushed directly to your MQTT broker over robust Ethernet or 4G LTE.
  • Autonomous Operation: Built-in 2500V isolation circuitry and hardware watchdogs prevent bus lockups and guarantee 24/7 uptime.

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.

Download Free PDF

Scaling Microgrid or Solar Deployments?

Eliminate the reliability issues of custom polling scripts and single-board computer SD card crashes. See how systems integrators utilize Valtoris Edge Gateways to securely translate local inverter registers into standardized JSON streams.