December adventure 2024
2024-12-01
For a couple of years I've done Advent of Code but that's no longer my thing. This year I came across December Adventure and that resonates more with what I'd like to do: a little progress every day on a project rather than having to solve a couple puzzles every day.
Lately I've been working on my own tool to optimise the decision on if/when/how to charge our home battery overnight to take advantage of cheap electricity prices. This doesn't matter much during the summer when we have plenty of energy from the sun but it can make a (small but noticeable) difference in winter.
The stack I have consists of a few different components:
- a tool to interface with the inverter. Written in Rust and pretty much feature complete but could always use a bit more polish;
- a web app, written in Elixir, that fetches data from various API (Solcast, Octopus Energy), stores historical data, and periodically makes decision on the optimal policy. This is where I reckon I could do most of the work;
- a small Python script, for reporting;
- Nix configuration to manage deployments, dashboards and in general the infrastructure side of the project.
The surface of the project is not too small so finding new things to work on should be easy. Before starting I already know I'd like to improve our home load estimation and add an "holiday mode", which will be really useful at the end of the month.
This post is a living document. I'll update it through the month to log my progress. I fully expect to have some "rest days", especially at the end of the month, but that's okay.
Day 1
Just a minor tweak to the notification message I get (via Ntfy) whenever my program decides what to do for the next day. I like to receive these notifications so I can sanity check that my algorithm decided something sensible.
Day 2
I improved the load estimation algorithm. Before I was taking the average from the historical values for each of the 30-minute slots. That's okay-ish but what we end up comparing to isn't a day that actually existed and peaks are smoothed out.
To have a more realistic estimate, and to be able to be more conservative with my optimisation, I changed the load estimate to compute the total load for every day in the last month and pick one of them. This also makes it possible to tune how conservative we want the estimate to be. For now I'm going to use the day that sits at the 70th percentile. It feels like it could work.
Day 3
Deployed the changes I made in the previous days, found a bug and fixed it.
Thanks for reading. Feel free to reach out for any comment or question.