various scripts for various tasks.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

collectweather.sh 811B

1234567891011121314151617
  1. #!/bin/sh
  2. HOSTNAME="${COLLECTD_HOSTNAME:-`hostname -f`}"
  3. INTERVAL="${COLLECTD_INTERVAL:-300}"
  4. FILE="/tmp/weather.json"
  5. # get $FILE using a cronjob (no more than 1000 requests per day for free - one every 5 minutes is fine) like
  6. #curl "https://api.darksky.net/forecast/<your api key>/<latitude>,<longitude>?lang=<language>&units=si" -o $FILE -s
  7. while sleep "$INTERVAL"; do
  8. for field in precipIntensity precipProbability temperature apparentTemperature dewPoint humidity pressure windSpeed windGust windBearing cloudCover uvIndex visibility ozone;do
  9. echo "PUTVAL $HOSTNAME/weather/gauge-${field} interval=$INTERVAL N:`jq .currently.${field} $FILE`" ;
  10. done
  11. for field in summary icon ;do
  12. echo "PUTVAL $HOSTNAME/weather/string-${field} interval=$INTERVAL N:`jq .currently.${field} $FILE`" ;
  13. done
  14. done