Hybrid inverter monitor over RS485 Modbus (ESPHome)

A Modbus RTU template that reads battery, grid and load data from a hybrid inverter. You fill in the registers from your model.

Level: Advanced Board: ESP32 DevKit V1 (WROOM-32) Power & blackouts

⚠ Safety

High-current battery: a short circuit can start a fire. Fuse the battery plus close to the battery, and never power the ESP32 straight from the battery bank. Read-only monitoring means you do not touch the power wiring.

What you need

Buy the parts kit · Estimated total: $10.00

ESP32 DevKit V1 (30 pin, WROOM-32) × 1
$4.00
Buy at AliExpress Buy at Amazon.com
TTL to RS485 module (MAX3485 / MAX485, 3.3V) × 1
$1.50
Buy at AliExpress Buy at Amazon.com
DC-DC buck converter (MP1584 / LM2596) × 1
$1.50
Buy at AliExpress Buy at Amazon.com
Plastic project enclosure × 1
$3.00
Buy at AliExpress Buy at Amazon.com
🇺🇦 Ukraine🌍 Other countries

Other countries: order these parts on AliExpress with the links below.

Some links are affiliate links: we may earn a commission at no extra cost to you.

Wiring

ModuleModule pinESP32 pinNote
MAX3485 RO / DIUARTGPIO16 (RX) / GPIO17 (TX)RO to RX, DI to TX
MAX3485 DE+REdirectionGPIO4omit if the module has auto-direction
MAX3485 A / BRS485inverter RS485 port A / Bcheck the pinout in your inverter manual
Power for the ESP325Vbuck converter from a SEPARATE low-voltage supplydo not power from the inverter battery without fuse and isolation

Code

inverter-modbus.yaml
# 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"

Flash a ready firmware from the browser Paste your error into the AI Error Doctor

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.

← ← All projects

Related ideas

⛔ High risk

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.

Hybrid inverter monitor over RS485

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.

  • Board ESP32-C3 SuperMini
  • Level ●●● Advanced
  • Build time 3–4 h
Pick parts / kit
⛔ High risk

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 voltage monitor

Measures 220 V mains through an isolated ZMPT101B module and warns about sags, surges and blackouts in Telegram or Home Assistant.

  • Board ESP32 DevKit V1 (WROOM-32)
  • Level ●●○ Intermediate
  • Build time 2–3 h
Pick parts / kit
⛔ High risk

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.

Smart energy meter

Reads voltage, current, power and kWh with PZEM-004T and publishes them to a web page, MQTT or Home Assistant.

  • Board ESP32 DevKit V1 (WROOM-32)
  • Level ●●○ Intermediate
  • Build time 2–4 h
Pick parts / kit

Comments

No comments yet. Share your experience or ask a question.

Comments are moderated.