Skip to content

WIT-only Growatt Modbus Fix (VPP / Remote Control) #143

@linksu79

Description

@linksu79

Summary: WIT-only Growatt Modbus Fix (VPP / Remote Control)

This package contains a WIT-only implementation for Growatt hybrid inverters (e.g. WIT 6 HU), based on working, field-tested files.

The goal is to make remote/VPP battery control fully functional and stable without affecting other inverter models (SPH, SPF, etc.).


Problems in current integration

1. WIT is treated like SPH/SPF (incorrect)

The Growatt WIT series uses a different control logic and register behavior.
Reusing SPH/SPF assumptions causes:

  • broken AC charging control

  • missing VPP entities

  • unreliable charge/discharge behavior

  • conflicts with EMS / CEW / external controllers


2. Missing VPP / Remote control registers in WIT profile

The following official Growatt VPP registers were missing or unusable for WIT:

Register | Purpose -- | -- 30100 | Control authority (VPP enable) 30407 | Remote power control enable 30409 | Remote power control value (+charge / −discharge) 30410 | AC charging mode (Disabled / PV first / AC first) 30474 | Actual applied control value (readback)

Without these, external control cannot work correctly.


3. Signed values not supported (critical)

Register 30409 is signed:

  • positive value → charge

  • negative value → discharge

The original implementation expected only unsigned values (0–65535), which caused:

H format requires 0 <= number <= 65535

This made discharge control impossible.


4. WIT select entities were never created

select.py exited early for WIT devices, so no select entities were created for:

  • control authority

  • AC charging mode

  • remote enable flags

This made correct configuration impossible from Home Assistant UI.


What was changed (WIT-only)

profiles/wit.py

  • Added full VPP register map for WIT

  • Explicitly defines which registers are readable / writable

  • No changes to other inverter models


const.py

  • Added WIT-specific writable definitions:

    • vpp_control_authority (30100)

    • vpp_remote_power_enable (30407)

    • vpp_remote_power_control_value (30409, signed)

    • vpp_ac_charging_mode (30410)

  • Clear separation from SPH/SPF logic


number.py

  • Added support for signed 16-bit registers

  • Proper conversion:

    • HA value → unsigned Modbus (two’s complement)

    • Modbus → signed HA value

  • Enables stable number.growatt_remote_power_control_value


select.py

  • Removed WIT early-return

  • Allows WIT to generate select entities from writable registers

  • Makes AC charging and control authority configurable in UI


growatt_modbus.py

  • Ensures negative values are written correctly using:

    value & 0xFFFF
  • Prevents Modbus write failures for discharge control


Result

With these changes:

  • WIT inverters expose proper VPP / remote control entities

  • Charge and discharge work reliably using one number entity

  • AC charging mode is selectable and respected

  • CEW / EMS / external controllers work without hacks

  • No impact on non-WIT models

This implementation has been tested in real operation with:

  • Home Assistant

  • Growatt WIT 6 HU

  • Cheapest Energy Windows (CEW)

  • Grid charging + price-based discharge


Design choice

This is intentionally provided as a WIT-only solution, to:

  • avoid regressions in other models

  • make review and upstreaming easier

  • reflect actual hardware differences

It can later be merged upstream either:

  • as a WIT-specific branch, or

  • behind a model capability flag


If you want, I can next:

  • condense this into a shorter PR description, or

  • adapt the wording exactly to 0xaha’s repository style.

growatt_modbus_wit_only_patch.zip

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions