conky-config/scripts/get_weather.sh

66 lines
1.2 KiB
Bash
Raw Normal View History

2016-08-11 23:25:56 -04:00
#!/bin/bash
#read location
location_string=$(cat $CONKY_LUA_HOME/scripts/location)
#get weather
weather_url="http://api.aerisapi.com/batch/"
o_fields="fields=\
place.name,\
place.state,\
place.country,\
ob.timestamp,\
ob.tempF,\
ob.dewpointF,\
ob.sky,\
2017-07-15 20:08:39 -04:00
ob.visibilityMI,\
ob.ceilingFT,\
2016-08-11 23:25:56 -04:00
ob.humidity,\
ob.pressureMB,\
ob.windSpeedMPH,\
2017-07-15 20:08:39 -04:00
ob.windGustMPH,\
2016-08-11 23:25:56 -04:00
ob.windDirDEG,\
ob.weather,\
ob.feelslikeF,\
ob.icon,\
ob.sunrise,\
ob.sunset,\
2017-07-15 20:08:39 -04:00
ob.light,\
2016-08-11 23:25:56 -04:00
ob.precipIN"
observations="/observations%3F$o_fields"
h_fields="fields=\
periods.timestamp,\
periods.avgTempF,\
periods.feelslikeF,\
periods.pop,\
periods.humidity,\
periods.windSpeedMPH,\
periods.icon,\
periods.weatherPrimary"
2017-07-15 20:08:39 -04:00
hourly="/forecasts%3Ffilter=4hr%26limit=8%26$h_fields"
2016-08-11 23:25:56 -04:00
d_fields="fields=\
periods.timestamp,\
periods.minTempF,\
periods.maxTempF,\
periods.pop,\
periods.humidity,\
periods.windDir,\
periods.icon,\
periods.windSpeedMPH,\
periods.weatherPrimary"
2017-07-15 20:08:39 -04:00
daily="/forecasts%3Ffrom=tomorrow%26limit=8%26$d_fields"
2016-08-11 23:25:56 -04:00
alerts="/alerts"
id="client_id=TdJ5M1pUXWUUebhfRKSs2"
secret="client_secret=DmI2NHCO6BQ5hSH4yAECVJlgA8gYZ1C4BvNaGEuM"
curl -s "$weather_url$location_string?requests=$observations,$hourly,$daily&$id&$secret" > /tmp/weather.json && \
echo 1 > /tmp/weather_recently_updated &