Skip to content

Latest commit

 

History

History
214 lines (163 loc) · 7.42 KB

File metadata and controls

214 lines (163 loc) · 7.42 KB

Growatt Inverter → Home Assistant via Modbus RS485 / MQTT

Monitor a Growatt 3-phase inverter in Home Assistant using Modbus RS485, a Modbus TCP gateway, Node-RED, and MQTT Discovery.

Overview

Growatt MID 12KTL3-XL
  │ RS485 (Modbus RTU)
  ▼
Modbus TCP/RTU Gateway (e.g. Advantec ICR-3231 with TCP2RTU app)
  │ Modbus TCP (port 502)
  ▼
Node-RED (node-red-contrib-modbus)
  │ MQTT
  ▼
Home Assistant (MQTT Discovery)

Data is polled every 20 seconds. Sensors appear automatically in Home Assistant via MQTT Discovery, grouped under a single "Growatt Inverter" device.


Hardware

Inverter

  • Growatt MID 12KTL3-XL (3-phase string inverter)
  • Other Growatt models using the same Modbus RTU register map should work with minor adjustments
  • RS485 port on the inverter — refer to your inverter manual for connector location and pinout

Modbus TCP/RTU Gateway

Any device that bridges Modbus TCP to Modbus RTU RS485 will work. This setup uses an Advantec ICR-3231 router running the MODBUS-TCP2RTU router app.

Other options:

  • Waveshare RS485 to Ethernet converters
  • USR-N510 / USR-TCP232 series
  • Any Modbus TCP → RTU gateway configured for the parameters below

RS485 Wiring

Connect the inverter RS485 port to the gateway RS485 port:

Inverter Gateway
RS485 A+ RS485 A+
RS485 B- RS485 B-
GND GND (recommended)

Use shielded twisted pair cable. Keep cable runs as short as practical.


Gateway Configuration

Configure your Modbus TCP/RTU gateway with these serial parameters to match the Growatt inverter:

Parameter Value
Serial port RS485 port on gateway
Baud rate 9600
Parity None
Data bits 8
Stop bits 1
Modbus mode RTU
TCP listen port 502
Split timeout 200 ms

Advantec ICR-3231 specific (TCP2RTU app)

Relevant parameters from the router app configuration:

MOD_TCP2RTU_ENABLED=1
MOD_TCP2RTU_DEVICE=ttyS1        # RS485 port — may differ on your unit
MOD_TCP2RTU_BAUDRATE=9600
MOD_TCP2RTU_PARITY=N
MOD_TCP2RTU_STOPBITS=1
MOD_TCP2RTU_SPLIT=200
MOD_TCP2RTU_MODE=1
MOD_TCP2RTU_ADDR=<GATEWAY_IP>   # Static IP of the gateway on your network
MOD_TCP2RTU_TIMEOUT=1000

Assign the gateway a static IP on your network and note it — you will need it in Node-RED.


Node-RED Setup

Requirements

  • Node-RED (standalone or via Home Assistant add-on)
  • node-red-contrib-modbus v5.x
  • MQTT broker (e.g. Mosquitto, built into HA)

Installation

  1. Install node-red-contrib-modbus via Node-RED Palette Manager
  2. Import flows.json into Node-RED (Menu → Import)
  3. Configure the Modbus client node (growatt via gateway):
    • Host: <GATEWAY_IP> — IP address of your Modbus TCP gateway
    • Port: 502
    • Unit ID: 1 (default for Growatt, check your inverter settings)
    • Type: TCP
  4. Configure the MQTT broker node:
    • Host: <HA_IP> — IP address of your Home Assistant / MQTT broker
    • Port: 1883
    • Client ID: any unique name
  5. Deploy

Flows

Tab: Growatt RS485

Polls the inverter and publishes to Home Assistant.

Node Function
modbus read growatt rs485 Reads 100 input registers (addr 0–99) every 20s
convert data Parses raw 16-bit register values into scaled engineering units
state parse node Publishes parsed data to growatt/inverter/state
discovery node Sends MQTT Discovery config messages (run once at startup)
modbus read xtra growatt sensors Reads diagnostic registers (addr 200–205) every 5 min
parse data xtra growatt sensors Parses diagnostic register values

Tab: reboot advantec

Optional watchdog flow. Monitors the Modbus connection during daylight hours (checks sun.sun state). If 3 consecutive polls fail, publishes a reboot trigger via MQTT.

Requires the Home Assistant Websocket node (node-red-contrib-home-assistant-websocket) and a corresponding HA automation or script to perform the actual reboot of the gateway.


Modbus Register Map

All registers are Input Registers (Function Code 4). Values are 16-bit unsigned integers unless noted.

Main registers (addr 0–99, read every 20s)

Register Key Scale Unit Notes
0 status 0=waiting, 1=normal, 3=fault
1–2 pv_power ×0.1 (32-bit) W High + low register
3 pv1_voltage ×0.1 V
4 pv1_current ×0.1 A
7 pv2_voltage ×0.1 V
8 pv2_current ×0.1 A
35–36 ac_power ×0.1 (32-bit) W High + low register
37 ac_frequency ×0.01 Hz
38 ac_voltage_r ×0.1732 V Phase R
39 ac_current_r ×0.1 A Phase R — zeroed when status ≠ 1
42 ac_voltage_s ×0.1732 V Phase S
43 ac_current_s ×0.1 A Phase S — zeroed when status ≠ 1
46 ac_voltage_t ×0.1732 V Phase T
47 ac_current_t ×0.1 A Phase T — zeroed when status ≠ 1
53–54 energy_today ×0.1 (32-bit) kWh Resets at midnight
55–56 energy_total ×0.1 (32-bit) kWh Lifetime production
93 inverter_temp ×0.1 °C

Diagnostic registers (addr 200–205, read every 5 min)

Register Key Scale Unit Notes
200 pv_isolation_resistance ×1
201 r_dci_curr ×0.1 mA DC injection current Phase R
202 s_dci_curr ×0.1 mA DC injection current Phase S
203 t_dci_curr ×0.1 mA DC injection current Phase T — filtered if > 10 000 (invalid value)
205 gfci_curr ×0.1 mA Ground fault current

Home Assistant Sensors

All sensors appear under a single Growatt Inverter device in HA. State topic: growatt/inverter/state.

Sensor Device class State class
Status
PV Power power measurement
PV1/PV2 Voltage voltage measurement
PV1/PV2 Current current measurement
AC Power power measurement
AC Frequency frequency measurement
AC Voltage R/S/T voltage measurement
AC Current R/S/T current measurement
Energy Today energy total_increasing
Total Energy energy total_increasing
Inverter Temperature temperature measurement
PV Isolation Resistance measurement
R/S/T DCI Current measurement
GFCI Current measurement

Known Quirks

AC current registers hold last value at standby

When the inverter goes into standby (status = 0) at sunset, AC current registers (39, 43, 47) retain their last production value instead of resetting to zero. The flow zeroes these values when status ≠ 1.

T DCI current invalid value

Register 203 (T DCI current) occasionally returns 0xFFF6 / 65526, which appears to be an "unavailable" sentinel value from the inverter. Values above 10 000 (raw) are filtered to 0 in the parse node.

AC voltage scaling

AC voltage registers use a factor of ×0.1732 rather than ×0.1. This is specific to the MID 12KTL3-XL register map — verify against your model's documentation if using a different inverter.


Tested With

  • Growatt MID 12KTL3-XL (3-phase, 12 kW)
  • Advantec ICR-3231 with MODBUS-TCP2RTU router app
  • Node-RED 3.0.2 with node-red-contrib-modbus 5.45.2
  • Home Assistant with Mosquitto MQTT broker

License

MIT