#!/bin/bash # see https://brightsky.dev #AQHOME_TOOL="./aqhome-tool.sh" AQHOME_TOOL="/usr/local/bin/aqhome-tool" POS_CITY="$1" STATION_ID="$2" if test -z "$POS_CITY"; then echo "Usage: $0 CITY STATION_ID" exit 1; fi if test -z "$STATION_ID"; then echo "Usage: $0 CITY STATION_ID" exit 1; fi JSONFILE="/tmp/weather-brightsky-$POS_CITY.json" # # get current weather # if ( curl -s -S "https://api.brightsky.dev/current_weather?dwd_station_id=$STATION_ID" -o $JSONFILE ); then $AQHOME_TOOL adddata -J $JSONFILE -c weather -d "brightsky/$POS_CITY" -N "Temperature" -v "@weather/temperature" -U "C" $AQHOME_TOOL adddata -J $JSONFILE -c weather -d "brightsky/$POS_CITY" -N "Humidity" -v "@current/relative_humidity" -U "%" fi