In this notebook, we show the reader how to use an electrical battery to minimize the operational carbon intensity of a building. The central idea is to charge the battery when the carbon intensity of the grid energy mix is low, and vice versa. The same methodology is used in practice to optimise for a number of different objective functions, including energy costs. Taking the hypothetical case of Pi, an eco-conscious and tech-savvy householder in the UK, we walk the reader through getting carbon intensity data, and how to use this with a number of different optimisation algorithms to decarbonise. Starting off with easy-to-understand, brute force search, we establish a baseline for subsequent (hopefully smarter) optimization algorithms. This should come naturally, since in their day job Pi is a data scientist where they often use grid and random search to tune hyperparameters of ML models. The second optimization algorithm we explore is a genetic algorithm, which belongs to the class of derivative free optimizers and is consequently extremely versatile. However, the flexibility of these algorithms comes at the cost of computational speed and effort. In many situations, it makes sense to utilize an optimization method which can make use of the special structure in the problem. As the final step, we see how Pi can optimally solve the problem of minimizing their carbon intensity by formulating it as a linear program. Along the way, we also keep an eye out for some of the most important challenges that arise in practice.