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

Hi Henrik,

I have a more less dumb system: Old grid-tie Inverters without any connectivity. I measure these with tasmota or ESPhome-devices.
No batteries for now (just a charger for a E-scooter).

I have:
-real time (more/less) values for the total production of all 4 inverters (solar+wind)
-real time measurement at the main fuse box with Shelly 3em (ingoing / outgoing / power-flow)
-calculated value for the consumption
-one (later more) dynamic current appliances (dumploads)

Is this all I need to get your system to work?
Any plans to integrate solar forecasts?

My goal is to have almost no grid infeed.

Yes, that should be all you need.

  • The combined total production will be the PV Power sensor
  • the calculated consumption value (assuming this is the combined power of all loads) will be the Load Power sensor
  • Since you have no home battery, you don’t need to provide a sensor in the “home battery level” field
  • If you can measure the power exported to the electrical grid outside your house, that will be the Export Power sensor. If you do not measure that, you can provide a helper sensor here which is always 0. In future versions I will make the export power input optional so that you don’t have to provide a sensor here if you cannot measure your export power.

At the moment I do not plan to integrate solar forecasts since I don’t know what the benefit of that would be compared to “real-time” control of appliances based on current excess power. The forecast would be a lot more inaccurate compared to the actual PV power.
However if you have an idea for which circumstances solar forecasts would make sense, let me know and I will think about it.

Hi Henrik,

When i tried to import the adress of the github repository, HA told me it’s a unsupported URL.

Is it normal ?


Yes, you need to manually copy the files according to instructions above, since this is a combination of blueprint and pyscript.


Well done thanks for your job !!!

But i’ve got a question: are you able to offer the choice of type of management of load ?

i’ve got a dimmer to manage my water boiler, not a dynamic current.

It this case, your blueprint will be the “couteau suisse” of solar excess management, and maybe the only one know at this moment !!!


@TheSmurf here’s the answer to your questions:

  1. In the Prerequisites you say I need the " *Load Power" Value from my inverter. What is this?
    (I dont have got a battery)
  1. “Supports dynamic current control (e.g. for wallboxes)” means I can say if I have PV excess of 1000W - load my car with 1000W? If I have 3600W - load my car with 3600W and if its more start the other devices? Is it possible here to set a delay? So the walbox doesnt turn on and off all the time if its cloudy?
  1. Are you still working on this project and interested in bugs and/or feature requests?
  1. See the blueprint for an explanation. The Load Power is the combined power of all your electrical loads. If you do not have a hybrid inverter with battery, you need to get this value somewhere else at the moment.
    But you need to pay attention that you really only do pass the Load Power, which is positive at all times. You could calculate this value based on your household energy meter measurement and the current solar production.
    I will think about how I can implement something in the near future so that you may only need to pass the PV Power and the household energy meter reading, in case you do not have a hybrid inverter.

  2. Yes, exactly. A delay is not needed because of the “appliance switch interval”, which is used as averaging interval. Consider e.g. an averaging interval of 10 minutes. If it gets cloudy, the appliance will not turn off immediately. It will turn off / regulate the current down if the average power excess within the last 10 minutes is approx. zero. Long story short, you can modify the inertia of an appliance by modifying the “appliance switch interval”

  3. Yes, this is a very new project of mine which is actively developed. Therefore I am very interested in bug reports & feature requests.

At the moment, the script does not support dimmers, which can be set from 0-100%. However, that is something which I could implement in the near future. What entity type is a dimmer in Home Assistant? And how is the Home Assistant service called, with which the value of the dimmer can be set?

1 Like

hi @InventoCasa
This looks really great! i just installed it and will be testing tomorrow morning as soon as the sun is up!

Some feature request:

  1. is there a way to have an override: thinking of a tesla, I would need a way to have the car charge to a given state even without excess power (for instance if I want to go on a trip the next day). Maybe using a toggle switch that can either be on a lovelace dashboard or even a physical button.

  2. minimum charge / minimum value: two use cases here: a) I have a pool heat pump - I would like to be able to set a ‘minimum pool temperature’ that will be kept regardless of solar power, and a ‘nice to have’ pool temperature that would be reached using excess power only. b) minimum state of charge (SOC) of the Tesla regardless of solar, to be charged during off peak hours

