Skip to content

Enhance Huawei Solar config#4037

Open
JohanAlvedal wants to merge 3 commits into
springfall2008:mainfrom
JohanAlvedal:main
Open

Enhance Huawei Solar config#4037
JohanAlvedal wants to merge 3 commits into
springfall2008:mainfrom
JohanAlvedal:main

Conversation

@JohanAlvedal

Copy link
Copy Markdown

Huawei inverter setup with Predbat

This is a beta example configuration for using Predbat with a Huawei inverter and Huawei LUNA battery through the Home Assistant Huawei Solar integration.

It is intended as a practical starting point, not a finished universal configuration.

At the moment, this setup does not require any external Home Assistant automation for the basic Predbat charge, discharge, freeze or hold control. Predbat controls the Huawei inverter directly through the configured Huawei Solar service calls and charge/discharge power limit entities.

Beta note

This setup works in my own installation, but it is still a beta example. It has not yet been fully reviewed or tested across different Huawei inverter, battery and Home Assistant setups, and not all scenarios, edge cases or operating modes have been tested yet.

Check all entity names, sign conventions, inverter limits, service calls and safety settings before using it.

Included in this example

This example includes configuration for:

  • Huawei inverter support with inverter_type: "HU"
  • Huawei battery SOC and power sensors
  • PV, grid and house load sensors
  • Charge and discharge rate control
  • Huawei forcible charge/discharge services
  • Predbat freeze/hold support
  • Direct Predbat control without external Home Assistant automations for basic battery control
  • Open-Meteo PV forecast
  • Nordpool-based import/export price sensors
  • Optional EV charging support
  • Optional Huawei LUNA battery charge/discharge curves

Secrets required

Local values should be stored in secrets.yaml, not directly in apps.yaml.

Example:

predbat_huawei_device_id: "YOUR_HUAWEI_DEVICE_ID_HERE"

predbat_home_latitude: YOUR_LATITUDE
predbat_home_longitude: YOUR_LONGITUDE

Do not commit your real secrets.yaml to a public repository.

Huawei inverter operating mode

Before using Predbat, the Huawei inverter should normally be set to:

Maximum self-consumption / Maximise self-consumption

Predbat can then temporarily override charging, discharging, freeze and hold behaviour through Huawei Solar service calls and charge/discharge power limits.

Avoid using fixed time-of-use schedules in the Huawei app at the same time, unless you know exactly how they interact with Predbat.

Important sensor conventions

This example assumes:

  • Battery power is positive when charging
  • Battery power is negative when discharging
  • Grid power is positive when importing
  • Grid power is negative when exporting

If your sensors use the opposite direction, adjust the relevant Predbat _invert settings.

Open-Meteo PV forecast

The example uses Open-Meteo for PV forecasting:

open_meteo_forecast:
  - latitude: !secret predbat_home_latitude
    longitude: !secret predbat_home_longitude
    kwp: 9.5
    declination: 18
    azimuth: 47

Adjust kwp, declination and azimuth to match your own PV system.

The azimuth follows the normal Predbat convention:

  • 0 = North
  • -90 = East
  • 90 = West
  • -180 or 180 = South

Notes

Adapt this example to your own Home Assistant entity names, battery size, inverter limits, price sensors and PV installation.

Use it carefully until it has been tested across more Huawei setups.

## Huawei inverter setup with Predbat

This is a beta example configuration for using Predbat with a Huawei inverter and Huawei LUNA battery through the Home Assistant Huawei Solar integration.

It is intended as a practical starting point, not a finished universal configuration.

At the moment, this setup does not require any external Home Assistant automation for the basic Predbat charge, discharge, freeze or hold control. Predbat controls the Huawei inverter directly through the configured Huawei Solar service calls and charge/discharge power limit entities.

> **Beta note**
>
> This setup works in my own installation, but it has not yet been fully reviewed or tested across different Huawei inverter, battery and Home Assistant setups.
>
> Check all entity names, sign conventions, inverter limits, service calls and safety settings before using it.

## Included in this example

This example includes configuration for:

* Huawei inverter support with `inverter_type: "HU"`
* Huawei battery SOC and power sensors
* PV, grid and house load sensors
* Charge and discharge rate control
* Huawei forcible charge/discharge services
* Predbat freeze/hold support
* Direct Predbat control without external Home Assistant automations for basic battery control
* Open-Meteo PV forecast
* Nordpool-based import/export price sensors
* Optional EV charging support
* Optional Huawei LUNA battery charge/discharge curves

## Secrets required

Local values should be stored in `secrets.yaml`, not directly in `apps.yaml`.

Example:

```yaml
predbat_huawei_device_id: "YOUR_HUAWEI_DEVICE_ID_HERE"

predbat_home_latitude: YOUR_LATITUDE
predbat_home_longitude: YOUR_LONGITUDE
```

Do not commit your real `secrets.yaml` to a public repository.

## Huawei inverter operating mode

Before using Predbat, the Huawei inverter should normally be set to:

**Maximum self-consumption / Maximise self-consumption**

Predbat can then temporarily override charging, discharging, freeze and hold behaviour through Huawei Solar service calls and charge/discharge power limits.

Avoid using fixed time-of-use schedules in the Huawei app at the same time, unless you know exactly how they interact with Predbat.

## Important sensor conventions

This example assumes:

* Battery power is positive when charging
* Battery power is negative when discharging
* Grid power is positive when importing
* Grid power is negative when exporting

If your sensors use the opposite direction, adjust the relevant Predbat `_invert` settings.

## Open-Meteo PV forecast

The example uses Open-Meteo for PV forecasting:

```yaml
open_meteo_forecast:
  - latitude: !secret predbat_home_latitude
    longitude: !secret predbat_home_longitude
    kwp: 9.5
    declination: 18
    azimuth: 47
```

Adjust `kwp`, `declination` and `azimuth` to match your own PV system.

The azimuth follows the normal Predbat convention:

* `0` = North
* `-90` = East
* `90` = West
* `-180` or `180` = South

## Notes

Adapt this example to your own Home Assistant entity names, battery size, inverter limits, price sensors and PV installation.

Use it carefully until it has been tested across more Huawei setups.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 741d7ea61c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread templates/huawei.yaml
Comment on lines +34 to +35
prefix: predbat
timezone: Europe/Stockholm

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore the template safety flag

Because this is still a file under templates/, removing template: True means a user who copies the Huawei example into apps.yaml no longer hits Predbat's built-in template guard (update_pred exits when that arg is set). In that scenario Predbat can start planning and calling the Huawei services in this file before the user has finished replacing the hard-coded sensors, limits, and device secrets, which is exactly what the other inverter templates and install docs rely on the flag to prevent.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread templates/huawei.yaml Outdated
Comment on lines +281 to +282
notify_devices:
- mobile_app_iphone13pro

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Comment out the personal notify target

With this uncommented, every user who copies the template inherits notify/mobile_app_iphone13pro because call_notify prefixes each notify_devices entry with notify/. Unless their Home Assistant instance has that exact mobile app notify service, Predbat notifications will call a non-existent service; the previous template left this example commented so users either got the default notify service or opted into their own device.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Polish Huawei Predbat example
Restore template: True in the Huawei Predbat template so users do not accidentally run the example configuration before replacing sensors, limits and secrets.
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.

1 participant