Skip to content

About

Home Assistant (HACS) integration for Growatt MOD/MID TL3-XH three-phase hybrid inverters over local Modbus TCP

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

64 Commits

Folders and files

Repository files navigation

English | Čeština

Growatt MOD/MID Modbus TCP for Home Assistant

Local Home Assistant integration for Growatt MOD / MID TL3-XH three-phase hybrid inverters. It polls the inverter over Modbus TCP and exposes PV, grid, load and battery data as sensors, plus a small set of writable settings — no cloud and no Growatt account involved.

HACS Custom Integration Buy Me a Coffee

This is a custom repository. It is not in the default catalog, so you add it by link — see Installation.


Features

  • 100% local polling over Modbus TCP — nothing leaves your network.
  • Config flow with a connection test: device name, host, port, Modbus unit ID and scan interval. No YAML needed.
  • Sensors for PV strings, grid import/export, load, battery power and energy counters (usable in the Energy dashboard), BMS data and per-module data for up to six battery modules.
  • Controls as native entities: grid charge, charge and discharge stop SOC, grid charge limits, export limit mode and rate, battery charge/discharge power, mode of time period 1.
  • Driven by a human-readable YAML register map that you can replace with your own.
  • Low-level services to write any holding register.
  • Diagnostics download for bug reports (the host address is redacted).
  • Several inverters can be added side by side; each gets its own device.

Supported inverters

Inverter Status
Growatt MOD 20KTL3-XH with APX battery Tested — this is the hardware the integration is developed on.
Other models of the Growatt MOD / MID TL3-XH family Not tested. They are the intended target of the register map, so they may work as is or need adjustments in a custom map. Reports are welcome.

Other Growatt series (SPH, MIN/TL-XH, SPF, …) are not covered by the bundled register map.

You need a Modbus TCP path to the inverter's RS485 Modbus port, typically an RS485-to-Ethernet/Wi-Fi gateway.


Installation

Home Assistant 2026.11 and newer — Marketplace

Home Assistant 2026.11 replaced HACS with the built-in Marketplace.

  1. Go to Settings ▸ Marketplace (administrators only).
  2. Select Add from link and enter https://github.com/Developer089/Growatt_Modbus_MID-MOD. If it asks for a Type, choose Integration.
  3. Open the repository page and select Install.
  4. Restart Home Assistant.
  5. Go to Settings ▸ Devices & Services ▸ Add Integration and search for Growatt MOD/MID Modbus TCP.

Home Assistant before 2026.11 — HACS (custom repository)

  1. In Home Assistant open HACS.
  2. Open the top-right menu ⋮ → Custom repositories.
  3. Add the repository URL https://github.com/Developer089/Growatt_Modbus_MID-MOD and choose the category Integration.
  4. Find Growatt MOD/MID Modbus TCP in the list and select Download.
  5. Restart Home Assistant.
  6. Go to Settings ▸ Devices & Services ▸ Add Integration and search for Growatt MOD/MID Modbus TCP.

Requires Home Assistant 2024.11 or newer.

Manual installation

  1. Copy the folder custom_components/growatt_modbus from this repository into your Home Assistant configuration directory, so that you end up with /config/custom_components/growatt_modbus/.
  2. Restart Home Assistant.
  3. Add the integration via Settings ▸ Devices & Services ▸ Add Integration → "Growatt MOD/MID Modbus TCP".

pymodbus is installed automatically by Home Assistant from the manifest.


Configuration

Setup form

Field Default Notes
Device name Growatt Name of the device in Home Assistant; entity names are prefixed with it. Use different names when you add several inverters.
Host (IP address) — IP address or host name of the Modbus TCP gateway.
Port 502 TCP port of the gateway.
Unit ID 1 Modbus slave address of the inverter (0–247).
Scan interval (ms) 10000 How often all registers are read, 50–20000 ms.
YAML map path EMBEDDED Leave as is to use the bundled map, or enter the path of your own map — see Custom register map.

On submit the integration connects and reads one input register (3000, then 0 if there is no answer); it never writes. Any answer from the inverter counts, including a Modbus error reply. Cannot connect means the TCP connection failed (host/port); no response means the gateway accepted the connection but nothing answered for this unit ID (unit ID, wiring).

Options

Open the integration and select Configure. The entry reloads when you save.

Option Default Notes
Scan interval (ms) 10000 50–20000 ms.
Transport tcp tcp is standard Modbus TCP. rtutcp sends RTU frames over a TCP socket, for gateways that pass the serial data through unchanged. rtutcp was checked against pymodbus 3.0.2 to 3.16.2 with a local test server only; it has not been tested with a real gateway or inverter.
Address offset 0 Subtracted from every register address before it is sent, for gateways that shift the map.
Baud rate / bits per byte / parity / stop bits 9600 / 8 / N / 1 Kept for existing entries; not used. The serial settings belong to the gateway, not to the TCP connection.

Upgrading from older versions

Entries created by earlier versions keep working without being re-added: an old scan_interval in seconds is converted to milliseconds (and limited to 20 s), and an entry without a device name is shown as Growatt. Entity unique IDs are unchanged.

How polling works

Every cycle reads all holding and input registers of the map, grouped into as few requests as possible (22 requests with the bundled map). A block of registers that fails to answer does not affect the others. If the inverter rejects a block, the block is read register by register, so one register missing on your firmware does not hide its neighbours; a register that keeps failing is retried every 5 minutes. A very short scan interval means a lot of traffic on the RS485 bus; a few seconds is plenty for most uses. After a write, the written value is shown for 5 seconds before the value read back from the inverter takes over again.


Entities

The list below is what the bundled map.yaml creates: 107 sensors and 11 controls.

Sensors

Area Entities
PV PV1 / PV2 Voltage, Current and Power; PV Input Power
Grid Power From Grid, Power To Grid
Load Load Power
Battery Battery SOC, Battery Charge Power, Battery Discharge Power
Energy — today Today User Consumption, Energy Of User Load Today, Energy To Grid Today, Battery Charge Today, Battery Discharge Today, Energy From AC Charge Today
Energy — total Generate Energy Total, PV Energy Total, Energy Of User Load Total, Energy To User Load Total, Energy To Grid Total, Battery Charge Total, Battery Discharge Total, Energy From AC Charge Total, Energy Of System Output
BMS BMS Status, BMS SOC, BMS State Of Health, BMS Battery Voltage / Current / Temperature, BMS Max Charge / Discharge Current, BMS Charge / Discharge Voltage Limit, BMS Cell Voltage Max / Min, BMS Cycle Count, Battery Load Voltage
Battery modules 1–6 For each module: State, SOC, SOH, Voltage, Current, Power, Cell Voltage Max / Min, Max / Min Temperature
Diagnostic Work Mode, Active Priority, Firmware Version, Export Limit Mode (read), Export Power Rate (read)

Entities for six battery modules are always created; disable the ones for modules you do not have. The read-back sensors that back the controls (Export … (read) and the automatically added RB … sensors) are disabled by default.

Active Priority (input register 3144: Load First / Battery First / Grid First) is mapped as the protocol document describes it but has not been verified on a real inverter. If the inverter reports something else, the sensor shows the raw number.

Controls

Type Entity Register Values
Switch Grid Charge holding 3049 on / off
Select Export Limit Mode holding 122 Disabled, Smartmeter, CT clamp
Number Export Power Rate holding 123 −100 … 100 %, step 0.1
Number Battery Charge Power holding 3047 0 … 100 %
Number Battery Discharge Power holding 3036 0 … 100 %
Number Charge Stop SOC holding 3048 1 … 100 %
Number Charge Stop SOC from Grid holding 3312 0 … 100 %
Number Max Charge Power from Grid holding 3311 0 … 30 kW, step 0.1
Number Discharge Stop SOC (Grid First) holding 3037 1 … 100 %
Number Discharge Stop SOC (Grid First, on-grid) holding 3067 1 … 100 %
Select Period 1 Mode (full day) holding 3038–3039 (32-bit) Load priority, Battery priority, Grid priority — rewrites time period 1, see below

All controls are in the Configuration category of the device.

Controls show the value read back from the inverter. If a register cannot be read, the control shows unknown instead of the last value it had; a number also shows unknown when the register holds a value outside the range above. The integration writes a setting only when you change it — never on startup or on its own.

Period 1 Mode (full day) is not a plain priority switch. Selecting an option rewrites time period 1 as a whole: enabled, 00:00–23:59, with the chosen priority. Whatever period 1 held before — other times, or being disabled — is replaced. The entity shows unknown when period 1 holds anything other than one of these three full-day settings. Time periods 2–9 are not touched.

Discharge Stop SOC (Grid First) and Discharge Stop SOC (Grid First, on-grid) are named after the protocol document: register 3037 is "Stop Discharge soc when Grid First" (V1.39 p46) and register 3067 is "Stop Discharge soc when Grid First and on-grid" (p48). Other community integrations label 3037 as the off-grid limit. Which of the two the MOD firmware uses in which situation is unverified.

Writable settings are stored in the inverter's EEPROM, which has a limited number of write cycles. Change them when something really changes — do not write them from an automation that runs in a tight loop (for example on every power reading). The same applies to the write services below.

Controls write directly to the inverter's settings. Check a value before you change it.

Battery charging from the grid

To charge the battery from the grid, three things have to be true at the same time:

  1. Grid Charge is on. This allows the inverter to charge the battery from the AC side at all.
  2. A battery-first period is active. Set Period 1 Mode (full day) to Battery priority. This rewrites time period 1 to enabled, 00:00–23:59, battery first, replacing whatever period 1 held. In load-first or grid-first operation the inverter does not charge from the grid.
  3. The battery is below the charge limits described next.

Then set the limits:

  • Charge Stop SOC — charging stops when the battery reaches this state of charge.
  • Charge Stop SOC from Grid — a second stop that applies to charging from the grid only. The lower of the two wins: with Charge Stop SOC at 100 % and Charge Stop SOC from Grid at 55 %, grid charging stops at 55 %. Growatt's app and portal do not show this setting, so check it when grid charging stops earlier than you expect.
  • Max Charge Power from Grid — upper limit of the power taken from the grid for charging, in kW.
  • Battery Charge Power — charge power rate in battery-first operation, in %.
Entity Register Unit Range
Grid Charge (switch) holding 3049 — on / off
Period 1 Mode (full day) (select) holding 3038–3039 — Load priority / Battery priority / Grid priority
Charge Stop SOC holding 3048 % 1–100
Charge Stop SOC from Grid holding 3312 % 0–100
Max Charge Power from Grid holding 3311 kW (0.1 kW per count) 0–30
Battery Charge Power holding 3047 % 0–100

To stop charging from the grid, turn Grid Charge off or set Period 1 Mode (full day) back to Load priority.

What you need to know before relying on it:

  • Registers 3311 and 3312 are not in Growatt's public protocol (Modbus RTU Protocol II V1.39). They come from other community integrations, where they were confirmed on a MOD 10KTL3-XH. Older firmware may not have them; the two entities then read 0 or are shown as unknown, and the rest of the integration keeps working.
  • Max Charge Power from Grid is experimental. Nobody has published a measurement showing that the charge power on a MOD actually follows register 3311.
  • An inverter on which the limit was never set can report 65535 (6553.5 kW) in register 3311. The entity then shows unknown until you enter a value; the integration does not write anything by itself.
  • Period 1 Mode (full day) on the newest firmware: on firmware that reports VPP protocol 2.05, writes to the time-period registers 3038–3059 have been reported to be accepted and then revert within seconds. If Period 1 Mode (full day) jumps back, this is the reason, and the period has to be set in the Growatt app instead.
  • Period 1 Mode (full day) replaces time period 1. Selecting an option writes period 1 as enabled, 00:00–23:59, with the chosen priority; a night-only window or a disabled period 1 that you set elsewhere is overwritten, so grid charging is then allowed all day. The entity shows unknown while period 1 holds anything else.
  • These settings are stored by the inverter. Do not write them from fast automations; a few changes a day is what they are meant for.

Custom register map

The integration is driven by a YAML map. To use your own instead of the bundled one:

  1. Copy custom_components/growatt_modbus/map.yaml to a place that survives updates, for example /config/growatt_modbus_map.yaml, and edit it.
  2. Enter that path in the YAML map path field when you add the integration.

Things to know:

  • The custom map replaces the bundled map completely; the two are not merged.
  • The path is set when the entry is created and is not part of the options. After editing the file, reload the integration.
  • If the file does not exist, the bundled map is used and a warning is logged.
  • Keep the unique_id of an entry stable — it identifies the entity in Home Assistant.

A map has two lists:

sensors:
  - name: Battery SOC
    unique_id: battery_soc
    register_type: input        # input or holding
    address: 3171
    count: 1                    # 1 = 16-bit, 2 = 32-bit (high word first)
    scale: 1
    unit_of_measurement: "%"
    device_class: battery
    state_class: measurement
    signed: false
    # optional: mask: 0xFF                 bit mask applied before sign and scale
    # optional: options: {0: "Standby"}    value-to-text mapping
    # optional: entity_category: diagnostic

controls:
  - type: number                # switch, select, number, number32 or select32
    name: "Battery Charge Power"
    unique_id: battery_charge_power
    register_type: holding
    address: 3047
    min: 0
    max: 100
    step: 1
    unit_of_measurement: "%"
    write_factor: 1             # value written = entity value × write_factor
    entity_category: config
    # optional: read_unique_id: <sensor unique_id>   sensor that reports the current value

A control on a holding register without read_unique_id automatically gets a hidden read-back sensor (rb_<unique_id>), so it shows the value stored in the inverter.

The service growatt_modbus.log_mapping writes the map that is actually in use to the log at info level (enable it with the logger configuration under Troubleshooting).


Services

Service Fields What it does
growatt_modbus.write_register address, value (0–65535) Writes one holding register (function code 06).
growatt_modbus.write_registers address, values (list) Writes consecutive holding registers (function code 16).
growatt_modbus.write_u32 address, value (0–4294967295), word_order (high_low default, or low_high) Writes a 32-bit value into two registers.
growatt_modbus.log_mapping — Logs the path of the active map and the resulting sensors and controls (log level info).

Addresses are the register numbers from the protocol document; the address offset from the options is applied for you.

action: growatt_modbus.write_register
data:
  address: 3047
  value: 50

With more than one inverter configured, the services are not addressed to a particular inverter: they act on the entry that was loaded last. Use the entities when you need to target a specific inverter.

The EEPROM warning above applies to these services as well.


Troubleshooting

  • "Cannot connect" in the setup form — check the IP address and port of the gateway and that Home Assistant can reach it. Many gateways accept only one TCP client at a time, so stop other Modbus pollers first.
  • "Connected, but no response" — the gateway is reachable but the inverter does not answer: check the unit ID, the RS485 wiring (A/B swapped) and the serial settings of the gateway.
  • Entities are unavailable — the last poll failed. The integration reconnects on its own at the next cycle; look in the log for the reason.
  • Values look shifted or wrong — the gateway may shift addresses; try the address offset option. For an inverter other than the tested one, a register may differ — adjust it in a custom register map.
  • A control shows "unknown" — the register could not be read (it may not exist on your firmware; the log says so after three failed attempts and the integration retries every 5 minutes), a number holds a value outside the entity's range, or time period 1 holds a schedule other than the three full-day settings.
  • A control jumps back after a change — the inverter rejected the value or reports a different one. The value read back from the inverter wins 5 seconds after the write; rejected writes are logged as warnings.
  • Bus errors with a short scan interval — raise the scan interval.

Debug logging:

logger:
  logs:
    custom_components.growatt_modbus: debug
    pymodbus: debug

When you open an issue, attach the diagnostics file (Settings ▸ Devices & Services ▸ the integration ▸ ⋮ ▸ Download diagnostics) and say which inverter and battery you have.


Licence

MIT. This project is not affiliated with or endorsed by Growatt; the name is used only to say which inverters the integration talks to.

Support

This integration is free and open source. If it saves you time, you can buy me a coffee — entirely optional.

Buy Me a Coffee

About

Home Assistant (HACS) integration for Growatt MOD/MID TL3-XH three-phase hybrid inverters over local Modbus TCP

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages