Files
aqhomecontrol/scripts/getlevel-nlwkn.sh
2024-02-25 01:22:29 +01:00

35 lines
972 B
Bash
Executable File

#!/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