High-current battery: a short circuit can start a fire. Put a fuse next to the battery plus, use thick enough wires and respect the BMS limits.
Speak the inverter’s language
Hybrid inverters expose a communication port, but the port that you need is not always the one you find first. On Deye there is a Modbus RS485 port that is separate from the BMS port. Growatt uses RS485 or a Wi-Fi stick. Voltronic and similar models talk a serial protocol at 2400 baud with text commands such as QPIGS.
Work in this order
First connect a USB-RS485 adapter to a PC and read the registers with a Modbus tool. Register maps differ between firmware versions, and it is far easier to debug there than on the ESP32.
Then move the same requests to the ESP32 with a 3.3 V transceiver.
Poll every 5 to 10 seconds. A busy master can slow down the inverter’s own communication.
Keep it read-only. Writing a wrong register can change the charge limits.
A galvanic isolation between the inverter and the ESP32 avoids ground loops. A small buck converter can power the node from the same battery bus.
Components
ESP32 DevKit V1 (30 pin, WROOM-32)
TTL to RS485 module (MAX3485 / MAX485, 3.3V)
DC-DC buck converter (MP1584 / LM2596)
Plastic project enclosure
Wiring
Module
Module pin
ESP32 pin
Note
MAX3485 RO / DI
UART
GPIO16 (RX) / GPIO17 (TX)
RO to RX, DI to TX
MAX3485 DE+RE
direction
GPIO4
omit if the module has auto-direction
MAX3485 A / B
RS485
inverter RS485 port A / B
check the pinout in your inverter manual
Power for the ESP32
5V
buck converter from a SEPARATE low-voltage supply
do not power from the inverter battery without fuse and isolation
Code
# Generic Modbus RTU template. The register addresses below are PLACEHOLDERS (0x0000...).
# Take the real addresses, scaling and data types from the Modbus map of YOUR inverter model.
esphome:
name: inverter-monitor
esp32:
board: esp32dev
framework:
type: arduino
logger:
api:
encryption:
key: !secret api_key
ota:
- platform: esphome
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
uart:
id: mod_uart
tx_pin: GPIO17
rx_pin: GPIO16
baud_rate: 9600
stop_bits: 1
modbus:
id: modbus1
uart_id: mod_uart
flow_control_pin: GPIO4
modbus_controller:
- id: inverter
address: 1 # Modbus slave address of the inverter
modbus_id: modbus1
update_interval: 10s
sensor:
- platform: modbus_controller
modbus_controller_id: inverter
name: "Battery voltage"
address: 0x0000 # TODO: from your register map
register_type: holding
value_type: U_WORD
unit_of_measurement: "V"
accuracy_decimals: 1
filters:
- multiply: 0.1 # TODO: scaling from the register map
- platform: modbus_controller
modbus_controller_id: inverter
name: "Battery state of charge"
address: 0x0001 # TODO
register_type: holding
value_type: U_WORD
unit_of_measurement: "%"
- platform: modbus_controller
modbus_controller_id: inverter
name: "Load power"
address: 0x0002 # TODO
register_type: holding
value_type: U_WORD
unit_of_measurement: "W"
- platform: modbus_controller
modbus_controller_id: inverter
name: "Grid power"
address: 0x0003 # TODO
register_type: holding
value_type: S_WORD
unit_of_measurement: "W"
Build tips
Download the Modbus register map for your exact inverter model; addresses and scaling differ between brands.
Test with a USB-RS485 adapter and a Modbus tool first; wrong baud rate or A/B swap are the usual faults.
Reads power, battery state and grid status from a hybrid inverter over its RS485 Modbus port and publishes them locally, with no vendor cloud in between.
Mains 220–230 V can kill. Work with the power off, use certified isolated modules in an enclosure, fuse the line, and ask a qualified electrician if you are not sure.
Mains 220–230 V can kill. Work with the power off, use certified isolated modules in an enclosure, fuse the line, and ask a qualified electrician if you are not sure.
Comments
No comments yet. Share your experience or ask a question.