Skip to content

Instantly share code, notes, and snippets.

@adamwalz
Created November 5, 2015 19:46
Show Gist options
  • Save adamwalz/ec4c1e939b3806854a2f to your computer and use it in GitHub Desktop.
Save adamwalz/ec4c1e939b3806854a2f to your computer and use it in GitHub Desktop.
Gets history weather data for use by OpenSprinkler
#!/bin/bash
date=$1
wunderground_key="INSERT KEY HERE"
summary="$(http http://api.wunderground.com/api/${wunderground_key}/history_${date}/q/UT/Sandy.json | jsawk 'return this.history.dailysummary[0]')"
minhumidity=$(echo $summary | jsawk 'return this.minhumidity')
maxhumidity=$(echo $summary | jsawk 'return this.maxhumidity')
temp=$(echo $summary | jsawk 'return this.meantempi')
precip=$(echo $summary | jsawk 'return this.precipi')
echo "$minhumidity $maxhumidity $temp $precip"
for i in `seq -f "%02g" 1 31`; do
./history.sh 201508${i}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment