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.
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.txtEdit the script and add your API key and site ID from the Amber Electric API. The variables you need to edit are:
apiKeysiteId
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 -eAdd 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
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.