Maybe some of the above our out oft he scope of your idea, or maybe there is a way to do this with anther automation, but just thought I would throw it in there.

Happy to help in any way I can.

Many coffees headed your way as soon!

1 Like

Hi @InventoCasa

I am getting the following error in the logs, and the automation is not working:

Could not get state from entity automation.excess_solar:_tesla: name 'automation.excess_solar:_tesla' is not defined

the logbook show this:
file_pv_excess_control_on_time has been triggered by time 2023-04-03T10:57:00

any ideas?

Hi @aziwa , it looks like you have some not allowed characters in your automation name “:”
Can you try to name the automation e.g. “Excess Solar Tesla” instead? (and set the automation ID config field in the blueprint to the same name of course)

It seems the “:” is causing problems.

I think the first request can be fulfilled by temporarily disabling the automation. Such a button (to enable/disable automations) can be added to a lovelace dashboard.

For the second request, I guess it could be a valid feature idea to let the user pass a specific numerical home assistant sensor, and define what level must be reached regardless of available solar power through the day. However that is something which is not that easy to generalize for all use cases. I will take that feature request with me and think about how that could be implemented without complicating the blueprint for other use cases.

sounds great! I like the idea of disabling the automation, will try that.
Would be great to have the minimum amount. let me know if I can help in any way

Thanks for the help about the “:” causing issue. i re-created the automation (just renaming didnt seen to fix it). Will know if tomorrow it works!

Coffee incoming! :slight_smile:

Thanks for the coffee(s)!

After renaming (or changing some other parameters of the automation) you need to manually execute the automation once. This will send the changed config parameters to the python script.

If you don’t see anymore errors in the log like before, that is a good sign. Instead you should see every minute between 6:00 and 23:00 (if you configured the debug log level for the pyscript module) some debug logs about the excess power history, and if your appliance is able to turn on or not.

Great Blueprint thanks! just trying to get it working now.

One thing it needs is the ability to take into consideration is a Solar Export limit, to be able to turn the extra loads on only after a set export threshold is reached, and turn them off if your exporting less than the threshold.

In Australia single phase solar systems are often export limited to 5kW and three phase systems to 15kW and some unlucky people have a lower limit. to automate loads during this time would maximise solar generation and export as well.

@Thomas_Brady Thanks for the input!
However I’m not sure I can see the benefit here of implementing the consideration of a solar export limit, since using up the excess power by yourself is more cost-efficient than exporting it to the grid - at least here in germany, where you get only ~0.08€ per exported kWh, while you pay at least ~0.35€ per imported kWh.

How is it for you, do you get more money per exported kWh than pay per imported kWh?

1 Like

Hi Henrik,

entity type is light, dimmerized

templating allow to calculate the value of the dimmer must be set, according of the load dimmerized.


Feature Upgrade / Improvement for standard inverters

To everybody which has a standard inverter without battery and thus no access to the different separate sensors (e.g. load power and export power): I have great news for you!

I took some time today to implement an improvement which makes it easier for you to use this blueprint:

  • Implemented handling of a combined import/export power sensor

→ If you do not have access to sensors for load power and export power, you can now just pass PV power and combined import/export power, with import being a positive and export being a negative value.


  • If you have a hybrid inverter with battery, you still should pass the separate sensors. Otherwise your home battery will always get prioritized over appliances, regardless of the specified minimum home battery level.

  • I did also implement a little fix which improves the handling of dynamic current appliances like wallboxes greatly on days with varying cloudiness, so it’s worth to update to the newest version even if you have a hybrid inverter.

Thanks @InventoCasa

to update do we just need to replace pv_excess_control.py and pv_excess_control.yaml with the new versions from github?

I guess then manually execute the automations?

@aziwa yes, correct. The complete procedure should look like this:

  • Replace both files
  • Reload automations (to reload changed things in the blueprint) or simply restart / soft restart home assistant
  • Manually execute your PV excess automations once. Make sure to also check if some things in the blueprint changed because of the update. (Should not be the case normally)
1 Like

This looks interesting. I built something similar, but will try if this is better.
One question though…does your Blueprint work solely on current excess, or does it also work with Solar Forecast? I use Solcast prediction for some of my automations in HA and have had very good experience with it