switching to wttr to avoid api key requirement
parent
60972cc069
commit
4d8504a05a
@ -0,0 +1 @@
|
||||
{ "FeelsLikeC": "28", "FeelsLikeF": "82", "cloudcover": "75", "humidity": "48", "localObsDateTime": "2022-08-17 01:09 PM", "observation_time": "05:09 PM", "precipInches": "0.0", "precipMM": "0.3", "pressure": "1015", "pressureInches": "30", "temp_C": "25", "temp_F": "77", "uvIndex": "4", "visibility": "16", "visibilityMiles": "9", "weatherCode": "116", "weatherDesc": [ { "value": "Partly cloudy" } ], "weatherIconUrl": [ { "value": "" } ], "winddir16Point": "E", "winddirDegree": "80", "windspeedKmph": "22", "windspeedMiles": "14" }
|
Binary file not shown.
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
HOUR=$(timedatectl | grep Local | cut -d ':' -f 2 | cut -d ' ' -f 4 | cut -d ':' -f 1)
|
||||
if [[ ${HOUR} -gt 21 || ${HOUR} -lt 5 ]] ; then # between 9 pm and 5 am
|
||||
TIME_OF_DAY="NIGHT"
|
||||
else
|
||||
TIME_OF_DAY="DAY"
|
||||
fi
|
||||
URL=$(printf 'https://v2%s.wttr.in?0&format=j1&nonce=$RANDOM' $TOD)
|
||||
WTTR=$(curl --silent -fL $URL)
|
||||
TMP=$(echo $WTTR | jq -r '.current_condition[0]')
|
||||
TEMP=$(echo $TMP | jq -r '.temp_F')
|
||||
HUMIDITY=$(echo $TMP | jq -r '.humidity')
|
||||
CONDITIONS=$(echo $TMP | jq -r '.weatherDesc[0].value')
|
||||
echo $TEMP $HUMIDITY $CONDITIONS
|
Loading…
Reference in New Issue