Octopus Energy rate meter

Having moved to Octopus Energy on the Agile tariff we are already saving money. However there is definitely more we can do. Agile has a low rate throughout the day, but peaks between typically 4pm and 7pm. The trick is remembering that the rate is high, or will be high, and not using electricity at that time.

It would be far easier if it were possible to view the current and upcoming rates. This is possible via the website, or by using the Octopus Watch phone app. On Android the app displays the current rate in your status messages. However it is a subscription, no issue for me but it means it’s not visible to the rest of the family or others in the house. So I needed another solution. We have an electricity monitor (IHD) which was fitted with our SMETS2 meter by our previous provider. This does display current usage but doesn’t, unfortunately, show the Agile rate and doesn’t change it’s calculations as the rate changes through the day.

While reading the Octopus Agile forum recently I came across a post which mentioned a project using a Raspberry Pi W, Inky pHAT display, some 3D printing and Python scripting to download and display the current rates. Right up my street, and it was raining today so I thought I’d give it a go.

The case for the project was designed by can be found on Thingiverse here: https://www.thingiverse.com/thing:3545755. For some reason only the file for the front of the case was downloadable, the back was missing, and from the comments it seems like this has happened before. Anyway, I set the printer up and get it started as it was going to take an hour and a half to print.

The next step was to write an SD card with Raspian, I went for the lite version of Buster, because I had it and I didn’t need any of the desktop code. I knew I had an Inky pHAT somewhere that I’d bought from the Pimoroni stand at one Makerfaire or another, and there it was at the bottom of my ‘useful one day’ box. This is only ever going to run headless, connected to our wifi and be connected to over ssh, so I got those configured. Then downloaded and ran the install script from Pimoroni for the board. Initially I just mounted the board directly onto the Pi Zero W to get things working while the case printed. On the first run of the name badge example it worked! Ok, that was the first part done.

Next to get the Python code to collect and display the data. This can be found on github here https://github.com/pufferfish-tech/octopus-agile-pi-prices. As the README says, it’s in progress, and I found in the version that I had there were some syntax errors in the code, so I assume an interim version got submitted somehow. The fix was as simple as pre-declaring the variables that stored the rate values from the database and then assigning them to the data values inside the for loops – hope that makes sense when you look at the code! I also modified the scripts to use the absolute path for the database, as I’d cloned the project into a subdirectory on my Pi. Finally in order to get it to run I had to modify the export script to use the correct Agile tariff name for me, which I got from the API link on my Octopus account page. That was it, ran the script and the data was displayed. I added the crontab entries as mentioned on the github page to ensure that the display refreshed.

By now the case had finished printing, so it was time for assembly – or was it. I came up with the cunning plan of using a blowlamp to quickly burn away the threads of plastic left over the holes from the printing process. Alas, not quickly enough, the case was so thin in places it just melted, time to print another one.

An hour and a half later it was time to assemble – I CAREFULLY cut away the excess fibres from the printing process, and ‘adjusted’ the case to fit the pHAT and Pi W. Once done I used some short connecting wires I had to join the pHAT to the Pi Zero, connecting the key pins mentioned on the Pinout.xyz page for the board here https://pinout.xyz/pinout/inky_phat I ensured that all 8 pins mentioned were connected.

That was it, my display was up and running and updating every 30 mins to the latest rate. Ideally over time I’d like to expand on this and possibly even add the realtime usage data, and possibly other weather and home automation related data to it.

Leave a Reply

Your email address will not be published. Required fields are marked *