Smart Home openHAB Installation Sonderbeitrag 2020 – COVID-19
Update 12.11.2020
Ab Dezember 2020 habe ich das Glück, ein Eigenheim zu besitzen. Mit dem Umzug werde ich mein Smart Home zukünftig mit Home Assistant steuern, sodass die Serie Smart Home openHAB Installation nicht länger fortgeführt und gepflegt wird.
Auf die COVID-19 Pandemie 2020 hat auch die openHAB Community sehr schnell reagiert und ein Binding zur Verfügung gestellt, um Infektionsstatistiken weltweit und pro Land in openHAB ausgeben zu lassen. Da dieses Binding nicht spezielle Smart Home Funktionen darstellt und COVID-19 auch hoffentlich kein permanentes Phänomen darstellt, erläutere ich dieses Binding nicht als expliziten Teil meiner Smart Home Reihe, sondern als „Sonderbeitrag“.
Binding: CoronaStats
Für die Nutzung des CoronaStats Bindings ist bei mir vorab folgende Firewall Regel erforderlich:
Source: openHAB-Server Destination: corona-stats.online Port: TCP/443
Danach kann das Binding konfiguriert werden.
$OPENHAB_CONF$/things/coronastats.things
Die Binding .things-Datei besteht hierbei aus einer Bridge, welche die weltweiten Statistiken darstellen, und aus Things für jedes einzelne Land, welches man abfragen möchte. Das Land wird dabei durch den ISO Country-Code identifiziert.
Im folgenden Beispiel möchte ich die weltweiten Daten, sowie die Daten für Deutschland.
Bridge coronastats:world:stats "CoronaStats: COVID-19 Statistics Worldwide" @ "Internet" [refresh=15] { Thing country germany "CoronaStats: COVID-19 Statistics Germany" @ "Internet" [countryCode="DE"] }
$OPENHAB_CONF$/items/coronastats.items
Sind die Things konfiguriert, geht’s an die Items. Dabei gibt es für die Länder-Things einige Items mehr, als für die Welt-Bridge.
// CoronaStats: COVID-19 Statistics Worldwide Number:Dimensionless CoronaStats_Cases_World "CoronaStats: COVID-19 World Total Cases [%,d]" {channel="coronastats:world:stats:cases"} Number:Dimensionless CoronaStats_CasesToday_World "CoronaStats: COVID-19 World Total Cases Today [%,d]" {channel="coronastats:world:stats:today_cases"} Number:Dimensionless CoronaStats_Deaths_World "CoronaStats: COVID-19 World Deaths [%,d]" {channel="coronastats:world:stats:deaths"} Number:Dimensionless CoronaStats_DeathsToday_World "CoronaStats: COVID-19 World Deaths Today [%,d]" {channel="coronastats:world:stats:today_deaths"} Number:Dimensionless CoronaStats_Active_World "CoronaStats: COVID-19 World Active Cases [%,d]" {channel="coronastats:world:stats:active"} Number:Dimensionless CoronaStats_Recovered_World "CoronaStats: COVID-19 World Recovered Cases [%,d]" {channel="coronastats:world:stats:recovered"} Number:Dimensionless CoronaStats_Critical_World "CoronaStats: COVID-19 World Critical Cases [%,d]" {channel="coronastats:world:stats:critical"} // CoronaStats: COVID-19 Statistics Germany Number:Dimensionless CoronaStats_Cases_DE "CoronaStats: COVID-19 DE Total Cases [%,d]" {channel="coronastats:country:stats:germany:cases"} Number:Dimensionless CoronaStats_CasesToday_DE "CoronaStats: COVID-19 DE Total Cases Today [%,d]" {channel="coronastats:country:stats:germany:today_cases"} Number:Dimensionless CoronaStats_Deaths_DE "CoronaStats: COVID-19 DE Deaths [%,d]" {channel="coronastats:country:stats:germany:deaths"} Number:Dimensionless CoronaStats_DeathsToday_DE "CoronaStats: COVID-19 DE Deaths Today [%,d]" {channel="coronastats:country:stats:germany:today_deaths"} Number:Dimensionless CoronaStats_Recovered_DE "CoronaStats: COVID-19 Germany Recovered Cases [%,d]" {channel="coronastats:country:stats:germany:recovered"} Number:Dimensionless CoronaStats_Active_DE "CoronaStats: COVID-19 Germany Active Cases [%,d]" {channel="coronastats:country:stats:germany:active"} Number:Dimensionless CoronaStats_Critical_DE "CoronaStats: COVID-19 Germany Critical Cases [%,d]" {channel="coronastats:country:stats:germany:critical"} Number:Dimensionless CoronaStats_Tests_DE "CoronaStats: COVID-19 Germany Tests [%d]" {channel="coronastats:country:stats:germany:cases"} DateTime CoronaStats_Updated_DE "CoronaStats: COVID-19 Germany Updated [%1$td.%1$tm.%1$tY %1$tH:%1$tM]" {channel="coronastats:country:stats:germany:updated"}
$OPENHAB_CONF$/sitemaps/home.sitemap
Frame label="Sonstiges" { Text label="COVID-19 Statistik" icon="coronastats" { Frame label="Global" { Text item=CoronaStats_Cases_World label="Infektionen [%,d]" icon="coronastats" Text item=CoronaStats_Active_World label="Krankheitsfälle [%,d]" icon="coronastats" Text item=CoronaStats_Recovered_World label="Gesundungsfälle [%,d]" icon="coronastats" Text item=CoronaStats_Deaths_World label="Todesfälle [%,d]" icon="coronastats" } Frame label="Deutschland" { Text item=CoronaStats_Cases_DE label="Infektionen [%,d]" icon="coronastats" Text item=CoronaStats_Active_DE label="Krankheitsfälle [%,d]" icon="coronastats" Text item=CoronaStats_Recovered_DE label="Gesundungsfälle [%,d]" icon="coronastats" Text item=CoronaStats_Deaths_DE label="Todesfälle [%,d]" icon="coronastats" Text item=CoronaStats_Updated_DE label="Stand [%1$td.%1$tm.%1$tY %1$tH:%1$tM]" icon="time" } } }
Für das Corona Binding habe ich mir dann noch ein entsprechendes Icon coronastats.png
erstellt und im Ordner $OPENHAB_CONF$/icons/classic/ abgelegt
Quellen:
https://www.openhab.org/
Moin,
denke die Inzidenz ist auch interessant. Gerade im Hinblick auf Ausgangssperre und 15 KM Beschränkung.
-http Binding
-json Binding
Item:
Number CS_HH_Incidence „Covid19 Hamburg 7 Tages Inzidenz auf 100.000 [%d]“ {http=“<[https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_Landkreisdaten/FeatureServer/0/query?objectIds=16&returnGeometry=false&outFields=OBJECTID,county,cases7_per_100k,BL,last_update,GEN&outSR=4326&f=json:600000:JSONPATH($.features.[0].attributes.cases7_per_100k)]"}
Sitemap:
Text item=CS_HH_Incidence label="Hamburg [%,.0f]" icon="covid19"
Im Item nur die ID des Landkreises ändern, Liste hier:
https://npgeo-corona-npgeo-de.hub.arcgis.com/datasets/917fc37a709542548cc3be077a786c17_0/data?geometry=-30.805%2C46.211%2C52.823%2C55.839
Schöen Grüße
Simon
Quelle:
https://community.openhab.org/t/covid-information-examples/95419
Servus
Danke für dein Update, das mit der Inzidenz-Anzeige ist eine sinnvolle und hilfreiche Erweiterung.
Gruß
Andreas