PV / Solar Excess Optimizer: Auto-control appliances (wallbox, dish washer, heatpump, ...) based on excess solar power

Hello, I currently control my dishwasher via SMA Sunny Portal. Unfortunately it doesn’t work reliably. The dishwasher is switched on and off via a shelly. If I start the dishwasher program and consumption is >5W, SMA switches the shelly off and waits until there is a PV surplus. Then shelly is switched on and the program runs for an hour without interruption. The dishwasher should run between 6am and 12am with a maximum PV surplus. Outside of this time the program should run immediately when started. I can’t find any settings in the blueprint for the period when the device should start depending on the solar.forecast. At what watts a program was started. Program runtime during which the device should run without interruption and at the latest when the device should be switched on so that the program ends by 12pm. I’m wondering if I can control this with the blueprint too?

Hi, I have a fresh new (and my first :slight_smile: ) installation of HA version 2024.12.3.
On startup, I get following warning in logs:

Logger: homeassistant.core
Source: helpers/deprecation.py:222
First occurred: 12:42:03 PM (1 occurrences)
Last logged: 12:42:03 PM

Config was used from pyscript, this is a deprecated alias which will be removed in HA Core 2025.11. Use homeassistant.core_config.Config instead, please report it to the author of the ‘pyscript’ custom integration

Can you please give me instructions how to solve it? Or do the script/blueprint need to be modified?
(The script itself is working fine, I just wan to be sure it will survive year 2025). Thank you.

Pyscript is a third party integration and so not covered by the WTH month so I will be closing this but before I do you will be happy to know that this has been reported to the integration developer and a fix is on the way: Deprecation WARNING message in HA Log · Issue #657 · custom-components/pyscript · GitHub look out for a future pyscript update to solve this.

1 Like

First of all… thanks for this app… if I get it up and running this would be a game changer for me!

I’ve been trying to get this working for a few days now, but it just doesn’t seem to cooperate :frowning:

I’m using a GoodWe inverter combined with a HomeWizzard P1 meter (connected to the digital electricity meter). From both, I’m able to receive various data points in my Home Assistant (HA).

For PV power, I’m using the field PV Power from my GoodWe inverter, which provides the current generation output in watts from my solar panels.

Load is represented by the field Load, also in watts, which I receive from my inverter.

For Combined Import/Export Power, I believe this corresponds to P1 Meter Power from HomeWizzard, expressed in watts. This field gives the combined value of the three phases (negative if I’m sending power to the grid, positive if I’m drawing power from it).

The only thing missing is Export Power, showing only the power I’m exporting.

To address this, I created a new entity in Home Assistant using my P1 Meter Power from HomeWizzard with the following template:

template:
  - sensor:
      - name: "Export Power"
        unique_id: "export_power"
        state: >
          {% set power = states('sensor.p1_meter_active_power') | float(0) %}
          {{ -power if power < 0 else 0 }}
        unit_of_measurement: "W"

This template sets the value to 0 when I’m drawing power from the grid (indicating power usage) and makes the value positive when I’m sending excess power to the grid. This way, I have a positive watt value for the power I’m exporting.

However, it’s not working as intended, and my device (currently, just the test lamp above my desk) is not switching on.

Here is the automation I’ve set up:

alias: Heat Pump - Excess Power
description: >-
  If there is excess power for more than 5 minutes, the boiler will be heated
  5 degrees warmer electrically.
use_blueprint:
  path: pv_excess_control.yaml
  input:
    automation_id: wp_PowerExcessV0.1
    pv_power: sensor.pv_power
    export_power: sensor.export_power
    load_power: sensor.load
    import_export_power: sensor.p1_meter_active_power
    appliance_switch: light.bureau
    appliance_switch_interval: 1
    min_home_battery_level: 0
    appliance_priority: 1000
    grid_voltage: 240

So, what am I doing wrong?


Let me know if there’s anything specific you’d like clarified further.
Thanks!!!

IIRC if you have the “import/export power” then the “export power” should be left blank, and if you don’t have a battery the “load power” should be blank too. That’s how mine is set up.

1 Like

You were right about the export/import vs. export and load, but the problem still persists—it’s not working.

I should have it set up so that if export exceeds consumption by more than 1 minute (meaning export/import is negative), the light above my desk should turn on… but after more than half an hour, I’m still sitting in the dark. :frowning:

Any ideas on what might be going wrong?

data:
  automation_id: Heat Pump - Excess Power
  appliance_priority: 1
  export_power: null
  pv_power: sensor.pv_power
  load_power: null
  home_battery_level: null
  min_home_battery_level: 100
  dynamic_current_appliance: false
  appliance_phases: 1
  min_current: 6
  max_current: 16
  appliance_switch: light.11_verlichting_bureau_midden
  appliance_switch_interval: 1
  appliance_current_set_entity: null
  actual_power: null
  defined_current: 6
  appliance_on_only: false
  grid_voltage: 240
  import_export_power: sensor.p1_meter_active_power
  home_battery_capacity: 0
  solar_production_forecast: null
  appliance_once_only: false
action: pyscript.pv_excess_control

Hey @InventoCasa , I have this automation which I’d like to use for triggering a switch entity whenever the production of PV panels ( or the export to grid ) is exceeding 2500W. It never triggers as it is now. Do you see anything problematic here? I have no batteries in my setup, just a hybrid inverter ( 3 phases if it matters ).

mode: single
triggers:
  - platform: homeassistant
    event: start
actions:
  - data:
      automation_id: automation.inventocasa_pv_excess_optimizer
      appliance_priority: 1
      export_power: sensor.sun8k_out_of_grid_total_power
      pv_power: sensor.pv_power
      load_power: sensor.sun8k_load_totalpower
      home_battery_level: null
      min_home_battery_level: 100
      dynamic_current_appliance: false
      appliance_phases: 1
      min_current: 10
      max_current: 16
      appliance_switch: switch.pow_elite_20a
      appliance_switch_interval: 3
      appliance_current_set_entity: null
      actual_power: sensor.pow_elite_20a_power
      defined_current: 10
      appliance_on_only: false
      grid_voltage: 230
      import_export_power: null
      home_battery_capacity: 0
      solar_production_forecast: null
      appliance_once_only: false
    action: pyscript.pv_excess_control
id: '1737548785728'
alias: INVENTOCASA - PV Excess Optimizer
description: ''

Dear PV Excess-Team, I did setup the blueprints and the Switch ON process is working fine. But the Automation Template does not turn off my appliances.

I did set up the Minimum Home battery level to 95% and my understanding is that if the value of the Battery is lower than 95% (for some time) the automation does switch Off the appliances. (not all at same time but something like 10 to 20 minutes)

Is my understanding correct?

Another assumption is that my appliances does not have a current power consumption cause i only switch them with a relay, is this field mandatory so that the automation works properly?

Note: I did not find what are the triggers for turn off, maybe i missed that in the documentation and someone can give me a hint.

Hi, if you know the power of your device you could use the integration Battery Notes. It creates a fixed or dynamical power sensor.

So you can use it for PVExcess…

Edit: the trigger is no excess.

Thanks for the hint.
But before i start using another Integration i want to understand how this blueprint is working.

The trigger is no excess in consideration of what situation?
E.g.
PV Power Excess 9kW
Appliance consumption 9kW
Battery Level lower 90%
Battery starts loading with 5kW
Consumption still 9kW
PV Excess equals 4kW
Device should turn off after e.g. 2 Minutes

Are there some more explanations how the logic is working? Or best practice?