All Projects → pufferfish-tech → octopus-agile-pi-prices

pufferfish-tech / octopus-agile-pi-prices

Licence: Apache-2.0 license
Display the upcoming prices on the Octopus Energy "Agile" tariff.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to octopus-agile-pi-prices

pi-eco-indicator
Display at-a-glance data of carbon intensity or Octopus Agile prices on a Pimoroni Blinkt! display or a Pimoroni Inky pHAT display.
Stars: ✭ 15 (-57.14%)
Mutual labels:  agile, octopus
the-solo-developers-manifesto
This guide will help solo developers achieve what could be achieved by teams by God's mercy
Stars: ✭ 97 (+177.14%)
Mutual labels:  agile
poinz
Distributed Planning Poker
Stars: ✭ 105 (+200%)
Mutual labels:  agile
maturity-models
Maturity models for IT, Agile, DevOps, TOGAF, Six Sigma, P3M3, etc.
Stars: ✭ 157 (+348.57%)
Mutual labels:  agile
yoda
GitHub extension for agile project management, using the issues subsystem.
Stars: ✭ 86 (+145.71%)
Mutual labels:  agile
TeslaMateAgile
Integration to automatically fill in prices for charge data captured by TeslaMate for smart energy providers
Stars: ✭ 40 (+14.29%)
Mutual labels:  octopus
kanban-board
Single-click full-stack application (Postgres, Spring Boot & Angular) using Docker Compose
Stars: ✭ 138 (+294.29%)
Mutual labels:  agile
user-stories-applied
敏捷的用户故事方法
Stars: ✭ 33 (-5.71%)
Mutual labels:  agile
scrumlr.io
Webapp for collaborative online retrospectives
Stars: ✭ 116 (+231.43%)
Mutual labels:  agile
hummingbird
커밋할수록 자라나는 귀여운 병아리들과 꾸준한 개발습관 들이기 어플 PeepPeep
Stars: ✭ 9 (-74.29%)
Mutual labels:  agile
steam community market
Get item prices and volumes from the Steam Community Market using Python 3
Stars: ✭ 24 (-31.43%)
Mutual labels:  prices
scrumonline
Always up to date scrumonline docker build
Stars: ✭ 18 (-48.57%)
Mutual labels:  agile
bitprices
command-line tool that generates a report of transactions with the USD (fiat) value at the time of each transaction.
Stars: ✭ 17 (-51.43%)
Mutual labels:  prices
OctopusTentacle
| Public | The secure, lightweight, cross-platform agent for Octopus Server which turns any computer into a worker or deployment target for automated deployments and operations runbooks.
Stars: ✭ 25 (-28.57%)
Mutual labels:  octopus
scrum-planning-poker
Please feel FREE to try it and give feedback by searching Scrum敏捷估算 in WeChat mini program.
Stars: ✭ 30 (-14.29%)
Mutual labels:  agile
lemon
Lemon – LED Monitor – is a $79.43 opensource alternative to LaMetric that supports GitHub-, IFTTT- and Zapier-webhooks and even integrates with Pushover!
Stars: ✭ 45 (+28.57%)
Mutual labels:  pimoroni
agile
🌌 Global State and Logic Library for JavaScript/Typescript applications
Stars: ✭ 90 (+157.14%)
Mutual labels:  agile
login
Add-on implementing User Login, Registration, Management and Password
Stars: ✭ 24 (-31.43%)
Mutual labels:  agile
s3-practical-guide
A practical guide for Sociocracy 3.0.
Stars: ✭ 56 (+60%)
Mutual labels:  agile
Juni
12 Keys Chorded keyboard layout
Stars: ✭ 51 (+45.71%)
Mutual labels:  pimoroni

octopus-agile-pi-prices

Display the upcoming prices on the Octopus Energy "Agile" tariff.

What does it do?

Octopus is an energy provider in the uk. Agile is a package they provide with half hourly energy prices. https://octopus.energy/agile/ Amazingly they offer an API to allow us nerds to code things.

Yeah but...what does it do?

It's for displaying current prices. It runs in python on a raspberry pi. This is great because it means you don't need to install anything*. The current version of Raspbian has the two things it needs: python and SQLite.

image of it working here -> https://imgur.com/hymxfbq

There's 2 versions right now. The first one I wrote was for the pimoroni "display-o-tron" hat, which is a three line LCD with RGB frontlighting. It's good, but it's not graphical, and it made a whine noise (a fault in my unit).

So I wrote a second version for the pimoroni inkyphat https://shop.pimoroni.com/?q=inkyphat. This is silent, doesn't self light, consumes no extra power, and oh, it looks awesome!

(* other than the libraries for whatever display device you want...)

What do I need?

currently:

  • A raspberry pi. The zero W works fine. The pi needs network one way or another.
  • A display adapter. If you use an inkyphat, it should work out of the box. Same with the DOThat assuming I didn't accidentally break that code.
  • An sd card (obviously) - 4GB works fine. Raspbian buster LITE version uses only about half of that. No need for any more.
  • Octopus Agile API key.

Preparing the pi

This is actually more of a tutorial on what I've found to be the best way to just set up a pi to run arbitrary code without the hassle of a mouse keyboard and monitor. It's the path of least resistance!

  • Download raspbian buster lite from the raspberry pi page https://www.raspberrypi.org/downloads/raspbian/ and flash the .img file onto the sd card using balenaetcher https://www.balena.io/etcher/
  • Add the necessary bits in to make your pi "headless" (a file named just "ssh" and a "wpa_supplicant.conf" with your wifi credentials) https://www.raspberrypi.org/documentation/configuration/wireless/headless.md
  • Boot the pi and find it somehow. Most routers have a page that tells you what IP address everything is using, otherwise there's an app on ios and android called "fing". SSH into it using putty or terminal and set it up. I suggest you run the terminal command "passwd" to change the pi password from the default of 'raspberry' to something else. You can also change stuff in "sudo raspi-config".
  • I recently discovered that the easiest way to transfer files is by SSH file transfer using something like filezilla. Get filezilla and upload the files for this project just into the home directory /home/pi. Connecting in filezilla is easy so long as you remember it's port 22 (standard FTP is 23 so filezilla tries to default to this!).

-You now need to install the libraries using the one line script from pimoroni if you are using one of their displays. At time of writing this page is for inkyphat: https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-inky-phat and the line to run (in an SSH shell on the pi obviously) is

curl https://get.pimoroni.com/inky | bash

This step installs loads of stuff including the PIL libraries and the inkyphat libraries. Nice one pimoroni. It should be noted that it does throw up some errors during and at the end and these seem fine to ignore.

  • The pi is ready for our code (and anything else you want to do with it!)

How to use the code

We're ready for the bits specific to this project now!

In an SSH terminal (putty etc):

  • Once ever: run the script that creates an SQLite database file.

    python3 create_price_db.py
    
  • Open store_prices.py (using nano or whatever) and edit the top lines where you need to change the tariff code. You will find this on your agile dashboard. It's basically a string ending in the letter A to P depending where you live.

  • Run crontab -e on the pi and add something like this :

    @reboot sleep 10; /usr/bin/python3 octoprice_main_inky.py
    */30 * * * * sleep 20; /usr/bin/python3 octoprice_main_inky.py > /home/pi/cron.log
    05 16 * * * /usr/bin/python3 store_prices.py > /home/pi/cron.log
    

    First line says run the script if you reboot, second line says run every half hour (but delay by 20s to avoid time based issues!), third line is quite important, runs every day at 4:05pm to get the next set of prices. Nothing unusual here.

  • Done! Fix it to the wall!

NOTE: If you are using the DOThat, you need to edit the above to use octoprice_main_dot.py instead of octoprice_main_inky.py. You will also need to run pimoroni's one line curl install script for the DOThat instead of inkyphat. You can go find that yourself, it exists :)

Another NOTE: I tried to make this code simple and readable. If you see any issues let me know.

Considerations

  • I wrote this myself. Because I was bored, and also because I needed to know when to plug the EV in, or start the laundry. It works but it may not be bug free.
  • The code used for the inkyphat uses fairly standard python libraries. I haven't looked into it that much as it's a single line install from pimoroni (see below) but it seems to use PIL (python image library). You should be able to adapt this to fit any display. I haven't tried.
  • The SQLite database currently just stores data every time you update prices. There's no process at this point to ensure you don't duplicate prices (the code doesn't care) or that the database fills up the sd card (I guess it will!). I plan to address this at some point when it becomes a problem. It's important to only run the store_prices.py once a day via cron. Running it more will just duplicate everything more in the db. For now, you can literally just delete the file "octoprice.sqlite" at any time if it gets too big or slow, and rerun store_prices.py. This is why this isn't high priority for me even though it seems like a big deal.

Future Work

  • Support more generic displays
  • Enable other metrics to display so you can choose what to see
  • Better handling of the sqlite database to avoid duplication and truncate (see above)

Final note

If you do appreciate this code and are thinking about joining octopus, I'll leave my referral link here https://share.octopus.energy/rust-heron-863 - We both get £50 which is pretty spectacular.

Also if you're into home automation or random tinkering then subscribe to my youtube stuff here -> https://www.youtube.com/channel/UCl_uGYJe9KW9fJWBMq1A9kw

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].