MattKobayashi / amber-pi

Amber Electric pricing traffic light on a Raspberry Pi

Repository from Github https://github.comMattKobayashi/amber-piRepository from Github https://github.comMattKobayashi/amber-pi

amber-pi

amber-pi is a Python script for polling the Amber Electric API and using the data to set PiStop traffic lights according to the current power price.

Installation

Ensure you have Python 3.x installed on your system (it's pre-installed on Raspberry Pi OS). Install the dependencies from requirements.txt if they're not already installed (again, these are pre-installed with Raspberry Pi OS):

cd /path/to/requirements

python3 -m pip install -r requirements.txt

Usage

Edit the script and add your API key and site ID from the Amber Electric API. The variables you need to edit are:

  • apiKey
  • siteId

You can also optionally adjust the prices (in c/kWh) that trigger changes to the lights. The variables are:

  • alertHigh: Above this price, the red light is set.
  • alertLow: Below this price, the green light is set.
  • All prices in between will trigger an amber light.

The script is intended to be run as a cronjob. Edit your crontab:

crontab -e

Add the following line (use this link to choose how often you want the job to run and change the following line as needed):

1/5 * * * * python3 /path/to/script/amber-pi.py

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

Apache License 2.0

About

Amber Electric pricing traffic light on a Raspberry Pi

License:Apache License 2.0


Languages

Language:Python 79.1%Language:Dockerfile 20.9%