Enough solar energy later to charge battery?

Has anybody gone down this path before me? I’d love to learn from your experience if you would share it.

I have solar panels and a battery. I’m happily working on making best use of Octopus Agile pricing.

The issue that is troubling me is this. I don’t want to charge the battery now, even if the Agile price is cheap, if there will be sufficient (free) solar energy a bit later to fully charge the battery.

What’s the wisdom in the community?

Sounds as if you want to calculate the probability of the sun shining - if so you might have a look at the Bayesian integration.

There’s a lot to get your head round, but there’s an excellent howto here, complete with an interactive spreadsheet to do the maths for you.

The Solcast integration gives you a projected remaining solar which changes through the day. I use that …

Or use Forecast.Solar, integrated in HA.

I’ve been looking at both Solcast and Forecast.Solar. How reliable are their forecasts? I’ve looked at tomorrow’s forecast and remaining energy today for both of them.

It’s not clear to me how to use these data to reliably determine that I don’t need to buy cheap power from the grid now 'coz the sun will fill my battery later. Do you mind if I ask if you are doing this?

A simple approach would be to test the forecast data in some way to decide if today is going to be good/bad for solar energy. If it’s going to be good don’t buy even cheap Agile power?

Another approach would be to compare energy required to fill battery with remaining energy today when cheap Agile power becomes available. If there’s sufficient remaining energy today, decline the opportunity to buy cheap Agile power or, otherwise, buy cheap Agile power until the test criteria is passed.

What do you think?

Haven’t discounted your suggestion. I’m going to have read and re-read the docs and think about how it might work. Any further wisdom will always be well received.

Forecasts are what they are, forecasts. They will never be perfect.

I’d suggest you just start going, create something and test it. And when the result is not good, try to make it better.
You can start with the software, without actually including the battery-control. And check the results. And then improve.
When you have something you think works, add the battery-control. And then keep testing-checking-improving.

That’s how others are doing it. Believe me, this process is the most fun :slight_smile:
Just copying something that works is much less fun.

1 Like

Figuring it out is the best part of it. I had my solar panels and battery installed in January. Just now nearly 8 months later I am happy with my setup.
I am using average forecast based on Solcast and Forecast.Solar -20%. That gives me a conservative figure that in 99% of all days is achievable. Then I have a couple of SQL sensors looking at my past energy usage and that data is used by another sensor to decide if and how much energy should be exported in the evening and how much energy should be imported from the grid overnight.
But if you are looking for a ready solution and if you happen to use certain make of inverter and battery take a look at GitHub - springfall2008/batpred: Home battery prediction and charging automation for Home Assistant with GivTCP

Have a look at the EMHASS add-on: An energy management optimization add-on for Home Assistant OS and supervised

It works great in a dynamic pricing/ solar production environment.

Here is are charts for today, battery charging/ discharging is the green shade, grid is the red shade:

Even though the price is extremely low currently (3¢/ kWh), it sees what my future household load as well as solar production figures are and then calculated the minimum I need to charge from the grid.

You can see the detailed calculations here:

It only needs to import 7.1 kWh from the grid to fill my (43 kWh) battery. As a bonus it also calculated the optimal is to export to the grid tonight 37 kWh, when the feed in price shoots up over $10/ kWh for a credit of over $200.

Update: the EV had just come home and plugged in so the optimisation schedule has updated and it is now charging from the grid at the cheap prices. The optimisation is recalculated every minute.

1 Like

I have looked at EMHASS in order to manage my battery charge/discharge depend on Nordpool energy price, battery charge level and predicted solar production. Unfortunetelly I havnt get any affect on my system. Can you please post here your setting for EMHASS. And what cards have you used for EMHASS?

Have you installed the EMHASS add on package.

There is a lot of help available here:
EMHASS add-on: An energy management optimization add-on for Home Assistant OS and supervised

Yes, a I have installed EMHASS and this is the log:

web_server WARNING def_start_timestep / list_start_timesteps_of_each_deferrable_load does not match number in num_def_loads, adding default values to parameter
web_server WARNING def_end_timestep / list_end_timesteps_of_each_deferrable_load does not match number in num_def_loads, adding default values to parameter
web_server WARNING set_def_constant / list_set_deferrable_load_single_constant does not match number in num_def_loads, adding default values to parameter
web_server WARNING treat_def_as_semi_cont / list_treat_deferrable_load_as_semi_cont does not match number in num_def_loads, adding default values to parameter
2024-03-20 08:42:05,200 - web_server - INFO - Launching the emhass webserver at:
2024-03-20 08:42:05,201 - web_server - INFO - Home Assistant data fetch will be performed using url: http://supervisor/core/api
2024-03-20 08:42:05,201 - web_server - INFO - The data path is: /data
2024-03-20 08:42:05,206 - web_server - INFO - Using core emhass version: 0.8.4
waitress INFO Serving on

My invereter is Solax with battery.