Skip to content

Instantly share code, notes, and snippets.

@athal7
Last active March 12, 2024 20:34
Show Gist options
  • Save athal7/4aeda6b69361da76e5876b016fd56cc3 to your computer and use it in GitHub Desktop.
Save athal7/4aeda6b69361da76e5876b016fd56cc3 to your computer and use it in GitHub Desktop.
ComEd Hourly Price
#!/bin/bash
# Used with https://github.com/dwaan/homebridge-file-switch
API_URL="https://hourlypricing.comed.com/api?type=currenthouraverage"
price=$(curl -s "$API_URL" | jq -r '.[0].price')
if [ -n "$DEBUG" ]; then echo $price; fi
if (( $(echo "$price < 5" | bc -l) )); then echo "On"; else echo "Off"; fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment