Automating when to charge from grid

10 comments started 2022-05-05 last 2022-05-07
Home Automation
R
#1 RupertOH

I've recently got my GivEnergy system installed and am a happy user. Now I want to supercharge my system by having a bit finer grain control of the battery.
I want to be able to leverage the Octopus Agile rates but in a fully automated way.
So based on

  • Price of energy at point over night
  • Existing battery charge level
  • Expected Solar for the following day

So if my battery is under 10% and tomorrow's forecast is good and price drops under 25p, charge to 20% (or as much as possible in 30 mins)
If however, forecast is bad, charge to 50% at cheap rates under 30p...

I'm sort of expecting to have to write my own program to do this and I think I will be able to use this to accept the variables and craft some API calls, but I can't be the first to want to do this, and I'm keen to learn from my more experienced Solar friends!

Am I overthinking this? Is there a simpler way to achieve this? When I look at the GUI It seems that I can only set to charge for 30 mins at this time, but its all manual and would need to be set by me each day... That is not acceptable for the longer term. Any advice or experiences of how you handle this would be warmly appreciated!

L
#2 locked

as a starting point you might like to take a look at https://github.com/lockedj/solarbatteryoptimize does similar to what you are looking for, automating how much to charge over night based on predicated sun / clouds the following day. The readme provides more info...

R
#3 RupertOH

locked Wow! That looks exactly like what I'm trying to do, or gives me a great starting point. Thanks so much for sharing!

S
#4 stevelewis

locked Building on some of your good ideas, I've developed a routine to pull the latest day's consumption from the GE website and use this in the forecasting in place of the dummy hourly load. Happy to share!

R
#5 RupertOH

stevelewis Could be interesting Steve. Have you commented the changes on the repository?

S
#6 stevelewis

RupertOH Different code and repository (I started my code in 2020 to log generation/usage and control various loads before the battery arrived).
LIne 137 onwards in https://github.com/salewis38/palm/blob/main/palm_0_7_2.py . It could be prettier!

Another difference is that I pull SolCast data for my arrays for the generation forecast.

R
#7 RupertOH

stevelewis fantastic. Also great source material too. Lots to review now. I'll tag you both when I've stood on your giant shoulders, but it might take a while, I want to build the front end in Flask as a learning exercise...

L
#8 locked

@stevelewis I did think about using the current days load but in the end stuck with an average hourly use to avoid highs and lows and take account of the periods when the sun is forecast to shine. Do you handle high usage / low usage days maybe averaging or ... ? One thing that I would like to do is compare the accuracy of forecasts using the openweathermap for cloud cover (currently in use) with solcasts forecast. When I get a little time will add some code to add in the solcast forecast and compare both against actual.

S
#9 stevelewis

locked My daytime consumption is dominated by an ASHP for much of the year - the challenge with the lookup table approach was representing this with some form of weather compensation. I've not included any averaging yet, I'm seeing how it goes. With significant weekday/weekend variations it may be better to use the consumption from a week ago instead of averaging.

Pulling the SolCast data is a bit of a faff due to the data formats, sample rate and start times - you're welcome to use my Solcast routine which presents the info as hourly data for 10%, 50% and 90% values. Interested in the comparison!

L
#10 locked

@stevelewis many thanks will take a look at the solcast code