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

Deye / Sunsynk RS485 Modbus to MQTT Integration Guide

Keep control of your hybrid inverter data on-premises. 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).

2. Universal RS485 Pinout (RJ45)

🛑 CRITICAL WARNING: Ensure you plug into the specific port labeled RS485 or Meter. DO NOT plug RS485 Master cables into the CAN/BMS port, or you risk permanent hardware damage.

Most Deye/Sunsynk low-voltage and high-voltage inverters provide external connectivity via an RJ45 port. After locating the correct RS485/Meter port, 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)

RJ45 Connector Pinout (Looking into the cable plug)

1
2
3
4
5
6
7
8
Pin 6: GND Pin 7: B- (Data-) Pin 8: A+ (Data+)

* 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)

Deye RJ45 Pin 8
Pin 7
Pin 6
——- Data+ ——->

——- Data- ——->

——- GND ——->
Valtoris Gateway T+ (RS485 A)
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.

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

3. Modbus Register Map (Key Metrics)

Step 1: Check Inverter Settings. On the inverter LCD menu, go to Advanced Setup -> Modbus SN / Slave ID. Make sure your polling script has the same Slave ID (Default is 01) and the protocol is Modbus RTU.

Step 2: Set your communications node to the baseline settings: Baud Rate: 9600, Data Bits: 8, Stop Bits: 1, Parity: None. Deye uses 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
588U16 (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

* Engineering Note: Registers above are listed as Base-0. If your Modbus master software (like Modbus Poll or PLC standards) uses Base-1, you must add +1 to these addresses (e.g., poll 591 to read register 590).

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.

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

Don’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 KeywordRegister AddressData FormatDecimal Point Places
“grid_active_power_watts”590Signed int0
“battery_soc_percent”588Unsigned int0
“battery_voltage”591Unsigned int2 (Shift)
“battery_current_amps”592Signed int2 (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.

Download Free PDF

5. Frequently Asked Questions (Field Troubleshooting)

What is the default Modbus Slave ID for Deye/Sunsynk?
Modbus Slave ID default usually is 01. You can check/change this on the inverter’s LCD touch screen under Advanced Setup -> Modbus SN. Make sure that the id of your polling software or gateway is identical to this one.
I get timeout errors. Could it be a baud rate mismatch?
Yes. While many Deye inverters default to 9600 baud (8N1), some newer firmware versions or 3-phase commercial models may default to 115200. Always check the inverter’s Modbus settings screen and ensure your gateway’s serial parameters match perfectly.
Can I plug my RS485 gateway into the BMS or CAN port?
Absolutely not. The BMS/CAN port is strictly for communicating with lithium battery BMS (like Pylontech). Plugging an RS485 Modbus master into the CAN port can cause a short circuit and destroy the communications board. Only use the port explicitly labeled “Meter” or “RS485”.

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.