Last active
December 14, 2018 15:17
-
-
Save dj0001/ad35ecebedb951266d3c604aa9c3cf41 to your computer and use it in GitHub Desktop.
weather warnings from DWD on philipshue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rem DWD-Warnmodul (win10 1803), parameter addresse | |
@echo off | |
set lat=48.37& set lon=10.90 | |
set /p lat="Enter lat(%lat%) " & set /p lon="Enter lon(%lon%) " | |
set bridge=http://localhost:8000/api/newdeveloper | |
if "%1"=="" (set /p bridge="change bridge adress(%bridge%) ") else (set bridge=%1) | |
set light=1 | |
set /p light="select light(%light%) " | |
rem /0 group | |
if /i "%light:/=%"=="%light%" (set patha=lights/%light%/state) else (set patha=groups%light%/action) | |
:START | |
for /f "delims=" %%i in (' | |
curl -# "https://maps.dwd.de/geoserver/dwd/wms/?request=GetFeatureInfo&service=WMS&srs=EPSG%%3A4326&styles=&transparent=true&version=1.1.1&format=image%%2Fpng&bbox=%lon%%%2C%lat%%%2C%lon%1%%2C%lat%1&height=1&width=1&layers=Warnungen_Gemeinden_vereinigt&query_layers=Warnungen_Gemeinden_vereinigt&info_format=application%%2Fjson&propertyName=SEVERITY%%2CEC_GROUP&FEATURE_COUNT=5&x=0&y=0" | |
') do set res=%%i | |
set res=%res:"=% | |
set res=%res:Warnungen_Gemeinden_vereinigt.2.49.0.1.276.0.DWD.PVW.=% | |
rem warnlevel edit here, 1=Minor | |
set wl=2 | |
set hue=21840 | |
if /i not "%res:Extreme=%"=="%res%" (echo Extreme & set hue=60060) | |
if %hue%==21840 if /i not "%res:Severe=%"=="%res%" (echo Severe & if %wl% LEQ 3 (set hue=0)) | |
if %hue%==21840 if /i not "%res:HEAT=%"=="%res%" (echo HEAT & if %wl% LEQ 2 (set hue=49140)) | |
if %hue%==21840 if /i not "%res:Moderate=%"=="%res%" (echo Moderate & if %wl% LEQ 2 (set hue=5460)) | |
if %hue%==21840 if /i not "%res:Minor=%"=="%res%" (echo Minor & if %wl% LEQ 1 (set hue=10920)) | |
if %hue%==21840 echo keine Warnungen | |
rem ,\"on\":\"true\" | |
curl -H "Content-Type:application/json" -X PUT -d {\"hue\":\"%hue%\"} %bridge%/%patha% | |
timeout 300 /nobreak | |
GOTO START | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment