Anwendungsbeispiel JsonMod / Covid / 7-Tage-Inzidenz

Begonnen von herrmannj, 24 August 2020, 18:44:17

Vorheriges Thema - Nächstes Thema

khk123

FHEM6.2, RasPi4, RasPi Zero W,
CUL V3, HM, ZWave, IT, vcontrol, owntracks, alexa

yersinia

Anbei ein readingsList Update um die Booster-Impfungen mit anzuzeigen (einfach in dem Attribut readingList reinkopieren). Vorher die Bundesländer entsprechend anpassen - ich hab hier 01 und 02 genutzt.
Zitat von: yersinia am 24 Juni 2021, 15:49:50Es wird jetzt nach dem rs Wert gesucht und die Readings danach benannt. Einfach den rs Wert für das interessierte Bundesland einfügen:
01=Schleswig-Holstein
02=Hamburg
03=Niedersachsen
04=Bremen
05=Nordrhein-Westfalen
06=Hessen
07=Rheinland-Pfalz
08=Baden-Württemberg
09=Bayern
10=Saarland
11=Berlin
12=Brandenburg
13=Mecklenburg-Vorpommern
14=Sachsen
15=Sachsen-Anhalt
16=Thüringen

Der Endpoint liefert noch Daten für Bundesressorts (data[16]) sowie Deutschland (data[17]) welche keinen rs Wert haben - diese sind im readingList unten angehängt.
single(jsonPath('$.lastUpdate'), 'lastUpdate', '-?-');
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_name'), property('name'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_inhabitants'), property('inhabitants'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_1st_dose_abs'), property('vaccinatedAtLeastOnce.doses'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_1st_dose_quote'), property('vaccinatedAtLeastOnce.quote'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_1st_dose_diff'), property('vaccinatedAtLeastOnce.differenceToThePreviousDay'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_1st_dose_vax_0_name'), property('fullyVaccinated.vaccine[0].name'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_1st_dose_vax_0_doses'), property('fullyVaccinated.vaccine[0].firstDoses'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_1st_dose_vax_1_name'), property('fullyVaccinated.vaccine[1].name'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_1st_dose_vax_1_doses'), property('fullyVaccinated.vaccine[1].firstDoses'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_1st_dose_vax_2_name'), property('fullyVaccinated.vaccine[2].name'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_1st_dose_vax_2_doses'), property('fullyVaccinated.vaccine[2].firstDoses'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_1st_dose_vax_3_name'), property('fullyVaccinated.vaccine[3].name'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_1st_dose_vax_3_doses'), property('fullyVaccinated.vaccine[3].firstDoses'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_2nd_dose_abs'), property('fullyVaccinated.doses'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_2nd_dose_quote'), property('fullyVaccinated.quote'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_2nd_dose_diff'), property('fullyVaccinated.differenceToThePreviousDay'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_2nd_dose_vax_0_name'), property('fullyVaccinated.vaccine[0].name'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_2nd_dose_vax_0_doses'), property('fullyVaccinated.vaccine[0].secondDoses'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_2nd_dose_vax_1_name'), property('fullyVaccinated.vaccine[1].name'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_2nd_dose_vax_1_doses'), property('fullyVaccinated.vaccine[1].secondDoses'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_2nd_dose_vax_2_name'), property('fullyVaccinated.vaccine[2].name'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_2nd_dose_vax_2_doses'), property('fullyVaccinated.vaccine[2].secondDoses'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_2nd_dose_vax_3_name'), property('fullyVaccinated.vaccine[3].name'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_2nd_dose_vax_3_doses'), property('fullyVaccinated.vaccine[3].secondDoses'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_3rd_dose_abs'), property('boosterVaccinated.doses'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_3rd_dose_quote'), property('boosterVaccinated.quote'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_3rd_dose_diff'), property('boosterVaccinated.differenceToThePreviousDay'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_3rd_dose_vax_0_name'), property('boosterVaccinated.vaccine[0].name'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_3rd_dose_vax_0_doses'), property('boosterVaccinated.vaccine[0].boosterDoses'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_3rd_dose_vax_1_name'), property('boosterVaccinated.vaccine[1].name'));
multi(jsonPath("\$.data[?(\@.rs in ['01', 02'])]"), concat(property('rs'),'_3rd_dose_vax_1_doses'), property('boosterVaccinated.vaccine[1].boosterDoses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_name'), property('name'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_inhabitants'), property('inhabitants'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_1st_dose_abs'), property('vaccinatedAtLeastOnce.doses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_1st_dose_quote'), property('vaccinatedAtLeastOnce.quote'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_1st_dose_diff'), property('vaccinatedAtLeastOnce.differenceToThePreviousDay'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_1st_dose_vax_0_name'), property('fullyVaccinated.vaccine[0].name'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_1st_dose_vax_0_doses'), property('fullyVaccinated.vaccine[0].firstDoses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_1st_dose_vax_1_name'), property('bfullyVaccinated.vaccine[1].name'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_1st_dose_vax_1_doses'), property('fullyVaccinated.vaccine[1].firstDoses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_1st_dose_vax_2_name'), property('fullyVaccinated.vaccine[2].name'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_1st_dose_vax_2_doses'), property('fullyVaccinated.vaccine[2].firstDoses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_1st_dose_vax_3_name'), property('fullyVaccinated.vaccine[3].name'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_1st_dose_vax_3_doses'), property('fullyVaccinated.vaccine[3].firstDoses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_2nd_dose_abs'), property('fullyVaccinated.doses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_2nd_dose_quote'), property('fullyVaccinated.quote'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_2nd_dose_diff'), property('fullyVaccinated.differenceToThePreviousDay'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_2nd_dose_vax_0_name'), property('fullyVaccinated.vaccine[0].name'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_2nd_dose_vax_0_doses'), property('fullyVaccinated.vaccine[0].secondDoses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_2nd_dose_vax_1_name'), property('fullyVaccinated.vaccine[1].name'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_2nd_dose_vax_1_doses'), property('fullyVaccinated.vaccine[1].secondDoses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_2nd_dose_vax_2_name'), property('fullyVaccinated.vaccine[2].name'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_2nd_dose_vax_2_doses'), property('fullyVaccinated.vaccine[2].secondDoses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_2nd_dose_vax_3_name'), property('fullyVaccinated.vaccine[3].name'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_2nd_dose_vax_3_doses'), property('fullyVaccinated.vaccine[3].secondDoses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_3rd_dose_abs'), property('boosterVaccinated.doses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_3rd_dose_quote'), property('boosterVaccinated.quote'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_3rd_dose_diff'), property('boosterVaccinated.differenceToThePreviousDay'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_3rd_dose_vax_0_name'), property('boosterVaccinated.vaccine[0].name'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_3rd_dose_vax_0_doses'), property('boosterVaccinated.vaccine[0].secondDoses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_3rd_dose_vax_1_name'), property('boosterVaccinated.vaccine[1].name'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_3rd_dose_vax_1_doses'), property('boosterVaccinated.vaccine[1].secondDoses'));
viele Grüße, yersinia
----
FHEM 6.3 (SVN) on RPi 4B with RasPi OS Bullseye (perl 5.32.1) | FTUI
nanoCUL->2x868(1x ser2net)@tsculfw, 1x433@Sduino | MQTT2 | Tasmota | ESPEasy
VCCU->14xSEC-SCo, 7xCC-RT-DN, 5xLC-Bl1PBU-FM, 3xTC-IT-WM-W-EU, 1xPB-2-WM55, 1xLC-Sw1PBU-FM, 1xES-PMSw1-Pl

