#!/bin/bash # see https://www.pegelonline.wsv.de/webservice/guideRestapi JSONFILE="/tmp/pegel-wsv.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 # # b475386c-30cc-453a-b3b7-1d17ace13595 for Aller at Celle # if ( curl -s -S https://www.pegelonline.wsv.de/webservices/rest-api/v2/stations/$STATION_ID/W/currentmeasurement.json -o $JSONFILE ); then $AQHOME_TOOL addjsondata -J $JSONFILE -c pegel -d ""$WATER_NAME/$LOCATION"" -N "current" -v "@value" -U "cm" fi