summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-08-04 20:00:09 +0200
committertv <tv@krebsco.de>2026-08-04 20:00:09 +0200
commit865e78a0877dd10f4736a7bdb721aa9448647d8d (patch)
tree31edcf795d7a5adcf6f0680cbfed4c501cebc29c
parent664d686b0293fd8ba427d0aa9ea63ca7e75a938f (diff)
admit WETTER_DAYS
-rwxr-xr-xwetter9
1 files changed, 7 insertions, 2 deletions
diff --git a/wetter b/wetter
index 6f5ac19..fb89ac0 100755
--- a/wetter
+++ b/wetter
@@ -14,6 +14,9 @@
#
# WETTER_API_ROOT_URL
# WETTER_TOKEN_URL
+# WETTER_DAYS
+# How many days of weather to show.
+# Default: 4
#
# WETTER_LOCATION
#
@@ -64,11 +67,13 @@ main() {
locatedAt=$(echo "$location_spec" | awk -F, '{print$2","$1}')
+ days=${WETTER_DAYS-4}
+
validFrom=$(date -d 'TZ="Europe/Berlin" - 48 hours' --utc +'%Y-%m-%dT%H:%M:%S.%3NZ')
- validUntil=$(date -d "TZ=\"Europe/Berlin\" + $(( 5 * 24 )) hours" --utc +'%Y-%m-%dT%H:%M:%S.%3NZ')
+ validUntil=$(date -d 'TZ="Europe/Berlin" + '$(( ( days + 1 ) * 24 ))' hours' --utc +'%Y-%m-%dT%H:%M:%S.%3NZ')
t0=$(date -d 'TZ="Europe/Berlin" - 0 days 00:00' +'%Y-%m-%dT%H:%M:%S.%3NZ')
- t1=$(date -d 'TZ="Europe/Berlin" + 4 days 00:00' +'%Y-%m-%dT%H:%M:%S.%3NZ')
+ t1=$(date -d 'TZ="Europe/Berlin" + '"$days"' days 00:00' +'%Y-%m-%dT%H:%M:%S.%3NZ')
curl -fsS \
-H "authorization: Bearer $token" \