add first scripts to get water levels.

This commit is contained in:
Martin Preuss
2024-02-25 01:22:29 +01:00
parent dce1b8698a
commit e7bfa36cab
4 changed files with 82 additions and 0 deletions

34
scripts/getlevel-nlwkn.sh Executable file
View File

@@ -0,0 +1,34 @@
#!/bin/bash
# see https://www.pegelonline.nlwkn.niedersachsen.de/pdf/BenutzerhandbuchWebservicePegelonline.pdf
JSONFILE="/tmp/pegel-nlwkn.json"
AQHOME_TOOL="./aqhome-tool.sh"
# AQHOME_TOOL="/usr/local/bin/aqhome-tool"
STATION_ID="$1"
WATER_NAME="$2"
LOCATION="$3"
if test -z "$STATION_ID"; then
echo "Usage: $0 STATION_ID WATER_NAME LOCATION"
exit 1;
fi
if test -z "$WATER_NAME"; then
echo "Usage: $0 STATION_ID WATER_NAME LOCATION"
exit 1;
fi
if test -z "$LOCATION"; then
echo "Usage: $0 STATION_ID WATER_NAME LOCATION"
exit 1;
fi
#
# 106 for Fuhse/Wathlingen
#
if ( curl -s -S https://bis.azure-api.net/PegelonlinePublic/REST/station/$STATION_ID/datenspuren/parameter/1/tage/-1?key=9dc05f4e3b4a43a9988d747825b39f43 -o $JSONFILE ); then
$AQHOME_TOOL addjsondata -J $JSONFILE -c pegel -d "$WATER_NAME/$LOCATION" -N "current" -v "@getPegelDatenspurenResult/Parameter/Datenspuren/AktuellerMesswert" -U "@getPegelDatenspurenResult/Parameter/Einheit"
fi