Skip to content

feat: Add generic Home Assistant Inverter interface#207

Open
chriszero wants to merge 4 commits intoohAnd:developfrom
chriszero:feature/ha-inverter-control
Open

feat: Add generic Home Assistant Inverter interface#207
chriszero wants to merge 4 commits intoohAnd:developfrom
chriszero:feature/ha-inverter-control

Conversation

@chriszero
Copy link

Adds a new homeassistant inverter type that controls any inverter/battery system via Home Assistant service calls, making EOS Connect compatible with a much wider range of hardware.

Motivation

Many inverter/battery systems (Marstek, Sungrow, Goodwe, etc.) don't have a direct API but are controllable through Home Assistant entities — whether via
native HA integrations, ESPHome (e.g., RS485/Modbus), or other custom components. This interface bridges that gap by translating EOS optimization results into
HA service calls.

How it works

For each EOS state (charge_from_grid, avoid_discharge, discharge_allowed), the user defines a sequence of HA service calls in config.yaml. Each step specifies
a service, entity_id, and data or data_template (with {{ power }} for dynamic values from EOS).

Example use case: A Marstek battery connected via https://gist.github.com/chriszero/6940087c4fb3ef7552305602096f9d35 exposes select and number entities in
HA, which are then used by EOS Connect to switch operating modes and set charge/discharge limits.

Changes

  • src/interfaces/inverter_ha.py — New InverterHA class
  • src/eos_connect.py — Register homeassistant as inverter type
  • src/config.py — Add config keys (url, token, charge_from_grid, avoid_discharge, discharge_allowed)
  • docs/user-guide/configuration.html — Parameter reference, info box, Marstek config example, ESPHome Gist link
  • README.md — Mention HA inverter in features and config options

Tested since 26.12.2025 on my installation.

@stefanriegel
Copy link

awesome PR!

@ohAnd
Copy link
Owner

ohAnd commented Feb 7, 2026

thanks for contributing ... sounds great

in parallel there is a bigger change in the inverter interface to support easier different types of interfaces see PR #170 --- if we are done here and in dev - let's go directly this extension

maybe you want to have a look in advance and sync with the other PR to prepare for a faster merge later

- Add inverter_ha.py with HA inverter control via REST API
- Support power limiting and status monitoring through Home Assistant
- Update config.py with HA inverter configuration options
- Register HA inverter interface in eos_connect.py
Document the new `homeassistant` inverter type:
- configuration.html: parameters, info box, and Marstek config example
- README.md: mention in features and minimal config comment
   - Add BaseInverter-compatible attributes (address, is_authenticated, inverter_type)
   - Add supports_extended_monitoring_default class attribute
   - Return bool from _call_service, _execute_sequence, set_mode_* methods
   - Rename parameter: power -> charge_power_w (set_mode_force_charge)
   - Rename parameter: power -> max_pv_charge_rate (api_set_max_pv_charge_rate)
   - Add BaseInverter stub methods: initialize, authenticate, connect/disconnect_inverter,
     set_battery_mode, set_allow_grid_charging, get_battery_info, fetch_inverter_data
   - Add shutdown logging for consistency
   - Remove unused import time
@chriszero chriszero force-pushed the feature/ha-inverter-control branch from 0fc70df to ee73c0c Compare February 7, 2026 19:31
Cover initialization, _call_service, _execute_sequence, all mode setters, BaseInverter stubs, set_battery_mode dispatch, grid charging, and shutdown.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants