/Snap

Code and build instructions for Snap, a simple Raspberry Pi and LED machine to show you how expensive the electricyty is at the moment. On row of LEDs shows the cost of the hour, the other row the cost of the day.

Primary LanguagePythonCreative Commons Zero v1.0 UniversalCC0-1.0

Snap

Code and build instructions for Snap, a simple Raspberry Pi and LED machine to show you how expensive the electricyty is at the moment. On row of LEDs shows the cost of the hour, the other row the cost of the day.

UPDATE: Added a Wiz bulb to show the eneryg cost too. Simply change the variable ip to the ip address of your bulb. If you don't want to use the Wiz, simply set wiz to False

Like this.

  1. Only Green = Very cheap
  2. Green & Orange = Cheap
  3. Only Orange = Ok
  4. Orange & Red = Expensive
  5. Only Red = Very expensive

Setup

Install Raspbian on a Raspberry Pi

LED

Buy some LEDs, wires and a breadboard. I only used the breadboard while building.

Connect the LEDs to the GPIO pins of your liking, you can see which one I used in my script.

Wiz

Install pip:

sudo apt install python3-pip

Install pywizlight

pip install pywizlight

The script

Download the script and put it in your home folder, for example /home/pi/.

Go to Tibber and get your Access Token.

Edit the downloaded script, and change YOUR-TOKEN-HERE to your Access Token.

If you have more than one home, change:

['homes'][0]

to reflect which home you are pulling data from. To see which home you want to use, go to Tibbers Api Explorer and Load your personal token and simply run "Homes" in the drop down.

If you want the script to start automatically when the pi is booted run this command:

crontab -e

Answer 1

Add this to the file:

@reboot /bin/sleep 10; /usr/bin/python /home/pi/snap.py

Restart your Pi and press watch the lights.

Learn and experiment

If you want to change your script Tibber has an excellent playground here.

And here you can read more about GraphQL Concepts.

That's basically all I used for reference making this project. Good luck!