yersinia

Aus einem anderen Thread:
Zitat von: yersinia am 02 Dezember 2021, 11:26:04
Zitat von: JoWiemann am 01 Dezember 2021, 19:29:30warum neu erfinden, wenn schon da: https://forum.fhem.de/index.php/topic,113798.msg1188775.html#msg1188775 und folgende Posts.
Zitat von: TWART016 am 01 Dezember 2021, 23:56:25Das sind leider ganz andere Daten. Mit dem Format bekomme ich auch keine Werte.
Die sind doch nur nach Landkreis aufgesplittet, was viele Daten mit sich bringt. Daher ist die Query schon auf BW eingeschränkt. In dem Beispiel von Mickey sogar auf den LK Göttingen. Das macht das JSON wesentlich kleiner und ist einfacher zu verarbeiten. Man kann das auch auf BL einschränken.
Anbei ein RAW welches alle BL abruft, aber sich auf die BL einschränken lässt.
defmod IntensivRKI JsonMod https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/DIVI_Intensivregister_Landkreise/FeatureServer/0/query?where=BL_ID%3E0&outFields=AGS,BL,BL_ID,county,anzahl_standorte,anzahl_meldebereiche,betten_frei,betten_belegt,betten_gesamt,Anteil_betten_frei,faelle_covid_aktuell,faelle_covid_aktuell_beatmet,Anteil_covid_beatmet,Anteil_COVID_betten&returnGeometry=false&f=json
attr IntensivRKI readingList multi(jsonPath("\$.features.[?(\@.attributes.BL_ID in ['8'])]"), concat(property('.attributes.AGS'),'_county'), property('.attributes.county'));;\
multi(jsonPath("\$.features.[?(\@.attributes.BL_ID in ['8'])]"), concat(property('.attributes.AGS'),'_anzahl_standorte'), property('.attributes.anzahl_standorte'));;\
multi(jsonPath("\$.features.[?(\@.attributes.BL_ID in ['8'])]"), concat(property('.attributes.AGS'),'_anzahl_meldebereiche'), property('.attributes.anzahl_meldebereiche'));;\
multi(jsonPath("\$.features.[?(\@.attributes.BL_ID in ['8'])]"), concat(property('.attributes.AGS'),'_betten_frei'), property('.attributes.betten_frei'));;\
multi(jsonPath("\$.features.[?(\@.attributes.BL_ID in ['8'])]"), concat(property('.attributes.AGS'),'_betten_belegt'), property('.attributes.betten_belegt'));;\
multi(jsonPath("\$.features.[?(\@.attributes.BL_ID in ['8'])]"), concat(property('.attributes.AGS'),'_betten_gesamt'), property('.attributes.betten_gesamt'));;\
multi(jsonPath("\$.features.[?(\@.attributes.BL_ID in ['8'])]"), concat(property('.attributes.AGS'),'_Anteil_betten_frei'), property('.attributes.Anteil_betten_frei'));;\
multi(jsonPath("\$.features.[?(\@.attributes.BL_ID in ['8'])]"), concat(property('.attributes.AGS'),'_faelle_covid_aktuell'), property('.attributes.faelle_covid_aktuell'));;\
multi(jsonPath("\$.features.[?(\@.attributes.BL_ID in ['8'])]"), concat(property('.attributes.AGS'),'_faelle_covid_aktuell_beatmet'), property('.attributes.faelle_covid_aktuell_beatmet'));;\
multi(jsonPath("\$.features.[?(\@.attributes.BL_ID in ['8'])]"), concat(property('.attributes.AGS'),'_Anteil_covid_beatmet'), property('.attributes.Anteil_covid_beatmet'));;\
multi(jsonPath("\$.features.[?(\@.attributes.BL_ID in ['8'])]"), concat(property('.attributes.AGS'),'_Anteil_COVID_betten'), property('.attributes.Anteil_COVID_betten'));;
attr IntensivRKI update-on-start 0
attr IntensivRKI interval 0 12 * * *
attr IntensivRKI webCmd reread

Dabei sind die BL_IDs:
1 = Schleswig-Holstein
2 = Hamburg
3 = Niedersachsen
4 = Bremen
5 = Nordrhein-Westfalen
6 = Hessen
7 = Rheinland-Pfalz
8 = Baden-Württemberg
9 = Bayern
10 = Saarland
11 = Berlin
12 = Brandenburg
13 = Mecklenburg-Vorpommern
14 = Sachsen
15 = Sachsen-Anhalt
16 = Thüringen

Interessiert man sich nur für vereinzelte Landkreise, würde ich nach dem AGS suchen und filtern:
defmod IntensivRKI JsonMod https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/DIVI_Intensivregister_Landkreise/FeatureServer/0/query?where=BL_ID%3E0&outFields=AGS,BL,BL_ID,county,anzahl_standorte,anzahl_meldebereiche,betten_frei,betten_belegt,betten_gesamt,Anteil_betten_frei,faelle_covid_aktuell,faelle_covid_aktuell_beatmet,Anteil_covid_beatmet,Anteil_COVID_betten&returnGeometry=false&f=json
attr IntensivRKI interval 0 12 * * *
attr IntensivRKI readingList multi(jsonPath("\$.features.[?(\@.attributes.AGS in ['08117', '08118'])]"), concat(property('.attributes.AGS'),'_county'), property('.attributes.county'));;\
multi(jsonPath("\$.features.[?(\@.attributes.AGS in ['08117', '08118'])]"), concat(property('.attributes.AGS'),'_BL'), property('.attributes.BL'));;\
multi(jsonPath("\$.features.[?(\@.attributes.AGS in ['08117', '08118'])]"), concat(property('.attributes.AGS'),'_anzahl_standorte'), property('.attributes.anzahl_standorte'));;\
multi(jsonPath("\$.features.[?(\@.attributes.AGS in ['08117', '08118'])]"), concat(property('.attributes.AGS'),'_anzahl_meldebereiche'), property('.attributes.anzahl_meldebereiche'));;\
multi(jsonPath("\$.features.[?(\@.attributes.AGS in ['08117', '08118'])]"), concat(property('.attributes.AGS'),'_betten_frei'), property('.attributes.betten_frei'));;\
multi(jsonPath("\$.features.[?(\@.attributes.AGS in ['08117', '08118'])]"), concat(property('.attributes.AGS'),'_betten_belegt'), property('.attributes.betten_belegt'));;\
multi(jsonPath("\$.features.[?(\@.attributes.AGS in ['08117', '08118'])]"), concat(property('.attributes.AGS'),'_betten_gesamt'), property('.attributes.betten_gesamt'));;\
multi(jsonPath("\$.features.[?(\@.attributes.AGS in ['08117', '08118'])]"), concat(property('.attributes.AGS'),'_Anteil_betten_frei'), property('.attributes.Anteil_betten_frei'));;\
multi(jsonPath("\$.features.[?(\@.attributes.AGS in ['08117', '08118'])]"), concat(property('.attributes.AGS'),'_faelle_covid_aktuell'), property('.attributes.faelle_covid_aktuell'));;\
multi(jsonPath("\$.features.[?(\@.attributes.AGS in ['08117', '08118'])]"), concat(property('.attributes.AGS'),'_faelle_covid_aktuell_beatmet'), property('.attributes.faelle_covid_aktuell_beatmet'));;\
multi(jsonPath("\$.features.[?(\@.attributes.AGS in ['08117', '08118'])]"), concat(property('.attributes.AGS'),'_Anteil_covid_beatmet'), property('.attributes.Anteil_covid_beatmet'));;\
multi(jsonPath("\$.features.[?(\@.attributes.AGS in ['08117', '08118'])]"), concat(property('.attributes.AGS'),'_Anteil_COVID_betten'), property('.attributes.Anteil_COVID_betten'));;
attr IntensivRKI update-on-start 0
attr IntensivRKI webCmd reread

Die AGS müssen einmal mühsam aus der Quelle rausgesucht werden.
viele Grüße, yersinia
----
FHEM 6.3 (SVN) on RPi 4B with RasPi OS Bullseye (perl 5.32.1) | FTUI
nanoCUL->2x868(1x ser2net)@tsculfw, 1x433@Sduino | MQTT2 | Tasmota | ESPEasy
VCCU->14xSEC-SCo, 7xCC-RT-DN, 5xLC-Bl1PBU-FM, 3xTC-IT-WM-W-EU, 1xPB-2-WM55, 1xLC-Sw1PBU-FM, 1xES-PMSw1-Pl

TWART016

Zitat von: yersinia am 02 Dezember 2021, 11:32:11
Aus einem anderen Thread:Die sind doch nur nach Landkreis aufgesplittet, was viele Daten mit sich bringt. Daher ist die Query schon auf BW eingeschränkt. In dem Beispiel von Mickey sogar auf den LK Göttingen. Das macht das JSON wesentlich kleiner und ist einfacher zu verarbeiten. Man kann das auch auf BL einschränken.
Das meine ich damit nicht. Die Datenquelle gibt die Anzahl nicht her, deshalb wollte ich eine andere nehmen.

yersinia

Zitat von: TWART016 am 04 Dezember 2021, 00:34:43Die Datenquelle gibt die Anzahl nicht her, deshalb wollte ich eine andere nehmen.
Die Anzahl von was? Deine Quelle gibt an - jds interpretiere ich das so - wieviel CoViD-Patienten in einem Bundesland auf der Intensivstation betreut werden. Aber detaillierter gibt es die Zahlen nicht.
Mickeys Quelle gibt die Auslastung der Intensivstationen der Landkreise aus - inklusive CoViD-Patienten und wieviel davon beatmet werden. Aber natürlich nicht aufaddiert.

Imho ist das Anwendungsfall abhängig, was man sehen möchte. Auf die Zahlen verlassen würde ich mich allerdings nicht - bei keinen der beiden Quellen.
viele Grüße, yersinia
----
FHEM 6.3 (SVN) on RPi 4B with RasPi OS Bullseye (perl 5.32.1) | FTUI
nanoCUL->2x868(1x ser2net)@tsculfw, 1x433@Sduino | MQTT2 | Tasmota | ESPEasy
VCCU->14xSEC-SCo, 7xCC-RT-DN, 5xLC-Bl1PBU-FM, 3xTC-IT-WM-W-EU, 1xPB-2-WM55, 1xLC-Sw1PBU-FM, 1xES-PMSw1-Pl

TWART016

Zitat von: yersinia am 05 Dezember 2021, 14:45:40
Die Anzahl von was? Deine Quelle gibt an - jds interpretiere ich das so - wieviel CoViD-Patienten in einem Bundesland auf der Intensivstation betreut werden. Aber detaillierter gibt es die Zahlen nicht.
Mickeys Quelle gibt die Auslastung der Intensivstationen der Landkreise aus - inklusive CoViD-Patienten und wieviel davon beatmet werden. Aber natürlich nicht aufaddiert.

Imho ist das Anwendungsfall abhängig, was man sehen möchte. Auf die Zahlen verlassen würde ich mich allerdings nicht - bei keinen der beiden Quellen.
Ich traue den Daten auch nicht. Nur werden nach den Zahlen die Regelungen gemacht.

Gueco315

@Mickey: Wie bekomme ich die Daten für einen anderen Standort aus der URL?
https://services7.arcgis.com/.....

Dank und Gruß
Günter
Fhem 6.0, JeeLink, CUL 868 auf Raspi 4, Buster, IT-1500, 4x SB_Player, Squeezebox auf Raspi 4, 3x Fritzbox,  WIFI Light, EGPM2LAN, ENIGMA, Sec-SCO,CC-RT-DN,TC-IT-WM-W-EU,SEN-Wa-Od,ES-PMSw1-PW,HM-SE, Sonoff, Shelly,SMA

Gisbert

Hallo zusammen,

Diese Seite liefert keine Infos mehr:
https://rki-vaccination-data.vercel.app/api/v2

Gibt es Alternativen oder sonstige Abhilfen?

Viele​ Grüße​ Gisbert​
Aktuelles FHEM | PROXMOX | Fujitsu Futro S740 | Debian 12 | UniFi | Homematic, VCCU, HMUART | ESP8266 | ATtiny85 | Wasser-, Stromzähler | Wlan-Kamera | SIGNALduino, Flamingo Rauchmelder FA21/22RF | RHASSPY

yersinia

Zitat von: Gisbert am 18 Januar 2022, 19:39:24Gibt es Alternativen oder sonstige Abhilfen?
Ich würd' mal ein paar Tage warten, weil
Zitat{"message": "scrapping data from RKI excel failed"}
https://rki-vaccination-data.vercel.app/api/v2
viele Grüße, yersinia
----
FHEM 6.3 (SVN) on RPi 4B with RasPi OS Bullseye (perl 5.32.1) | FTUI
nanoCUL->2x868(1x ser2net)@tsculfw, 1x433@Sduino | MQTT2 | Tasmota | ESPEasy
VCCU->14xSEC-SCo, 7xCC-RT-DN, 5xLC-Bl1PBU-FM, 3xTC-IT-WM-W-EU, 1xPB-2-WM55, 1xLC-Sw1PBU-FM, 1xES-PMSw1-Pl

yersinia

#159
Impfquoten-readingList-Update, da novavax als Impfstoff und Janssen als Booster hinzugekommen sind:
single(jsonPath('$.lastUpdate'), 'lastUpdate', '-?-');
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_name'), property('name'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_inhabitants'), property('inhabitants'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_1st_dose_abs'), property('vaccinatedAtLeastOnce.doses'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_1st_dose_quote'), property('vaccinatedAtLeastOnce.quote'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_1st_dose_diff'), property('vaccinatedAtLeastOnce.differenceToThePreviousDay'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_1st_dose_vax_0_name'), property('fullyVaccinated.vaccine[0].name'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_1st_dose_vax_0_doses'), property('fullyVaccinated.vaccine[0].firstDoses'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_1st_dose_vax_1_name'), property('fullyVaccinated.vaccine[1].name'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_1st_dose_vax_1_doses'), property('fullyVaccinated.vaccine[1].firstDoses'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_1st_dose_vax_2_name'), property('fullyVaccinated.vaccine[2].name'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_1st_dose_vax_2_doses'), property('fullyVaccinated.vaccine[2].firstDoses'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_1st_dose_vax_3_name'), property('fullyVaccinated.vaccine[3].name'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_1st_dose_vax_3_doses'), property('fullyVaccinated.vaccine[3].firstDoses'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_1st_dose_vax_4_name'), property('fullyVaccinated.vaccine[4].name'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_1st_dose_vax_4_doses'), property('fullyVaccinated.vaccine[4].firstDoses'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_2nd_dose_abs'), property('fullyVaccinated.doses'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_2nd_dose_quote'), property('fullyVaccinated.quote'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_2nd_dose_diff'), property('fullyVaccinated.differenceToThePreviousDay'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_2nd_dose_vax_0_name'), property('fullyVaccinated.vaccine[0].name'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_2nd_dose_vax_0_doses'), property('fullyVaccinated.vaccine[0].secondDoses'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_2nd_dose_vax_1_name'), property('fullyVaccinated.vaccine[1].name'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_2nd_dose_vax_1_doses'), property('fullyVaccinated.vaccine[1].secondDoses'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_2nd_dose_vax_2_name'), property('fullyVaccinated.vaccine[2].name'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_2nd_dose_vax_2_doses'), property('fullyVaccinated.vaccine[2].secondDoses'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_2nd_dose_vax_3_name'), property('fullyVaccinated.vaccine[3].name'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_2nd_dose_vax_3_doses'), property('fullyVaccinated.vaccine[3].secondDoses'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_2nd_dose_vax_4_name'), property('fullyVaccinated.vaccine[4].name'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_2nd_dose_vax_4_doses'), property('fullyVaccinated.vaccine[4].secondDoses'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_3rd_dose_abs'), property('boosterVaccinated.doses'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_3rd_dose_quote'), property('boosterVaccinated.quote'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_3rd_dose_diff'), property('boosterVaccinated.differenceToThePreviousDay'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_3rd_dose_vax_0_name'), property('boosterVaccinated.vaccine[0].name'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_3rd_dose_vax_0_doses'), property('boosterVaccinated.vaccine[0].boosterDoses'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_3rd_dose_vax_1_name'), property('boosterVaccinated.vaccine[1].name'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_3rd_dose_vax_1_doses'), property('boosterVaccinated.vaccine[1].boosterDoses'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_3rd_dose_vax_2_name'), property('boosterVaccinated.vaccine[2].name'));
multi(jsonPath("\$.data[?(\@.rs in ['07', '08'])]"), concat(property('rs'),'_3rd_dose_vax_2_doses'), property('boosterVaccinated.vaccine[2].boosterDoses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_name'), property('name'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_inhabitants'), property('inhabitants'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_1st_dose_abs'), property('vaccinatedAtLeastOnce.doses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_1st_dose_quote'), property('vaccinatedAtLeastOnce.quote'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_1st_dose_diff'), property('vaccinatedAtLeastOnce.differenceToThePreviousDay'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_1st_dose_vax_0_name'), property('fullyVaccinated.vaccine[0].name'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_1st_dose_vax_0_doses'), property('fullyVaccinated.vaccine[0].firstDoses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_1st_dose_vax_1_name'), property('fullyVaccinated.vaccine[1].name'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_1st_dose_vax_1_doses'), property('fullyVaccinated.vaccine[1].firstDoses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_1st_dose_vax_2_name'), property('fullyVaccinated.vaccine[2].name'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_1st_dose_vax_2_doses'), property('fullyVaccinated.vaccine[2].firstDoses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_1st_dose_vax_3_name'), property('fullyVaccinated.vaccine[3].name'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_1st_dose_vax_3_doses'), property('fullyVaccinated.vaccine[3].firstDoses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_1st_dose_vax_4_name'), property('fullyVaccinated.vaccine[4].name'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_1st_dose_vax_4_doses'), property('fullyVaccinated.vaccine[4].firstDoses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_2nd_dose_abs'), property('fullyVaccinated.doses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_2nd_dose_quote'), property('fullyVaccinated.quote'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_2nd_dose_diff'), property('fullyVaccinated.differenceToThePreviousDay'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_2nd_dose_vax_0_name'), property('fullyVaccinated.vaccine[0].name'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_2nd_dose_vax_0_doses'), property('fullyVaccinated.vaccine[0].secondDoses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_2nd_dose_vax_1_name'), property('fullyVaccinated.vaccine[1].name'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_2nd_dose_vax_1_doses'), property('fullyVaccinated.vaccine[1].secondDoses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_2nd_dose_vax_2_name'), property('fullyVaccinated.vaccine[2].name'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_2nd_dose_vax_2_doses'), property('fullyVaccinated.vaccine[2].secondDoses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_2nd_dose_vax_3_name'), property('fullyVaccinated.vaccine[3].name'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_2nd_dose_vax_3_doses'), property('fullyVaccinated.vaccine[3].secondDoses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_2nd_dose_vax_4_name'), property('fullyVaccinated.vaccine[4].name'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_2nd_dose_vax_4_doses'), property('fullyVaccinated.vaccine[4].secondDoses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_3rd_dose_abs'), property('boosterVaccinated.doses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_3rd_dose_quote'), property('boosterVaccinated.quote'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_3rd_dose_diff'), property('boosterVaccinated.differenceToThePreviousDay'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_3rd_dose_vax_0_name'), property('boosterVaccinated.vaccine[0].name'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_3rd_dose_vax_0_doses'), property('boosterVaccinated.vaccine[0].boosterDoses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_3rd_dose_vax_1_name'), property('boosterVaccinated.vaccine[1].name'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_3rd_dose_vax_1_doses'), property('boosterVaccinated.vaccine[1].boosterDoses'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_3rd_dose_vax_2_name'), property('boosterVaccinated.vaccine[2].name'));
multi(jsonPath("\$.data[?(\@.name in ['Deutschland', 'Bundesressorts'])]"), concat(property('name'),'_3rd_dose_vax_2_doses'), property('boosterVaccinated.vaccine[2].boosterDoses'));

Siehe auch post #151 und post #99.

EDIT 2022-03-18: Typo gefixt und Impfdaten für die Booster hatten das falsche Reading  ::)
viele Grüße, yersinia
----
FHEM 6.3 (SVN) on RPi 4B with RasPi OS Bullseye (perl 5.32.1) | FTUI
nanoCUL->2x868(1x ser2net)@tsculfw, 1x433@Sduino | MQTT2 | Tasmota | ESPEasy
VCCU->14xSEC-SCo, 7xCC-RT-DN, 5xLC-Bl1PBU-FM, 3xTC-IT-WM-W-EU, 1xPB-2-WM55, 1xLC-Sw1PBU-FM, 1xES-PMSw1-Pl

yersinia

#160
Es scheint so, als stände die API für die Impfdaten via vercel.app längerfristig nicht mehr zur Verfügung:
Zitat404: NOT_FOUND
Code: DEPLOYMENT_NOT_FOUND

Dankenswerterweise stellt ein gewisser Marlon Lueckert eine api für die Impfdaten zur Verfügung. Diese Daten lassen sich dann via JsonMod in FHEM einbinden.

Im FHEMWEB nutze ich eine tabellarische Ansicht der Daten der Bundesländer (nur jene, die mich interessieren). Bei einem Klick auf die Zeile des Bundeslandes öffnet sich eine Detailansicht der dazugehörigen verabreichten Impfstoffe (ein weiterer Klick auf die Detailansicht schließt diese wieder).
Das JsonMod Device holt alle Daten, die Anzeige Bundesländer werden nur im stateFormat eingeschränkt:
my @objects = ("BB","HH");
Hier einfach die Codes der Bundesländer abändern/erweitern welche euch interessieren - valide Codes sind: SH, HH, NI, HB, NW, HE, RP, BW, BY, SL, BE, BB, MV, SN, ST, TH, Bund.
Die Werte für Deutschland gesamt werden als letzte Zeile einfach angehängt.

RAW-Def:
defmod coronaVaxRKIv3 JsonMod https://api.corona-zahlen.org/vaccinations
attr coronaVaxRKIv3 interval 12 12 * * *
attr coronaVaxRKIv3 readingList complete();;
attr coronaVaxRKIv3 stateFormat { my @objects = ("BB","HH");;\
my @vaxines = ("biontech","biontechBivalent","moderna","modernaBivalent","astraZeneca","janssen","novavax","valneva");;;\
my $cellstyle = "padding:3pt;;border-bottom:1px dotted lightgray;;text-align: right;;";;\
my $highlightcolor = "DarkSlateGray";; #DodgerBlue";;\
my $ret = "<div style=\"text-align: left;;\">";;\
$ret .= "<a href=\"https://impfdashboard.de\" target=\"blank\">ImpfDashboard</a> last check => ";;\
$ret .= POSIX::strftime("%d.%m. %H:%M",localtime(time_str2num(ReadingsTimestamp($name,".computedReadings","2000-01-01 00:00:00"))));;\
$ret .= "<br \/>";;\
$ret .= '<div style="display:table;;width:100%;;">';;\
$ret .= '<div style="display:table-row;;">';;\
  $ret .= '<div style="display:table-cell;;'.$cellstyle.'width:30%;;font-weight:bold;;">&nbsp;;</div>';;\
  $ret .= '<div style="display:table-cell;;'.$cellstyle.'width:12.5%;;font-weight:bold;;">1. Dosis</div>';;\
  $ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;font-weight:bold;;">&nbsp;;</div>';;\
  $ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;font-weight:bold;;">&nbsp;;</div>';;\
  $ret .= '<div style="display:table-cell;;'.$cellstyle.'width:12.5%;;font-weight:bold;;">2. Dosis</div>';;\
  $ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;font-weight:bold;;">&nbsp;;</div>';;\
  $ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;font-weight:bold;;">&nbsp;;</div>';;\
  $ret .= '<div style="display:table-cell;;'.$cellstyle.'width:12.5%;;font-weight:bold;;">3. Dosis</div>';;\
  $ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;font-weight:bold;;">&nbsp;;</div>';;\
  $ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;font-weight:bold;;">&nbsp;;</div>';;\
  $ret .= '<div style="display:table-cell;;'.$cellstyle.'width:12.5%;;font-weight:bold;;">4. Dosis</div>';;\
  $ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;font-weight:bold;;">&nbsp;;</div>';;\
  $ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;font-weight:bold;;">&nbsp;;</div>';;\
$ret .= '</div>';; #header\
foreach my $obj (@objects) {\
$ret .= '<div style="display:table-row;;" onmouseover="this.style.background=\''.$highlightcolor.'\';;" ';;\
$ret .= 'onmouseout="this.style.background=\'transparent\';;" ';;\
$ret .= 'onclick="document.getElementById(\''.$obj.'_vaxs\').style.display=\'table-row-group\';;">';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:30%;;">';;\
$ret .= ReadingsVal($name,"data.states.".$obj.".name","-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:12.5%;;">';;\
$ret .= ReadingsVal($name,"data.states.".$obj.".vaccinated","-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= (ReadingsNum($name,"data.states.".$obj.".quote",0) * 100)."%";;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= "+".ReadingsVal($name,"data.states.".$obj.".delta","-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:12.5%;;">';;\
$ret .= ReadingsVal($name,"data.states.".$obj.".secondVaccination.vaccinated","-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= (ReadingsNum($name,"data.states.".$obj.".secondVaccination.quote",0) * 100)."%";;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= "+".ReadingsVal($name,"data.states.".$obj.".secondVaccination.delta","-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:12.5%;;">';;\
$ret .= ReadingsVal($name,"data.states.".$obj.".boosterVaccination.vaccinated","-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= (ReadingsNum($name,"data.states.".$obj.".boosterVaccination.quote",0) * 100)."%";;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= "+".ReadingsVal($name,"data.states.".$obj.".boosterVaccination.delta","-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:12.5%;;">';;\
$ret .= ReadingsVal($name,"data.states.".$obj.".2ndBoosterVaccination.vaccinated","-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= (ReadingsNum($name,"data.states.".$obj.".2ndBoosterVaccination.quote",0) * 100)."%";;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= "+".ReadingsVal($name,"data.states.".$obj.".2ndBoosterVaccination.delta","-");;\
$ret .= '</div>';;\
$ret .= '</div>';;\
$ret .= '<span style="display: none;;" id="'.$obj.'_vaxs" ';;\
$ret .= 'onclick="document.getElementById(\''.$obj.'_vaxs\').style.display=\'none\';;">';;\
foreach my $vaxs (@vaxines) {\
$ret .= '<div style="display:table-row;; visibility: inherit;;" ';;\
$ret .= 'onmouseover="this.style.background=\'steelblue\';;" ';;\
$ret .= 'onmouseout="this.style.background=\'transparent\';;">';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:30%;;">';;\
$ret .= ucfirst($vaxs);;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:12.5%;;">';;\
$ret .= ReadingsVal($name,"data.states.".$obj.".vaccination.".$vaxs,"-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= "&nbsp;;";;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= "+".ReadingsVal($name,"data.states.".$obj.".vaccination.delta".ucfirst($vaxs),"-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:12.5%;;">';;\
$ret .= ReadingsVal($name,"data.states.".$obj.".secondVaccination.vaccination.".$vaxs,"-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= "&nbsp;;";;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= "+".ReadingsVal($name,"data.states.".$obj.".secondVaccination.vaccination.delta".ucfirst($vaxs),"-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:12.5%;;">';;\
$ret .= ReadingsVal($name,"data.states.".$obj.".boosterVaccination.vaccination.".$vaxs,"-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= "&nbsp;;";;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= "+".ReadingsVal($name,"data.states.".$obj.".boosterVaccination.vaccination.delta".ucfirst($vaxs),"-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:12.5%;;">';;\
$ret .= ReadingsVal($name,"data.states.".$obj.".2ndBoosterVaccination.vaccination.".$vaxs,"-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= "&nbsp;;";;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= "+".ReadingsVal($name,"data.states.".$obj.".2ndBoosterVaccination.vaccination.delta".ucfirst($vaxs),"-");;\
$ret .= '</div>';;\
$ret .= '</div>';;\
}\
$ret .= '</span>';;\
}\
    # Deutschland\
$ret .= '<div style="display:table-row;;" onmouseover="this.style.background=\''.$highlightcolor.'\';;" ';;\
$ret .= 'onmouseout="this.style.background=\'transparent\';;" ';;\
$ret .= 'onclick="document.getElementById(\'DE_vaxs\').style.display=\'table-row-group\';;">';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:30%;;">';;\
#$ret .= ReadingsVal($name,"data.states.".$obj.".name","-");;\
                $ret .= "Deutschland";;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:12.5%;;">';;\
$ret .= ReadingsVal($name,"data.vaccinated","-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= (ReadingsNum($name,"data.quote",0) * 100)."%";;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= "+".ReadingsVal($name,"data.delta","-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:12.5%;;">';;\
$ret .= ReadingsVal($name,"data.secondVaccination.vaccinated","-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= (ReadingsNum($name,"data.secondVaccination.quote",0) * 100)."%";;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= "+".ReadingsVal($name,"data.secondVaccination.delta","-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:12.5%;;">';;\
$ret .= ReadingsVal($name,"data.boosterVaccination.vaccinated","-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= (ReadingsNum($name,"data.boosterVaccination.quote",0) * 100)."%";;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= "+".ReadingsVal($name,"data.boosterVaccination.delta","-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:12.5%;;">';;\
$ret .= ReadingsVal($name,"data.2ndBoosterVaccination.vaccinated","-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= (ReadingsNum($name,"data.2ndBoosterVaccination.quote",0) * 100)."%";;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= "+".ReadingsVal($name,"data.2ndBoosterVaccination.delta","-");;\
$ret .= '</div>';;\
$ret .= '</div>';;\
$ret .= '<span style="display: none;;" id="DE_vaxs" ';;\
$ret .= 'onclick="document.getElementById(\'DE_vaxs\').style.display=\'none\';;">';;\
foreach my $vaxs (@vaxines) {\
$ret .= '<div style="display:table-row;; visibility: inherit;;" ';;\
$ret .= 'onmouseover="this.style.background=\'steelblue\';;" ';;\
$ret .= 'onmouseout="this.style.background=\'transparent\';;">';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:30%;;">';;\
$ret .= ucfirst($vaxs);;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:12.5%;;">';;\
$ret .= ReadingsVal($name,"data.vaccination.".$vaxs,"-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= "&nbsp;;";;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= "+".ReadingsVal($name,"data.vaccination.delta".ucfirst($vaxs),"-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:12.5%;;">';;\
$ret .= ReadingsVal($name,"data.secondVaccination.vaccination.".$vaxs,"-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= "&nbsp;;";;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= "+".ReadingsVal($name,"data.secondVaccination.vaccination.delta".ucfirst($vaxs),"-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:12.5%;;">';;\
$ret .= ReadingsVal($name,"data.boosterVaccination.vaccination.".$vaxs,"-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= "&nbsp;;";;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= "+".ReadingsVal($name,"data.boosterVaccination.vaccination.delta".ucfirst($vaxs),"-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:12.5%;;">';;\
$ret .= ReadingsVal($name,"data.2ndBoosterVaccination.vaccination.".$vaxs,"-");;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= "&nbsp;;";;\
$ret .= '</div>';;\
$ret .= '<div style="display:table-cell;;'.$cellstyle.'width:2.5%;;">';;\
$ret .= "+".ReadingsVal($name,"data.2ndBoosterVaccination.vaccination.delta".ucfirst($vaxs),"-");;\
$ret .= '</div>';;\
$ret .= '</div>';;\
}\
$ret .= '</span>';;\
$ret .= '</div><br />';; #table\
$ret .= "Letzter API-Update-Check: ";;\
$ret .= ReadingsVal($name,"meta.lastUpdate","-");;\
$ret .= "</div>";;\
return $ret;;}
attr coronaVaxRKIv3 update-on-start 0
attr coronaVaxRKIv3 webCmd reread
viele Grüße, yersinia
----
FHEM 6.3 (SVN) on RPi 4B with RasPi OS Bullseye (perl 5.32.1) | FTUI
nanoCUL->2x868(1x ser2net)@tsculfw, 1x433@Sduino | MQTT2 | Tasmota | ESPEasy
VCCU->14xSEC-SCo, 7xCC-RT-DN, 5xLC-Bl1PBU-FM, 3xTC-IT-WM-W-EU, 1xPB-2-WM55, 1xLC-Sw1PBU-FM, 1xES-PMSw1-Pl

Jamo

#161
Hier mal ein JsonMod für den Gasstand in Deutschland (im RAW format).

defmod GasDE JsonMod https://agsi.gie.eu/api?country=de&from=2022-03-01&size=300 [KEY]
attr GasDE httpHeader x-key: [KEY]
attr GasDE readingList single(jsonPath('$.data[0].injection'),          'injection',          'N/A');;\
single(jsonPath('$.data[0].withdrawal'),         'withdrawal',         'N/A');;\
single(jsonPath('$.data[0].injectionCapacity'),  'injectionCapacity',  'N/A');;\
single(jsonPath('$.data[0].withdrawalCapacity'), 'withdrawalCapacity', 'N/A');;\
single(jsonPath('$.data[0].trend'),              'trend',              'N/A');;\
single(jsonPath('$.data[0].full'),               'percent',            'N/A');;
attr GasDE interval  0 7 * * *
attr GasDE stateFormat Prozent: percent %


Die API ist hier beschrieben: https://www.gie.eu/transparency-platform/GIE_API_documentation_v006.pdf

Den API Key bekommt man unter agsi.gie.eu/account. Der Zugang ist kostenlos und steht jedem offen, ist in der API Dokumentation so vermerkt.
Einzutragen dann mit (Der KEY ist natürlich falsch) set GasDE secret KEY kjd3fu6wte4bdqp789keqrryo
Bullseye auf iNUC, Homematic + HMIP(UART/HMUSB), Debmatic, HUEBridge, Zigbee/ConbeeII, FB, Alexa (fhem-lazy), Livetracking, LaCrosse JeeLink, LoRaWan / TTN / Chirpstack

Gisbert

Hallo Jamo,

echt toll, dass du diese Abfrage hier zur Verfügung stellst. Die Definition und die Anmeldung haben geklappt. Vielleicht sollte ich kurz erwähnen, dass "[KEY]" genauso in die Definition reingehört; ich dachte zuerst, dass anstelle des "[KEY]" der key reinkommt, den man bei der Registrierung bekommt.

Noch eine Frage, in welchem Intervall werden Daten abgerufen?

Viele​ Grüße​ Gisbert​
Aktuelles FHEM | PROXMOX | Fujitsu Futro S740 | Debian 12 | UniFi | Homematic, VCCU, HMUART | ESP8266 | ATtiny85 | Wasser-, Stromzähler | Wlan-Kamera | SIGNALduino, Flamingo Rauchmelder FA21/22RF | RHASSPY

Jamo

#163
Da hat Jörg verschiedene Beispiele hier im Thread, das wird wie bei Crontab eingestellt, habs oben ergänzt. Z.B. der Update immer morgens um 7:00:
attr GasDE interval  0 7 * * *
Bullseye auf iNUC, Homematic + HMIP(UART/HMUSB), Debmatic, HUEBridge, Zigbee/ConbeeII, FB, Alexa (fhem-lazy), Livetracking, LaCrosse JeeLink, LoRaWan / TTN / Chirpstack

yersinia

Für die Impfdaten mit dem Beispiel von #160 gibt es nun mehr Impfstoffe (Valneva, Biontech (Bivalent) und Moderna (Bivalent)); um diese im stateFormat auch anzeigen zu lassen einfach diese Zeile
my @vaxines = ("biontech","moderna","astraZeneca","janssen","novavax");
erweitern:
my @vaxines = ("biontech","moderna","astraZeneca","janssen","novavax","valneva","biontechBivalent","modernaBivalent");
viele Grüße, yersinia
----
FHEM 6.3 (SVN) on RPi 4B with RasPi OS Bullseye (perl 5.32.1) | FTUI
nanoCUL->2x868(1x ser2net)@tsculfw, 1x433@Sduino | MQTT2 | Tasmota | ESPEasy
VCCU->14xSEC-SCo, 7xCC-RT-DN, 5xLC-Bl1PBU-FM, 3xTC-IT-WM-W-EU, 1xPB-2-WM55, 1xLC-Sw1PBU-FM, 1xES-PMSw1-Pl