Hi, I’m glad you found a solution. I went a totally different way the last few days, and maybe it’s interesting for somebody.
I dont’s use the json file of the DWD, but the xml files which are on a municipality level (Gemeinde statt Landkreis). I display up to 3 different warnings, my dashboard you can see here:
I think the best way would be via xslt, but I didn’t get that to work, that’s why I use a shell script (I’m more familiar with )
I use the following items:
/* Wetterwarnungen */
String DWD_Warnung_1_Event "DWD Warn 1 Event [%s]" (gWarnUnwetter)
String DWD_Warnung_2_Event "DWD Warn 2 Event [%s]" (gWarnUnwetter)
String DWD_Warnung_3_Event "DWD Warn 3 Event [%s]" (gWarnUnwetter)
String DWD_Warnung_1_Severity "DWD Warn 1 Severity [%s]" (gWarnUnwetter)
String DWD_Warnung_2_Severity "DWD Warn 2 Severity [%s]" (gWarnUnwetter)
String DWD_Warnung_3_Severity "DWD Warn 3 Severity [%s]" (gWarnUnwetter)
DateTime DWD_Warnung_1_Start "DWD Warn 1 Start [%1$td.%1$tm %1$tH:%1$tM]" (gWarnUnwetter)
DateTime DWD_Warnung_2_Start "DWD Warn 2 Start [%1$td.%1$tm %1$tH:%1$tM]" (gWarnUnwetter)
DateTime DWD_Warnung_3_Start "DWD Warn 3 Start [%1$td.%1$tm %1$tH:%1$tM]" (gWarnUnwetter)
DateTime DWD_Warnung_1_End "DWD Warn 1 End [%1$td.%1$tm %1$tH:%1$tM]" (gWarnUnwetter)
DateTime DWD_Warnung_2_End "DWD Warn 2 End [%1$td.%1$tm %1$tH:%1$tM]" (gWarnUnwetter)
DateTime DWD_Warnung_3_End "DWD Warn 3 End [%1$td.%1$tm %1$tH:%1$tM]" (gWarnUnwetter)
String DWD_Warnung_1_Group "DWD Warn 1 Group [%s]" (gWarnUnwetter)
String DWD_Warnung_2_Group "DWD Warn 2 Group [%s]" (gWarnUnwetter)
String DWD_Warnung_3_Group "DWD Warn 3 Group [%s]" (gWarnUnwetter)
String DWD_Warnung_1_Parameter "DWD Warn 1 Param [%s]" (gWarnUnwetter)
String DWD_Warnung_2_Parameter "DWD Warn 2 Param [%s]" (gWarnUnwetter)
String DWD_Warnung_3_Parameter "DWD Warn 3 Param [%s]" (gWarnUnwetter)
String DWD_Warnung_1_Start_lesbar "DWD Warn 1 Start lb [%s]" (gWarnUnwetter)
String DWD_Warnung_2_Start_lesbar "DWD Warn 2 Start lb [%s]" (gWarnUnwetter)
String DWD_Warnung_3_Start_lesbar "DWD Warn 3 Start lb [%s]" (gWarnUnwetter)
String DWD_Warnung_1_End_lesbar "DWD Warn 1 End lb [%s]" (gWarnUnwetter)
String DWD_Warnung_2_End_lesbar "DWD Warn 2 End lb [%s]" (gWarnUnwetter)
String DWD_Warnung_3_End_lesbar "DWD Warn 3 End lb [%s]" (gWarnUnwetter)
String DWD_Warnung_Max_Severity "DWD Warn Max Severity [%s]" (gWarnUnwetter)
They get updated by the following shell sript (triggered every 5 Minutes via rule or crontab) - warncellid to be adjusted, the number between the two “%27” - starting with an 8
# check current value of Warnung_1_Event
value_old=$(curl -s "http://openhabianpi:8080/rest/items/DWD_Warnung_1_Event/state")
# download xml for warncellid or ids
rm /etc/openhab2/html/dwd/warnings.xml
wget -q -O /etc/openhab2/html/dwd/warnings.xml "https://maps.dwd.de/geoserver/dwd/ows?service=WFS&version=2.0.0&request=GetFeature&typeName=dwd:Warnungen_Gemeinden&CQL_FILTER=WARNCELLID%20IN%20(%27800000000%27)"
if [ ! -s /etc/openhab2/html/dwd/warnings.xml ]; then
echo "xml-Datei ist leer. Vermutlich kein Internet. Ich geh wieder schlafen..."
exit
fi
#
# Events
value=$(</etc/openhab2/html/dwd/warnings.xml awk -F"<dwd:EVENT>" '{print $2}' | awk -F"</dwd:EVENT>" '{print $1}')
if [ -n "$value" ]; then
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "$value" "http://openhabianpi:8080/rest/items/DWD_Warnung_1_Event/state"
else
if [ "$value_old" = "0" ]; then
# echo "Keine Warnung gefunden, Wert in OH ist schon 0, ich geh wieder schlafen..."
exit
fi
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "0" "http://openhabianpi:8080/rest/items/DWD_Warnung_1_Event/state"
fi
value=$(</etc/openhab2/html/dwd/warnings.xml awk -F"<dwd:EVENT>" '{print $3}' | awk -F"</dwd:EVENT>" '{print $1}')
if [ -n "$value" ]; then
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "$value" "http://openhabianpi:8080/rest/items/DWD_Warnung_2_Event/state"
else
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "0" "http://openhabianpi:8080/rest/items/DWD_Warnung_2_Event/state"
fi
value=$(</etc/openhab2/html/dwd/warnings.xml awk -F"<dwd:EVENT>" '{print $4}' | awk -F"</dwd:EVENT>" '{print $1}')
if [ -n "$value" ]; then
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "$value" "http://openhabianpi:8080/rest/items/DWD_Warnung_3_Event/state"
else
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "0" "http://openhabianpi:8080/rest/items/DWD_Warnung_3_Event/state"
fi
#
# Severity
value=$(</etc/openhab2/html/dwd/warnings.xml awk -F"<dwd:SEVERITY>" '{print $2}' | awk -F"</dwd:SEVERITY>" '{print $1}')
if [ -n "$value" ]; then
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "$value" "http://openhabianpi:8080/rest/items/DWD_Warnung_1_Severity/state"
else
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "0" "http://openhabianpi:8080/rest/items/DWD_Warnung_1_Severity/state"
fi
value=$(</etc/openhab2/html/dwd/warnings.xml awk -F"<dwd:SEVERITY>" '{print $3}' | awk -F"</dwd:SEVERITY>" '{print $1}')
if [ -n "$value" ]; then
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "$value" "http://openhabianpi:8080/rest/items/DWD_Warnung_2_Severity/state"
else
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "0" "http://openhabianpi:8080/rest/items/DWD_Warnung_2_Severity/state"
fi
value=$(</etc/openhab2/html/dwd/warnings.xml awk -F"<dwd:SEVERITY>" '{print $4}' | awk -F"</dwd:SEVERITY>" '{print $1}')
if [ -n "$value" ]; then
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "$value" "http://openhabianpi:8080/rest/items/DWD_Warnung_3_Severity/state"
else
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "0" "http://openhabianpi:8080/rest/items/DWD_Warnung_3_Severity/state"
fi
#
# Start
value=$(</etc/openhab2/html/dwd/warnings.xml awk -F"<dwd:ONSET>" '{print $2}' | awk -F"</dwd:ONSET>" '{print $1}')
if [ -n "$value" ]; then
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "$value" "http://openhabianpi:8080/rest/items/DWD_Warnung_1_Start/state"
else
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "2000-01-01T00:00:00Z" "http://openhabianpi:8080/rest/items/DWD_Warnung_1_Start/state"
fi
value=$(</etc/openhab2/html/dwd/warnings.xml awk -F"<dwd:ONSET>" '{print $3}' | awk -F"</dwd:ONSET>" '{print $1}')
if [ -n "$value" ]; then
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "$value" "http://openhabianpi:8080/rest/items/DWD_Warnung_2_Start/state"
else
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "2000-01-01T00:00:00Z" "http://openhabianpi:8080/rest/items/DWD_Warnung_2_Start/state"
fi
value=$(</etc/openhab2/html/dwd/warnings.xml awk -F"<dwd:ONSET>" '{print $4}' | awk -F"</dwd:ONSET>" '{print $1}')
if [ -n "$value" ]; then
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "$value" "http://openhabianpi:8080/rest/items/DWD_Warnung_3_Start/state"
else
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "2000-01-01T00:00:00Z" "http://openhabianpi:8080/rest/items/DWD_Warnung_3_Start/state"
fi
#
# End
value=$(</etc/openhab2/html/dwd/warnings.xml awk -F"<dwd:EXPIRES>" '{print $2}' | awk -F"</dwd:EXPIRES>" '{print $1}')
if [ -n "$value" ]; then
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "$value" "http://openhabianpi:8080/rest/items/DWD_Warnung_1_End/state"
else
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "2000-01-01T00:00:00Z" "http://openhabianpi:8080/rest/items/DWD_Warnung_1_End/state"
fi
value=$(</etc/openhab2/html/dwd/warnings.xml awk -F"<dwd:EXPIRES>" '{print $3}' | awk -F"</dwd:EXPIRES>" '{print $1}')
if [ -n "$value" ]; then
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "$value" "http://openhabianpi:8080/rest/items/DWD_Warnung_2_End/state"
else
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "2000-01-01T00:00:00Z" "http://openhabianpi:8080/rest/items/DWD_Warnung_2_End/state"
fi
value=$(</etc/openhab2/html/dwd/warnings.xml awk -F"<dwd:EXPIRES>" '{print $4}' | awk -F"</dwd:EXPIRES>" '{print $1}')
if [ -n "$value" ]; then
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "$value" "http://openhabianpi:8080/rest/items/DWD_Warnung_3_End/state"
else
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "2000-01-01T00:00:00Z" "http://openhabianpi:8080/rest/items/DWD_Warnung_3_End/state"
fi
#
# Group
value=$(</etc/openhab2/html/dwd/warnings.xml awk -F"<dwd:EC_GROUP>" '{print $2}' | awk -F"</dwd:EC_GROUP>" '{print $1}')
if [ -n "$value" ]; then
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "$value" "http://openhabianpi:8080/rest/items/DWD_Warnung_1_Group/state"
else
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "0" "http://openhabianpi:8080/rest/items/DWD_Warnung_1_Group/state"
fi
value=$(</etc/openhab2/html/dwd/warnings.xml awk -F"<dwd:EC_GROUP>" '{print $3}' | awk -F"</dwd:EC_GROUP>" '{print $1}')
if [ -n "$value" ]; then
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "$value" "http://openhabianpi:8080/rest/items/DWD_Warnung_2_Group/state"
else
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "0" "http://openhabianpi:8080/rest/items/DWD_Warnung_2_Group/state"
fi
value=$(</etc/openhab2/html/dwd/warnings.xml awk -F"<dwd:EC_GROUP>" '{print $4}' | awk -F"</dwd:EC_GROUP>" '{print $1}')
if [ -n "$value" ]; then
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "$value" "http://openhabianpi:8080/rest/items/DWD_Warnung_3_Group/state"
else
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "0" "http://openhabianpi:8080/rest/items/DWD_Warnung_3_Group/state"
fi
#
# Parameter
value=$(</etc/openhab2/html/dwd/warnings.xml awk -F"<dwd:PARAMATERVALUE>" '{print $2}' | awk -F"</dwd:PARAMATERVALUE>" '{print $1}' | sed 's/</</g' | sed 's/>/>/g')
if [ -n "$value" ]; then
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "$value" "http://openhabianpi:8080/rest/items/DWD_Warnung_1_Parameter/state"
else
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "0" "http://openhabianpi:8080/rest/items/DWD_Warnung_1_Parameter/state"
fi
value=$(</etc/openhab2/html/dwd/warnings.xml awk -F"<dwd:PARAMATERVALUE>" '{print $3}' | awk -F"</dwd:PARAMATERVALUE>" '{print $1}' | sed 's/</</g' | sed 's/>/>/g')
if [ -n "$value" ]; then
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "$value" "http://openhabianpi:8080/rest/items/DWD_Warnung_2_Parameter/state"
else
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "0" "http://openhabianpi:8080/rest/items/DWD_Warnung_2_Parameter/state"
fi
value=$(</etc/openhab2/html/dwd/warnings.xml awk -F"<dwd:PARAMATERVALUE>" '{print $4}' | awk -F"</dwd:PARAMATERVALUE>" '{print $1}' | sed 's/</</g' | sed 's/>/>/g')
if [ -n "$value" ]; then
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "$value" "http://openhabianpi:8080/rest/items/DWD_Warnung_3_Parameter/state"
else
curl -s -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "0" "http://openhabianpi:8080/rest/items/DWD_Warnung_3_Parameter/state"
fi
I use the following rules to improve the readability of the start and end date (make it “lesbar” )
rule "Wetterwarnungen lesbarer machen - 1 Start"
when
Item DWD_Warnung_1_Start changed
then
val DateTime Start = new DateTime((DWD_Warnung_1_Start.state as DateTimeType).zonedDateTime.toInstant.toEpochMilli)
val DateTime Start_Tag = new DateTime((DWD_Warnung_1_Start.state as DateTimeType).zonedDateTime.toInstant.toEpochMilli).withTimeAtStartOfDay
val Long Diff = Math::round((Start_Tag.millis - now.withTimeAtStartOfDay.millis) / (86400000.0))
val String Uhrzeit = Start.toString.substring(11,16)
val String Tag = Start.toString.substring(8,10)
val String Monat = Start.toString.substring(5,7)
if ( Diff == 0 ) {
DWD_Warnung_1_Start_lesbar.postUpdate("heute " +Uhrzeit)
} else if ( Diff == 1 ) {
DWD_Warnung_1_Start_lesbar.postUpdate("morgen " +Uhrzeit)
} else if ( Diff == -1 ) {
DWD_Warnung_1_Start_lesbar.postUpdate("gestern " +Uhrzeit)
} else {
DWD_Warnung_1_Start_lesbar.postUpdate(Tag +"." +Monat +". " +Uhrzeit)
}
Thread::sleep(3000)
if (DWD_Warnung_1_Severity.state!="0") {
if (DWD_Warnung_1_Event.state=="UV-INDEX") {
sendTelegram("haus_an_mich_bot", "UV-Warnung von %s bis %s", DWD_Warnung_1_Start_lesbar.state.toString, DWD_Warnung_1_End_lesbar.state.toString)
} else {
sendTelegram("haus_an_mich_bot", "%s von %s bis %s (%s) [%s]", DWD_Warnung_1_Event.state.toString, DWD_Warnung_1_Start_lesbar.state.toString, DWD_Warnung_1_End_lesbar.state.toString, DWD_Warnung_1_Parameter.state.toString, DWD_Warnung_1_Severity.state.toString)
}
}
end
rule "Wetterwarnungen lesbarer machen - 2 Start"
when
Item DWD_Warnung_2_Start changed
then
val DateTime Start = new DateTime((DWD_Warnung_2_Start.state as DateTimeType).zonedDateTime.toInstant.toEpochMilli)
val DateTime Start_Tag = new DateTime((DWD_Warnung_2_Start.state as DateTimeType).zonedDateTime.toInstant.toEpochMilli).withTimeAtStartOfDay
val Long Diff = Math::round((Start_Tag.millis - now.withTimeAtStartOfDay.millis) / (86400000.0))
val String Uhrzeit = Start.toString.substring(11,16)
val String Tag = Start.toString.substring(8,10)
val String Monat = Start.toString.substring(5,7)
if ( Diff == 0 ) {
DWD_Warnung_2_Start_lesbar.postUpdate("heute " +Uhrzeit)
} else if ( Diff == 1 ) {
DWD_Warnung_2_Start_lesbar.postUpdate("morgen " +Uhrzeit)
} else if ( Diff == -1 ) {
DWD_Warnung_2_Start_lesbar.postUpdate("gestern " +Uhrzeit)
} else {
DWD_Warnung_2_Start_lesbar.postUpdate(Tag +"." +Monat +". " +Uhrzeit)
}
Thread::sleep(3000)
if (DWD_Warnung_2_Severity.state!="0") {
if (DWD_Warnung_2_Event.state=="UV-INDEX") {
sendTelegram("haus_an_mich_bot", "UV-Warnung von %s bis %s", DWD_Warnung_2_Start_lesbar.state.toString, DWD_Warnung_2_End_lesbar.state.toString)
} else {
sendTelegram("haus_an_mich_bot", "%s von %s bis %s (%s) [%s]", DWD_Warnung_2_Event.state.toString, DWD_Warnung_2_Start_lesbar.state.toString, DWD_Warnung_2_End_lesbar.state.toString, DWD_Warnung_2_Parameter.state.toString, DWD_Warnung_2_Severity.state.toString)
}
}
end
rule "Wetterwarnungen lesbarer machen - 3 Start"
when
Item DWD_Warnung_3_Start changed
then
val DateTime Start = new DateTime((DWD_Warnung_3_Start.state as DateTimeType).zonedDateTime.toInstant.toEpochMilli)
val DateTime Start_Tag = new DateTime((DWD_Warnung_3_Start.state as DateTimeType).zonedDateTime.toInstant.toEpochMilli).withTimeAtStartOfDay
val Long Diff = Math::round((Start_Tag.millis - now.withTimeAtStartOfDay.millis) / (86400000.0))
val String Uhrzeit = Start.toString.substring(11,16)
val String Tag = Start.toString.substring(8,10)
val String Monat = Start.toString.substring(5,7)
if ( Diff == 0 ) {
DWD_Warnung_3_Start_lesbar.postUpdate("heute " +Uhrzeit)
} else if ( Diff == 1 ) {
DWD_Warnung_3_Start_lesbar.postUpdate("morgen " +Uhrzeit)
} else if ( Diff == -1 ) {
DWD_Warnung_3_Start_lesbar.postUpdate("gestern " +Uhrzeit)
} else {
DWD_Warnung_3_Start_lesbar.postUpdate(Tag +"." +Monat +". " +Uhrzeit)
}
Thread::sleep(3000)
if (DWD_Warnung_3_Severity.state!="0") {
if (DWD_Warnung_3_Event.state=="UV-INDEX") {
sendTelegram("haus_an_mich_bot", "UV-Warnung von %s bis %s", DWD_Warnung_3_Start_lesbar.state.toString, DWD_Warnung_3_End_lesbar.state.toString)
} else {
sendTelegram("haus_an_mich_bot", "%s von %s bis %s (%s) [%s]", DWD_Warnung_3_Event.state.toString, DWD_Warnung_3_Start_lesbar.state.toString, DWD_Warnung_3_End_lesbar.state.toString, DWD_Warnung_3_Parameter.state.toString, DWD_Warnung_3_Severity.state.toString)
}
}
end
rule "Wetterwarnungen lesbarer machen - 1 End"
when
Item DWD_Warnung_1_End changed
then
val DateTime Start = new DateTime((DWD_Warnung_1_End.state as DateTimeType).zonedDateTime.toInstant.toEpochMilli)
val DateTime Start_Tag = new DateTime((DWD_Warnung_1_End.state as DateTimeType).zonedDateTime.toInstant.toEpochMilli).withTimeAtStartOfDay
val Long Diff = Math::round((Start_Tag.millis - now.withTimeAtStartOfDay.millis) / (86400000.0))
val String Uhrzeit = Start.toString.substring(11,16)
val String Tag = Start.toString.substring(8,10)
val String Monat = Start.toString.substring(5,7)
if ( Diff == 0 ) {
DWD_Warnung_1_End_lesbar.postUpdate("heute " +Uhrzeit)
} else if ( Diff == 1 ) {
DWD_Warnung_1_End_lesbar.postUpdate("morgen " +Uhrzeit)
} else if ( Diff == -1 ) {
DWD_Warnung_1_End_lesbar.postUpdate("gestern " +Uhrzeit)
} else {
DWD_Warnung_1_End_lesbar.postUpdate(Tag +"." +Monat +". " +Uhrzeit)
}
end
rule "Wetterwarnungen lesbarer machen - 2 End"
when
Item DWD_Warnung_2_End changed
then
val DateTime Start = new DateTime((DWD_Warnung_2_End.state as DateTimeType).zonedDateTime.toInstant.toEpochMilli)
val DateTime Start_Tag = new DateTime((DWD_Warnung_2_End.state as DateTimeType).zonedDateTime.toInstant.toEpochMilli).withTimeAtStartOfDay
val Long Diff = Math::round((Start_Tag.millis - now.withTimeAtStartOfDay.millis) / (86400000.0))
val String Uhrzeit = Start.toString.substring(11,16)
val String Tag = Start.toString.substring(8,10)
val String Monat = Start.toString.substring(5,7)
if ( Diff == 0 ) {
DWD_Warnung_2_End_lesbar.postUpdate("heute " +Uhrzeit)
} else if ( Diff == 1 ) {
DWD_Warnung_2_End_lesbar.postUpdate("morgen " +Uhrzeit)
} else if ( Diff == -1 ) {
DWD_Warnung_2_End_lesbar.postUpdate("gestern " +Uhrzeit)
} else {
DWD_Warnung_2_End_lesbar.postUpdate(Tag +"." +Monat +". " +Uhrzeit)
}
end
rule "Wetterwarnungen lesbarer machen - 3 End"
when
Item DWD_Warnung_3_End changed
then
val DateTime Start = new DateTime((DWD_Warnung_3_End.state as DateTimeType).zonedDateTime.toInstant.toEpochMilli)
val DateTime Start_Tag = new DateTime((DWD_Warnung_3_End.state as DateTimeType).zonedDateTime.toInstant.toEpochMilli).withTimeAtStartOfDay
val Long Diff = Math::round((Start_Tag.millis - now.withTimeAtStartOfDay.millis) / (86400000.0))
val String Uhrzeit = Start.toString.substring(11,16)
val String Tag = Start.toString.substring(8,10)
val String Monat = Start.toString.substring(5,7)
if ( Diff == 0 ) {
DWD_Warnung_3_End_lesbar.postUpdate("heute " +Uhrzeit)
} else if ( Diff == 1 ) {
DWD_Warnung_3_End_lesbar.postUpdate("morgen " +Uhrzeit)
} else if ( Diff == -1 ) {
DWD_Warnung_3_End_lesbar.postUpdate("gestern " +Uhrzeit)
} else {
DWD_Warnung_3_End_lesbar.postUpdate(Tag +"." +Monat +". " +Uhrzeit)
}
end
rule "Wetterwarnungen - Max Severity"
when
Item DWD_Warnung_1_Severity changed or
Item DWD_Warnung_2_Severity changed or
Item DWD_Warnung_3_Severity changed or
Item DelayedStartup changed from OFF to ON
then
var String MaxSeverity = "0"
if((DWD_Warnung_1_Severity.state=="Minor") || (DWD_Warnung_2_Severity.state=="Minor") || (DWD_Warnung_3_Severity.state=="Minor")) {
MaxSeverity = "Minor"
}
if((DWD_Warnung_1_Severity.state=="Moderate") || (DWD_Warnung_2_Severity.state=="Moderate") || (DWD_Warnung_3_Severity.state=="Moderate")) {
MaxSeverity = "Moderate"
}
if((DWD_Warnung_1_Severity.state=="Severe") || (DWD_Warnung_2_Severity.state=="Severe") || (DWD_Warnung_3_Severity.state=="Severe")) {
MaxSeverity = "Severe"
}
if((DWD_Warnung_1_Severity.state=="Extreme") || (DWD_Warnung_2_Severity.state=="Extreme") || (DWD_Warnung_3_Severity.state=="Extreme")) {
MaxSeverity = "Extreme"
}
DWD_Warnung_Max_Severity.postUpdate(MaxSeverity)
end
And finally, that stuff is displayes in a custom widget (with a blinking icon if there’s a warning):
wetterwarnungen.widget.json (9.6 KB)
(for a preview please see my first link of this post)
So, have fun and if you have an improvement, I’d be happy if you share it