PV Optimization for GoodWe Solar Systems

Hello everyone! I would like to share set of blueprints for GoodWe PV system users. They should solve some of the most common scenarios in the world of photovoltaics in order to reduce costs of energy. Prerequisites are specified at each blueprint, sometimes you will probably need to define sensor in YAML configuration file but in this kind of situation, example configuration is available.

I would be really grateful for any feedback from you! My work is just in the beginning and I would like to improve it more.

:sunny: Home Assistant Blueprints for GoodWe Photovoltaic Systems

This repository contains a set of Home Assistant blueprints designed to automate and optimize residential photovoltaic systems equipped with GoodWe inverters. These automations focus on smart battery management, solar forecast adaptation and energy optimization tailored to users with solar and battery installations in order to reduce energy costs.


Prerequisites

GoodWe Inverter

The main prerequisite for use this set of blueprints is solar system within Goodwe inverter, baterry system and Home Assistant GoodWe Inverter integration available at GoodWe Inverter - Home Assistant which is native Home Assistant integration. Most of the blueprints assume experimental version of that integration available at GitHub - mletenay/home-assistant-goodwe-inverter: Experimental version of Home Assistant integration for Goodwe solar inverters as a HACS component. Details are mentioned in each blueprint documentation.

Input Season

The blueprints expect that the current season is set to know which scenarios are usable. To define this input select, you as a user can use code below and copy it to configuration.yaml file.

input_select:
  season:
    name: Season
    options:
      - Summer
      - Spring/Autumn
      - Winter
    icon: mdi:calendar

:battery: Auto Set DoD

Automatically adjusts the Depth of Discharge (DoD) of the battery based on today’s solar production forecast and your typical energy consumption. It ensures conservative discharge during low production periods (e.g., winter), while allowing deeper discharge during expected sunny days. Standard winter DoD value is set when SoC (state of charge) drops down to that value. The basic GoodWe Inverter integration is expected.

Entities

GoodWe DoD Entity

  • Target Depth of Discharge Entity available in GoodWe integration

PV Production Forecast

  • Sensor ensuring daily forecast of PV production
  • Available from HA integrations like Forecast.Solar which is recommended approach. Eventually you may have access to another service as Solcast etc.

Threshold for Changing DoD

  • Number specifiying the PV production prediction value that must be met to start automation (kWh)
  • If Prediction is bigger than this value, automation starts, checks other conditions and sets DoD to the new value

Battery Capacity

  • Input number defining Battery Capacity
  • It’s up on user which value is set
  • Available for example after defining in configuration.yaml file or you can have your own input number
input_number:
  battery_capacity:
    name: Battery Capacity
    icon: mdi:battery
    min: 0
    max: 30
    unit_of_measurement: kWh
    step: 0.1

Average Daily House Consumption

  • Sensor based on Final Daily House Consumption sensor which holds final value of consumption day before
  • Contains average daily house consumpiton in last 7 days
  • Available for example after defining in configuration.yaml file or you can have your own sensor
sensor:
  # statistics sensor for average daily house consumption in last week
  - platform: statistics
    unique_id: sensor.avg_daily_consumption
    name: Average Daily Consumption
    entity_id: sensor.final_daily_house_consumption
    state_characteristic: mean
    sampling_size: 7
    max_age:
      days: 7
template:
  # template sensor for checking final house consumption at the end of the day
  - trigger:
      - trigger: time
        at: "23:59:55"
    sensor:
      - name: "Final Daily House Consumption"
        state: >
          {% set value = states('sensor.daily_house_consumption') | float(default=0) %}
          {{ value*1 | round(1, default=0) }}
        unit_of_measurement: "kWh"

Winter DoD Value

  • Input number defining battery Depth of Discharge during winter time
  • It’s up on user which value is set
  • Available for example after defining in configuration.yaml file or you can have your own input number
input_number:
  winter_dod:
    name: Winter DoD Value
    icon: mdi:battery
    min: 0
    max: 100
    unit_of_measurement: "%"
    step: 1

GoodWe SoC Sensor

  • Sensor containing actual State of Charge of the battery
  • Available directly in GoodWe Inverter integration

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.


:repeat: Fully Charge Battery Once a Week

Ensures that the battery is fully charged at least once a week during winter, if it hasn’t been fully charged in the past 7 days. This can help preserve battery health and ensure readiness for colder periods. Triggered at a specific time and only if the production forecast and input season allow it. Experimental GoodWe Inverter integration is expected.

Entities

Time

  • Time of start battery charging

Count of 100% Battery State in a Week

  • Sensor which holds count of 100% battery charges in last 7 days based on history stats
  • Available for example after defining in configuration.yaml file or you can have your own sensor
sensor:
  - platform: history_stats
    name: Count of 100% Battery State in a Week
    entity_id: sensor.battery_state_of_charge
    state: 100
    type: count
    start: "{{ now().replace(hour=0, minute=0, second=0) - timedelta(days=7) }}"
    end: "{{ now() }}"

PV Production Forecast

  • Sensor ensuring daily forecast of PV production
  • Available from HA integrations like Forecast.Solar which is recommended approach. Eventually you may have access to another service as Solcast etc.

GoodWe Charging Power

  • Target entity describing power of charging in eco charge mode
  • Part of GoodWe Inverter integration

GoodWe Final SoC Entity

  • Target entity describing final value of battery charging (%)
  • Part of GoodWe Inverter integration

GoodWe Inverter Mode

  • Target entity describing mode of the inverter
  • Part of GoodWe Inverter integration

GoodWe Soc Sensor

  • Sensor containing actual State of Charge of the battery
  • Available directly in GoodWe Inverter integration

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.


:x: Disable Overflow

Disables electricity overflow when the spot price of electricity is negative (i.e., Export Limit is set to 0). Once the spot price becomes positive again, it restores the Export Limit to its original value. The basic GoodWe Inverter integration is expected.

Entities

Energy Spot Price

  • Actual energy spot price
  • Data available from national electricity markets, often also as HA integrations (Nordpool, EPEX, Czech Energy Spot Prices, 
)

GoodWe Export Limit

  • Target entity describing value of allowed export limit
  • Available directly in GoodWe Inverter integration

Export Limit Value

  • Numeric value of the original export limit (W) which is set when the price is positive again

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.


:moneybag: Eco Discharge When Low Price at Noon

Checks conditions at specified time (PV prediction, energy prices) and sets eco discharge mode in the morning (moves the overflows from the afternoon to the morning) by script, then sets general mode again when price is low enough (block of 3 consecutive hours is the cheapest) or if the time to full charge of battery is too long. Ideal in spring or autumn period when energy prices are different during the day. Experimental GoodWe Inverter integration is expected.

Entities

Time

  • Time when automation start - checks PV production prediction and spot prices for the day

PV Production Forecast

  • Sensor ensuring daily forecast of PV production
  • Available from HA integrations like Forecast.Solar which is recommended approach. Eventually you may have access to another service as Solcast etc.

Average Daily House Consumption

  • Sensor based on Final Daily House Consumption sensor which holds final value of consumption day before
  • Contains average daily house consumpiton in last 7 days
  • Available for example after defining in configuration.yaml file or you can have your own sensor
sensor:
  # statistics sensor for average daily house consumption in last week
  - platform: statistics
    unique_id: sensor.avg_daily_consumption
    name: Average Daily Consumption
    entity_id: sensor.final_daily_house_consumption
    state_characteristic: mean
    sampling_size: 7
    max_age:
      days: 7
template:
  # template sensor for checking final house consumption at the end of the day
  - trigger:
      - trigger: time
        at: "23:59:55"
    sensor:
      - name: "Final Daily House Consumption"
        state: >
          {% set value = states('sensor.daily_house_consumption') | float(default=0) %}
          {{ value*1 | round(1, default=0) }}
        unit_of_measurement: "kWh"

Average PV Power Last 20 Minutes

  • Average value of the PV generation during last 20 minutes
  • Available for example after defining in configuration.yaml file or you can have your own sensor
sensor:
  - platform: statistics
    unique_id: sensor.avg_power
    name: "Average PV Production In Last 20 Minutes"
    entity_id: sensor.pv_power
    state_characteristic: mean
    sampling_size: 240
    max_age:
      minutes: 20

Average House Consumption Last 20 Minutes

  • Average value of the house consumption during last 20 minutes
  • Available for example after defining in configuration.yaml file or you can have your own sensor
sensor:
  - platform: statistics
    unique_id: sensor.avg_consumption
    name: "Average Consumption In Last 20 Minutes"
    entity_id: sensor.house_consumption
    state_characteristic: mean
    sampling_size: 240
    max_age:
      minutes: 20

Energy Spot Prices for the Day

  • Dictionary with hourly prices of energy
    • Czech - current_spot_electricity_hour_order
    • Nordpool - the only Nordpool entity, default name is “nordpool_<energy_scale>_”
  • Available by one of the supported integrations (Czech Energy Spot Prices, Nordpool)

Actual Block of 3 Hours Energy Price Is Cheapest

  • Binary sensor defining the cheapest 3 hours block of energy prices
  • Czech Energy Spot Prices - contains directly entity of that type
  • Nordpool - You have to manually config sensor of that type in configuration.yaml file

Battery Capacity

  • Input number defining Battery Capacity
  • It’s up on user which value is set
  • Available for example after defining in configuration.yaml file or you can have your own input number
input_number:
  battery_capacity:
    name: Battery Capacity
    icon: mdi:battery
    min: 0
    max: 30
    unit_of_measurement: kWh
    step: 0.1

GoodWe Discharging Power

  • Target entity describing power of discharging in eco discharge mode
  • Part of GoodWe Inverter integration

GoodWe Inverter Mode

  • Target entity describing mode of the inverter
  • Part of GoodWe Inverter integration

GoodWe Soc Sensor

  • Sensor containing actual State of Charge of the battery
  • Available directly in GoodWe Inverter integration

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.


:zap: Turn Off Eco Discharge Mode When Peak

This automation turns off the inverter’s eco discharge mode when consumption exceeds production. It helps in preventing excessive battery discharge when energy consumption is higher than the available solar production.
Experimental GoodWe Inverter integration is expected.

Entities

House Consumption

  • Sensor of actual house consumption
  • Available directly in GoodWe Inverter integration

PV Power

  • Sensor of actual PV generation
  • Available directly in GoodWe Inverter integration

GoodWe Inverter Mode

  • Target entity describing mode of the inverter
  • Part of GoodWe Inverter integration

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.


:package: Usage

  1. Click the “Import Blueprint” button under any blueprint.
  2. The button will open your Home Assistant UI and pre-load the blueprint import screen.
  3. Customize entities and parameters as needed in your automation editor.

4 Likes

For the Disable Overflow, I love the idea, but I don’t see Export limit in W in my integration, I only have the % one (currently set to 4% by the guy who installed the system), with 200% being the maximum, but even at 200% it still exports to the grid.

Thanks for your note! I didn’t notice there is more possibilities in GoodWe integration how Export Limit is defined. It depends on family/model of the inverter. From which family is your GoodWe inverter from?

I’ll try to add possibility of using percentage Export Limit number very soon.

Hello again! If you’re interested, I added also Export Limit in % to the Disable Overflow blueprint. Don’t get confused, in README at Github the description of the blueprint is updated but here at the community forum I can’t change the description at the moment. Can’t wait for your notes and experience!

Hi, I do use official integration. What will happen if I switch to experimental integration? And how do I change?

Hi! With experimental version you’ll get new work modes, entities and extended functionality. Details are mentioned at it’s Github repo. If you switch to the experimental, all data and settings should not change, you just get new features. The first step for migration is installation HA Community Store to your system (you just find HACS in available integrations). After its installation you should find GoodWe experimental integration in HACS environment where you can add it to your HA.

1 Like

well documented and very good blueprints. Just got a goodwe inverter with a 79kwh polestar car battery so this will suite me well. thanks a lot!

1 Like

Hi Jenda / Great BluePrints Team,

I’d like to suggest a blueprint concept based on a scenario we encounter regularly in the European energy market, which I believe could be useful for many users.

Scenario:

In Europe, electricity prices can occasionally go negative, meaning consumers are paid to use electricity, while exporting energy to the grid incurs a cost.

In these events, I want to optimize my system operation based on three core goals:


Objectives:

  1. Stop discharging the battery
  • During negative pricing periods, discharging the battery leads to financial loss.
  • Battery output must be zero.
  1. Charge the battery from the grid (only)
  • Take advantage of negative pricing to charge the battery.
  • Prevent any simultaneous discharging.
  1. Cap total grid import at a specified limit (e.g., 4000 kW)
  • Our grid contract allows up to 4000 kW of import.
  • Any demand above 4000 kW must be covered by the battery.
  • Grid import must be capped at the contractual limit.

Desired Control Logic:

  • If electricity price < 0 €/MWh:
    • Set battery discharge power = 0
    • Enable battery charging from grid (subject to SOC and limits)
    • Set maximum allowed grid import = 4000 kW
    • If total site demand > 4000 kW, use battery to cover the excess
  • If electricity price ≄ 0 €/MWh:
    • Return to standard operation or existing automation rules

Key Constraints:

  • No energy should be exported to the grid
  • Battery should not discharge unless grid import hits the 4000 kW cap
  • System should dynamically switch modes based on real-time pricing
  • Must respect the contractual import limit strictly to avoid surcharges

Would it be possible to create a blueprint that automates this logic or integrates it into an existing energy management system (Home Assistant)?

Thanks for your great work — and looking forward to your insights!

3 Likes

Hi! Thank you a lot for your idea. This scenario would be definitely very useful and I really hope it is possible to create blueprint like this. I’ll try to add this kind of blueprint to my set and I let you know when the result will be done!

1 Like

Thanks for template.

I cannot get template " Turn Off Eco Discharge Mode When Peak" to work. My goal is to not drain battery when changing my EV.
When template trigger.
"Stopped because a condition failed "

What I can see so is Inverter in “General mode”. Wrong mode?

I had problems setting up sensor.avg_daily_consumption and final_daily_house_consumption. This is how I think I solved it:

  1. Created helper, type number
name: Final Daily House Consumption
Minimum value: 0
Maximum value: 100000
icon: mdi:counter
  1. Created helper, type Template Sensor
name: Final Daily House Consumption
state template: {{ states('input_number.final_daily_house_consumption') }}
Unit of Measurement: kWh
  1. Created automation:
alias: Set Final Daily House Consumption
description: Updates the final_daily_house_consumption helper at 11:59:55 PM
triggers:
  - at: "23:59:55"
    trigger: time
actions:
  - target:
      entity_id: number.final_daily_house_consumption
    data:
      value: "{{ states('sensor.daily_house_consumption') | float(0) }}"
    action: number.set_value
mode: single
  1. Created helper type Statistics
Name: Average House Daily Consumption
Entity: sensor.final_daily_house_consumption
Statistic Characteristic: Mean
Sampling size: 7
Percentile: 50
Precision: 1

Why it is so complicated? When I pasted your original code for avg_daily_consumption and Final Daily House Consumption into configuration.yaml, there were no errors displayed, but they were also not created, even after full restart. I discarded the code and started working from scratch.

Helper type number is no sensor, it does not read another sensor on it’s own. That’s why automation will put in data once a day before midnight.

But I can’t read input_number in statistics, which is a reason why template sensor with same name final_daily_house_consumption exists, and it takes it’s value from input_number.

Now I can create the helper type statistic, that will average last 7 daily house consumptions.

I am sure there are easier and smarter ways to do this, blame my “HA noob” status. I hope this helps others. Comments and corrections welcome, I need to learn :slight_smile:

Hi Jenda,
Thanks for all the work, now when I try to add the blueprint to my HA, I get an error ‘invalid parameters given’ - neither can I get the yaml’s from your GitHub. Thanks in advance and maybe I’m just not looking in the right spot?

thanks!