Skip to content
  • Home
  • Aktuell
  • Tags
  • 0 Ungelesen 0
  • Kategorien
  • Unreplied
  • Beliebt
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Standard: (Kein Skin)
  • Kein Skin
Einklappen
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. JavaScript
  5. [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder

NEWS

  • UPDATE 31.10.: Amazon Alexa - ioBroker Skill läuft aus ?
    apollon77A
    apollon77
    48
    3
    8.9k

  • Monatsrückblick – September 2025
    BluefoxB
    Bluefox
    13
    1
    2.3k

  • Neues Video "KI im Smart Home" - ioBroker plus n8n
    BluefoxB
    Bluefox
    16
    1
    3.4k

[Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder

Geplant Angeheftet Gesperrt Verschoben JavaScript
31 Beiträge 7 Kommentatoren 2.9k Aufrufe 9 Watching
  • Älteste zuerst
  • Neuste zuerst
  • Meiste Stimmen
Antworten
  • In einem neuen Thema antworten
Anmelden zum Antworten
Dieses Thema wurde gelöscht. Nur Nutzer mit entsprechenden Rechten können es sehen.
  • sissiwupS sissiwup

    Hallo,

    da ich die Daten selber für mich immer gerne archiviere:

    getImpfquoten.py:

    import openpyxl
    from pathlib import Path
    import requests
    import os,sys
    import csv
    from datetime import datetime
    
    url = "https://www.rki.de/DE/Content/InfAZ/N/Neuartiges_Coronavirus/Daten/Impfquotenmonitoring.xlsx;jsessionid=159D4550C958EDFAA9A49921FA132A35.internet122?__blob=publicationFile"
    # url = "https://www.rki.de/DE/Content/InfAZ/N/Neuartiges_Coronavirus/Daten/Impfquotenmonitoring.xlsx"
    r = requests.get(url, allow_redirects=True)
    open(r'/var/skripte/data/Impfquotenmonitoring.xlsx', 'wb').write(r.content)
    xlsx_file = Path(os.getcwd(), r'/var/skripte/data/Impfquotenmonitoring.xlsx')
    wb_obj = openpyxl.load_workbook(xlsx_file,data_only=True)
    
    datakt=datetime.now()
    dat="--"
    sheet=wb_obj.active
    for sht in wb_obj:
        print(sht.title)
        try:
            dat = datetime.strptime(sht.title[-8:],'%d.%m.%y')
            sheet=sht
        except:
            pass
    print("Selected: "+sheet.title)
    # print(dat)
    
    if dat=="--":
        print("Datum nicht ermittelbar!")
        sys.exit(99)
    
    #sheet = wb_obj.active
    sum = 0
    anzbl = 0
    titel = 0
    with open(r'/var/skripte/data/Impfquotenmonitoring.csv', 'w', newline="") as f:
        c = csv.writer(f)
        for row in sheet.iter_rows(min_row=1,max_col=9,max_row=19, values_only=True):
            try:
                print(row)
                sum=sum+row[2]
                nrow=[str(dat.date()),str(datakt),str(datetime.timestamp(dat))]
                anzbl=anzbl+1
                nrow.extend(list(row))
                c.writerow(nrow)
            except:
                nrow=['Datenstand','Dat-Import', 'Datenstand-Unix']
                if titel==0:
                    titel=1
                    nrow.extend(list(row))
                    c.writerow(nrow)
    if anzbl!=16:
        print("Es sollten 16 Bundesländer sein:",anzbl)
        sys.exit(99)
    
    print("Gesamtzahl der Impfungen in Deutschland: " + str(sum))
    print("Datenstand: " + str(dat) + " Sheetname:" + str(sheet.title))
    

    -> da kommt ein csv raus. Pfad bitte bei Bedarf anpassen.

    Dann Datenbank:

    CREATE TABLE `cor_impfung` (
      `datenstand` date NOT NULL DEFAULT current_timestamp(),
      `import_datum` datetime NOT NULL DEFAULT current_timestamp(),
      `datenstand_unix` bigint(20) NOT NULL DEFAULT 0,
      `RS` int(11) NOT NULL DEFAULT -1,
      `Bundesland` mediumtext COLLATE utf8_bin NOT NULL DEFAULT '\'"??"\'',
      `Impfungen` int(11) DEFAULT 0,
      `BioNTech` int(11) NOT NULL DEFAULT 0,
      `Moderna` int(11) NOT NULL DEFAULT 0,
      `Differenz_Vortag` int(11) DEFAULT 0,
      `Impfquote` double NOT NULL DEFAULT 0,
      `Zweitimpfung` int(11) NOT NULL DEFAULT 0,
      `Zweit_Differenz_Vortag` int(11) NOT NULL DEFAULT 0
    ) DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
    

    und Skript zum abholen:

    #!/bin/bash
    NOW=`date +"%d.%m.%g %H:%M.%S"`
    NOWDAT=`date +"%u"`
    USER=mysqluser
    PASS=mysqlpassword
    
    echo "Starte Abgleich: $NOW"
    
    rm /var/skripte/data/Impfquotenmonitoring.csv
    rm /var/skripte/data/Impfquotenmonitoring.xlsx
    rm /var/skripte/data/cor_impfung.csv
    python3.9 -u /var/skripte/getImpfquoten.py
    if [ $? -eq 99 ]
    then
    	echo "Fehler bei Datenabholung"
    	exit 99
    fi
    cp /var/skripte/data/Impfquotenmonitoring.csv /var/skripte/data/Impfquotenmonitoring_$NOWDAT.csv.backup
    cp /var/skripte/data/Impfquotenmonitoring.csv /var/skripte/data/cor_impfung.csv
    echo "Starte Import $NOW"
    
    mysqlimport --fields-terminated-by=, --ignore-lines=1 --verbose --ignore --local -u $USER -p$PASS iobroker /var/skripte/data/cor_impfung.csv
    
    mysql -u $USER -p$PASS iobroker -e "DELETE i1.* from cor_impfung i1 inner join cor_impfung i2 on (i1.datenstand=i2.datenstand and i1.bundesland=i2.bundesland and i1.import_datum<i
    2.import_datum)"
    

    User und Passwort anspassen! (Das letzte Statement behält nur den letzten Import des Tages)

    Sieht dann so aus:
    Bildschirmfoto 2021-01-02 um 16.47.23.png

    Anschließend kann man das dann in grafana wunderbar visualisieren (deshalb die Unix-Timestamps)

    F Offline
    F Offline
    fastfoot
    schrieb am zuletzt editiert von
    #13

    @sissiwup immer gut zu sehen, wie es auch in anderen Sprachen gehen kann. Einen Import in eine DB hatte ich mir auch überlegt, aber mit der Integration in den Adapter ist das jetzt nicht mehr notwendig. Trotzdem verstehe ich dich gut, mit einem eigenen Skript hat man die volle Kontrolle darüber, was genau passiert :-)

    iobroker läuft unter Docker auf QNAP TS-451+
    SkriptRecovery: https://forum.iobroker.net/post/930558

    1 Antwort Letzte Antwort
    1
    • sissiwupS sissiwup

      Hallo,

      da ich die Daten selber für mich immer gerne archiviere:

      getImpfquoten.py:

      import openpyxl
      from pathlib import Path
      import requests
      import os,sys
      import csv
      from datetime import datetime
      
      url = "https://www.rki.de/DE/Content/InfAZ/N/Neuartiges_Coronavirus/Daten/Impfquotenmonitoring.xlsx;jsessionid=159D4550C958EDFAA9A49921FA132A35.internet122?__blob=publicationFile"
      # url = "https://www.rki.de/DE/Content/InfAZ/N/Neuartiges_Coronavirus/Daten/Impfquotenmonitoring.xlsx"
      r = requests.get(url, allow_redirects=True)
      open(r'/var/skripte/data/Impfquotenmonitoring.xlsx', 'wb').write(r.content)
      xlsx_file = Path(os.getcwd(), r'/var/skripte/data/Impfquotenmonitoring.xlsx')
      wb_obj = openpyxl.load_workbook(xlsx_file,data_only=True)
      
      datakt=datetime.now()
      dat="--"
      sheet=wb_obj.active
      for sht in wb_obj:
          print(sht.title)
          try:
              dat = datetime.strptime(sht.title[-8:],'%d.%m.%y')
              sheet=sht
          except:
              pass
      print("Selected: "+sheet.title)
      # print(dat)
      
      if dat=="--":
          print("Datum nicht ermittelbar!")
          sys.exit(99)
      
      #sheet = wb_obj.active
      sum = 0
      anzbl = 0
      titel = 0
      with open(r'/var/skripte/data/Impfquotenmonitoring.csv', 'w', newline="") as f:
          c = csv.writer(f)
          for row in sheet.iter_rows(min_row=1,max_col=9,max_row=19, values_only=True):
              try:
                  print(row)
                  sum=sum+row[2]
                  nrow=[str(dat.date()),str(datakt),str(datetime.timestamp(dat))]
                  anzbl=anzbl+1
                  nrow.extend(list(row))
                  c.writerow(nrow)
              except:
                  nrow=['Datenstand','Dat-Import', 'Datenstand-Unix']
                  if titel==0:
                      titel=1
                      nrow.extend(list(row))
                      c.writerow(nrow)
      if anzbl!=16:
          print("Es sollten 16 Bundesländer sein:",anzbl)
          sys.exit(99)
      
      print("Gesamtzahl der Impfungen in Deutschland: " + str(sum))
      print("Datenstand: " + str(dat) + " Sheetname:" + str(sheet.title))
      

      -> da kommt ein csv raus. Pfad bitte bei Bedarf anpassen.

      Dann Datenbank:

      CREATE TABLE `cor_impfung` (
        `datenstand` date NOT NULL DEFAULT current_timestamp(),
        `import_datum` datetime NOT NULL DEFAULT current_timestamp(),
        `datenstand_unix` bigint(20) NOT NULL DEFAULT 0,
        `RS` int(11) NOT NULL DEFAULT -1,
        `Bundesland` mediumtext COLLATE utf8_bin NOT NULL DEFAULT '\'"??"\'',
        `Impfungen` int(11) DEFAULT 0,
        `BioNTech` int(11) NOT NULL DEFAULT 0,
        `Moderna` int(11) NOT NULL DEFAULT 0,
        `Differenz_Vortag` int(11) DEFAULT 0,
        `Impfquote` double NOT NULL DEFAULT 0,
        `Zweitimpfung` int(11) NOT NULL DEFAULT 0,
        `Zweit_Differenz_Vortag` int(11) NOT NULL DEFAULT 0
      ) DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
      

      und Skript zum abholen:

      #!/bin/bash
      NOW=`date +"%d.%m.%g %H:%M.%S"`
      NOWDAT=`date +"%u"`
      USER=mysqluser
      PASS=mysqlpassword
      
      echo "Starte Abgleich: $NOW"
      
      rm /var/skripte/data/Impfquotenmonitoring.csv
      rm /var/skripte/data/Impfquotenmonitoring.xlsx
      rm /var/skripte/data/cor_impfung.csv
      python3.9 -u /var/skripte/getImpfquoten.py
      if [ $? -eq 99 ]
      then
      	echo "Fehler bei Datenabholung"
      	exit 99
      fi
      cp /var/skripte/data/Impfquotenmonitoring.csv /var/skripte/data/Impfquotenmonitoring_$NOWDAT.csv.backup
      cp /var/skripte/data/Impfquotenmonitoring.csv /var/skripte/data/cor_impfung.csv
      echo "Starte Import $NOW"
      
      mysqlimport --fields-terminated-by=, --ignore-lines=1 --verbose --ignore --local -u $USER -p$PASS iobroker /var/skripte/data/cor_impfung.csv
      
      mysql -u $USER -p$PASS iobroker -e "DELETE i1.* from cor_impfung i1 inner join cor_impfung i2 on (i1.datenstand=i2.datenstand and i1.bundesland=i2.bundesland and i1.import_datum<i
      2.import_datum)"
      

      User und Passwort anspassen! (Das letzte Statement behält nur den letzten Import des Tages)

      Sieht dann so aus:
      Bildschirmfoto 2021-01-02 um 16.47.23.png

      Anschließend kann man das dann in grafana wunderbar visualisieren (deshalb die Unix-Timestamps)

      F Offline
      F Offline
      fastfoot
      schrieb am zuletzt editiert von
      #14

      @sissiwup sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:

      da ich die Daten selber für mich immer gerne archiviere:

      ich ermittle die url zum Exceldownload ja relativ aufwändig, Hintergrund ist die SessionID, welche sich ja immer ändert. Hier würde mich interessieren, ob du damit mit der Zeit Probleme beim Download bekommst, da du sie ja statisch eingetragen hast. Ich könnte mir vorstellen dass sie 'verfällt', bin mir da aber gar nicht sicher...

      iobroker läuft unter Docker auf QNAP TS-451+
      SkriptRecovery: https://forum.iobroker.net/post/930558

      sissiwupS 1 Antwort Letzte Antwort
      0
      • F fastfoot

        @sissiwup sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:

        da ich die Daten selber für mich immer gerne archiviere:

        ich ermittle die url zum Exceldownload ja relativ aufwändig, Hintergrund ist die SessionID, welche sich ja immer ändert. Hier würde mich interessieren, ob du damit mit der Zeit Probleme beim Download bekommst, da du sie ja statisch eingetragen hast. Ich könnte mir vorstellen dass sie 'verfällt', bin mir da aber gar nicht sicher...

        sissiwupS Offline
        sissiwupS Offline
        sissiwup
        schrieb am zuletzt editiert von
        #15

        @fastfoot sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:

        @sissiwup sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:

        da ich die Daten selber für mich immer gerne archiviere:

        ich ermittle die url zum Exceldownload ja relativ aufwändig, Hintergrund ist die SessionID, welche sich ja immer ändert. Hier würde mich interessieren, ob du damit mit der Zeit Probleme beim Download bekommst, da du sie ja statisch eingetragen hast. Ich könnte mir vorstellen dass sie 'verfällt', bin mir da aber gar nicht sicher...

        Hallo,

        bisher habe ich keine Probleme mit der id. Läuft allerdings auch erst seit drei Tagen.

        MfG

        Sissi

        –-----------------------------------------

        1 CCU3 1 CCU2-Gateway 1 LanGateway 1 Pi-Gateway 1 I7 für ioBroker/MySQL


        F 1 Antwort Letzte Antwort
        0
        • sissiwupS sissiwup

          @fastfoot sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:

          @sissiwup sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:

          da ich die Daten selber für mich immer gerne archiviere:

          ich ermittle die url zum Exceldownload ja relativ aufwändig, Hintergrund ist die SessionID, welche sich ja immer ändert. Hier würde mich interessieren, ob du damit mit der Zeit Probleme beim Download bekommst, da du sie ja statisch eingetragen hast. Ich könnte mir vorstellen dass sie 'verfällt', bin mir da aber gar nicht sicher...

          Hallo,

          bisher habe ich keine Probleme mit der id. Läuft allerdings auch erst seit drei Tagen.

          F Offline
          F Offline
          fastfoot
          schrieb am zuletzt editiert von
          #16

          @sissiwup sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:

          Hallo,
          bisher habe ich keine Probleme mit der id. Läuft allerdings auch erst seit drei Tagen.

          Das ist gut, frage mich wozu diese id dann gut sein soll. Danke für das Feedback :+1:

          iobroker läuft unter Docker auf QNAP TS-451+
          SkriptRecovery: https://forum.iobroker.net/post/930558

          1 Antwort Letzte Antwort
          0
          • M Offline
            M Offline
            morpheus 0
            schrieb am zuletzt editiert von morpheus 0
            #17

            Ich bekomme nach Aktualisierung auf 0.6.6 leider folgende Fehlermeldung im Log:

            coronavirus-statistics.0 2021-01-04 14:36:18.333 error at Covid19.onReady (/opt/iobroker/node_modules/iobroker.coronavirus-statistics/main.js:615:5)
            coronavirus-statistics.0 2021-01-04 14:36:18.333 error at germanyBundersland (/opt/iobroker/node_modules/iobroker.coronavirus-statistics/main.js:312:37)
            coronavirus-statistics.0 2021-01-04 14:36:18.333 error at Covid19.getGermanyVaccinationData (/opt/iobroker/node_modules/iobroker.coronavirus-statistics/main.js:796:27)
            coronavirus-statistics.0 2021-01-04 14:36:18.333 error at processTicksAndRejections (internal/process/task_queues.js:97:5)
            coronavirus-statistics.0 2021-01-04 14:36:18.333 error at runMicrotasks (<anonymous>)
            coronavirus-statistics.0 2021-01-04 14:36:18.333 error at getInfos (/opt/iobroker/node_modules/iobroker.coronavirus-statistics/main.js:780:80)
            coronavirus-statistics.0 2021-01-04 14:36:18.333 error (2268) [germanyFederalStates] error: Cannot read property '2' of null, stack: TypeError: Cannot read property '2' of null

            F 1 Antwort Letzte Antwort
            0
            • M morpheus 0

              Ich bekomme nach Aktualisierung auf 0.6.6 leider folgende Fehlermeldung im Log:

              coronavirus-statistics.0 2021-01-04 14:36:18.333 error at Covid19.onReady (/opt/iobroker/node_modules/iobroker.coronavirus-statistics/main.js:615:5)
              coronavirus-statistics.0 2021-01-04 14:36:18.333 error at germanyBundersland (/opt/iobroker/node_modules/iobroker.coronavirus-statistics/main.js:312:37)
              coronavirus-statistics.0 2021-01-04 14:36:18.333 error at Covid19.getGermanyVaccinationData (/opt/iobroker/node_modules/iobroker.coronavirus-statistics/main.js:796:27)
              coronavirus-statistics.0 2021-01-04 14:36:18.333 error at processTicksAndRejections (internal/process/task_queues.js:97:5)
              coronavirus-statistics.0 2021-01-04 14:36:18.333 error at runMicrotasks (<anonymous>)
              coronavirus-statistics.0 2021-01-04 14:36:18.333 error at getInfos (/opt/iobroker/node_modules/iobroker.coronavirus-statistics/main.js:780:80)
              coronavirus-statistics.0 2021-01-04 14:36:18.333 error (2268) [germanyFederalStates] error: Cannot read property '2' of null, stack: TypeError: Cannot read property '2' of null

              F Offline
              F Offline
              fastfoot
              schrieb am zuletzt editiert von
              #18

              @morpheus-0 Bitte LOG Ausgaben in Code Tags!

              Das Problem liegt wohl an der geänderten Website

              iobroker läuft unter Docker auf QNAP TS-451+
              SkriptRecovery: https://forum.iobroker.net/post/930558

              sissiwupS K DutchmanD 3 Antworten Letzte Antwort
              0
              • F fastfoot

                @morpheus-0 Bitte LOG Ausgaben in Code Tags!

                Das Problem liegt wohl an der geänderten Website

                sissiwupS Offline
                sissiwupS Offline
                sissiwup
                schrieb am zuletzt editiert von
                #19

                Heute hat sich das Format des Excel geändert.
                Mein Script oben habe ich angepaßt ...

                MfG

                Sissi

                –-----------------------------------------

                1 CCU3 1 CCU2-Gateway 1 LanGateway 1 Pi-Gateway 1 I7 für ioBroker/MySQL


                1 Antwort Letzte Antwort
                0
                • F fastfoot

                  @morpheus-0 Bitte LOG Ausgaben in Code Tags!

                  Das Problem liegt wohl an der geänderten Website

                  K Offline
                  K Offline
                  klassisch
                  Most Active
                  schrieb am zuletzt editiert von
                  #20

                  @fastfoot bei mir das gleiche

                  coronavirus-statistics.0	2021-01-04 18:39:46.138	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                  coronavirus-statistics.0	2021-01-04 18:39:46.138	warn	(15408) Object coronavirus-statistics.0.Germany.Stadt.Coburg.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mixed, fi
                  coronavirus-statistics.0	2021-01-04 18:39:46.106	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                  coronavirus-statistics.0	2021-01-04 18:39:46.106	warn	(15408) Object coronavirus-statistics.0.Germany.Kreis.Bodenseekreis.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mi
                  coronavirus-statistics.0	2021-01-04 18:39:46.082	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                  coronavirus-statistics.0	2021-01-04 18:39:46.082	warn	(15408) Object coronavirus-statistics.0.Germany.Kreis.Ortenaukreis.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mix
                  coronavirus-statistics.0	2021-01-04 18:39:46.059	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                  coronavirus-statistics.0	2021-01-04 18:39:46.059	warn	(15408) Object coronavirus-statistics.0.Germany.Stadt.Freiburg_im_Breisgau.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, obj
                  coronavirus-statistics.0	2021-01-04 18:39:46.034	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                  coronavirus-statistics.0	2021-01-04 18:39:46.034	warn	(15408) Object coronavirus-statistics.0.Germany.Kreis.Freudenstadt.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mix
                  coronavirus-statistics.0	2021-01-04 18:39:46.014	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                  coronavirus-statistics.0	2021-01-04 18:39:46.014	warn	(15408) Object coronavirus-statistics.0.Germany.Kreis.Calw.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mixed, file
                  coronavirus-statistics.0	2021-01-04 18:39:45.993	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                  coronavirus-statistics.0	2021-01-04 18:39:45.992	warn	(15408) Object coronavirus-statistics.0.Germany.Kreis.Rastatt.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mixed, f
                  coronavirus-statistics.0	2021-01-04 18:39:45.972	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                  coronavirus-statistics.0	2021-01-04 18:39:45.971	warn	(15408) Object coronavirus-statistics.0.Germany.Stadt.Karlsruhe.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mixed,
                  coronavirus-statistics.0	2021-01-04 18:39:45.948	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                  coronavirus-statistics.0	2021-01-04 18:39:45.947	warn	(15408) Object coronavirus-statistics.0.Germany.Kreis.Hohenlohekreis.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, m
                  coronavirus-statistics.0	2021-01-04 18:39:45.923	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                  coronavirus-statistics.0	2021-01-04 18:39:45.923	warn	(15408) Object coronavirus-statistics.0.Germany.Kreis.Esslingen.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mixed,
                  coronavirus-statistics.0	2021-01-04 18:39:45.884	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                  coronavirus-statistics.0	2021-01-04 18:39:45.884	warn	(15408) Object coronavirus-statistics.0.Germany.Kreis.Böblingen.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mixed,
                  coronavirus-statistics.0	2021-01-04 18:39:45.859	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                  coronavirus-statistics.0	2021-01-04 18:39:45.859	warn	(15408) Object coronavirus-statistics.0.Germany.Kreis.Germersheim.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mixe
                  coronavirus-statistics.0	2021-01-04 18:39:45.817	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                  coronavirus-statistics.0	2021-01-04 18:39:45.817	warn	(15408) Object coronavirus-statistics.0.Germany.Stadt.Frankfurt_am_Main.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object
                  coronavirus-statistics.0	2021-01-04 18:39:45.658	error	at process._tickCallback (internal/process/next_tick.js:68:7)
                  coronavirus-statistics.0	2021-01-04 18:39:45.658	error	at getInfos (C:\Program Files\iobroker\ioBrMain026\node_modules\iobroker.coronavirus-statistics\main.js:780:80)
                  coronavirus-statistics.0	2021-01-04 18:39:45.658	error	(15408) [germanyFederalStates] error: Cannot read property '2' of null, stack: TypeError: Cannot read property '2' of null
                  
                  

                  Danke @Dutchman für die Weiterentwicklung des Adapters.

                  Abseits des Adapters teile ich den den Groll von @Homoran . Verstehe das alles nicht. Meine Meinung zu Beginn der Pandemie: Deutschland sollte 16 Mrd für Impfstoffentwicklung bereitstellen zu 4 Approaches @ je 4 Mrd. Einer der vier wird es schaffen und 4Mrd pro Approach wird wohl reichen (grob geschätzt).
                  Und 16Mrd ist billig im Vergleich zu den erwartenden Corona-Lockdown-Schäden.
                  Und Im Frühjahr, als die Gesundheitsämter noch nicht so viel zu tun hatten, gleich die Impflogistik planen und alles vorbereiten.
                  Wird man ja sicher brauchen.
                  Stattdessen habe ich den Eindruck, man habe sich sich auf die EU verlassen. Dort scheint man nicht nur Französisch zu sprechen, sondern auch so zu denken. "Sanofi wird uns retten, muß uns retten". Also die Rettungsdosis bei Sonfi bestellt und die Bestellungen bei Biontech/Pfizer hintan gestellt. Hat aber nicht funktioniert, Sanofi hat wohl gepatzt.
                  Jetzt ist man verlassen und wir werden von anderen überholt, obwohl die Technologie hier entwickelt wurde. Unglaublich.
                  Wer wissen will, wie es besser geht, schaut nach Israel.
                  Jetzt erst aber mal "look at the figures".

                  M 1 Antwort Letzte Antwort
                  0
                  • K klassisch

                    @fastfoot bei mir das gleiche

                    coronavirus-statistics.0	2021-01-04 18:39:46.138	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                    coronavirus-statistics.0	2021-01-04 18:39:46.138	warn	(15408) Object coronavirus-statistics.0.Germany.Stadt.Coburg.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mixed, fi
                    coronavirus-statistics.0	2021-01-04 18:39:46.106	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                    coronavirus-statistics.0	2021-01-04 18:39:46.106	warn	(15408) Object coronavirus-statistics.0.Germany.Kreis.Bodenseekreis.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mi
                    coronavirus-statistics.0	2021-01-04 18:39:46.082	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                    coronavirus-statistics.0	2021-01-04 18:39:46.082	warn	(15408) Object coronavirus-statistics.0.Germany.Kreis.Ortenaukreis.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mix
                    coronavirus-statistics.0	2021-01-04 18:39:46.059	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                    coronavirus-statistics.0	2021-01-04 18:39:46.059	warn	(15408) Object coronavirus-statistics.0.Germany.Stadt.Freiburg_im_Breisgau.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, obj
                    coronavirus-statistics.0	2021-01-04 18:39:46.034	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                    coronavirus-statistics.0	2021-01-04 18:39:46.034	warn	(15408) Object coronavirus-statistics.0.Germany.Kreis.Freudenstadt.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mix
                    coronavirus-statistics.0	2021-01-04 18:39:46.014	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                    coronavirus-statistics.0	2021-01-04 18:39:46.014	warn	(15408) Object coronavirus-statistics.0.Germany.Kreis.Calw.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mixed, file
                    coronavirus-statistics.0	2021-01-04 18:39:45.993	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                    coronavirus-statistics.0	2021-01-04 18:39:45.992	warn	(15408) Object coronavirus-statistics.0.Germany.Kreis.Rastatt.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mixed, f
                    coronavirus-statistics.0	2021-01-04 18:39:45.972	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                    coronavirus-statistics.0	2021-01-04 18:39:45.971	warn	(15408) Object coronavirus-statistics.0.Germany.Stadt.Karlsruhe.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mixed,
                    coronavirus-statistics.0	2021-01-04 18:39:45.948	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                    coronavirus-statistics.0	2021-01-04 18:39:45.947	warn	(15408) Object coronavirus-statistics.0.Germany.Kreis.Hohenlohekreis.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, m
                    coronavirus-statistics.0	2021-01-04 18:39:45.923	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                    coronavirus-statistics.0	2021-01-04 18:39:45.923	warn	(15408) Object coronavirus-statistics.0.Germany.Kreis.Esslingen.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mixed,
                    coronavirus-statistics.0	2021-01-04 18:39:45.884	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                    coronavirus-statistics.0	2021-01-04 18:39:45.884	warn	(15408) Object coronavirus-statistics.0.Germany.Kreis.Böblingen.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mixed,
                    coronavirus-statistics.0	2021-01-04 18:39:45.859	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                    coronavirus-statistics.0	2021-01-04 18:39:45.859	warn	(15408) Object coronavirus-statistics.0.Germany.Kreis.Germersheim.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mixe
                    coronavirus-statistics.0	2021-01-04 18:39:45.817	warn	(15408) This object will not be created in future versions. Please report this to the developer.
                    coronavirus-statistics.0	2021-01-04 18:39:45.817	warn	(15408) Object coronavirus-statistics.0.Germany.Stadt.Frankfurt_am_Main.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object
                    coronavirus-statistics.0	2021-01-04 18:39:45.658	error	at process._tickCallback (internal/process/next_tick.js:68:7)
                    coronavirus-statistics.0	2021-01-04 18:39:45.658	error	at getInfos (C:\Program Files\iobroker\ioBrMain026\node_modules\iobroker.coronavirus-statistics\main.js:780:80)
                    coronavirus-statistics.0	2021-01-04 18:39:45.658	error	(15408) [germanyFederalStates] error: Cannot read property '2' of null, stack: TypeError: Cannot read property '2' of null
                    
                    

                    Danke @Dutchman für die Weiterentwicklung des Adapters.

                    Abseits des Adapters teile ich den den Groll von @Homoran . Verstehe das alles nicht. Meine Meinung zu Beginn der Pandemie: Deutschland sollte 16 Mrd für Impfstoffentwicklung bereitstellen zu 4 Approaches @ je 4 Mrd. Einer der vier wird es schaffen und 4Mrd pro Approach wird wohl reichen (grob geschätzt).
                    Und 16Mrd ist billig im Vergleich zu den erwartenden Corona-Lockdown-Schäden.
                    Und Im Frühjahr, als die Gesundheitsämter noch nicht so viel zu tun hatten, gleich die Impflogistik planen und alles vorbereiten.
                    Wird man ja sicher brauchen.
                    Stattdessen habe ich den Eindruck, man habe sich sich auf die EU verlassen. Dort scheint man nicht nur Französisch zu sprechen, sondern auch so zu denken. "Sanofi wird uns retten, muß uns retten". Also die Rettungsdosis bei Sonfi bestellt und die Bestellungen bei Biontech/Pfizer hintan gestellt. Hat aber nicht funktioniert, Sanofi hat wohl gepatzt.
                    Jetzt ist man verlassen und wir werden von anderen überholt, obwohl die Technologie hier entwickelt wurde. Unglaublich.
                    Wer wissen will, wie es besser geht, schaut nach Israel.
                    Jetzt erst aber mal "look at the figures".

                    M Offline
                    M Offline
                    morpheus 0
                    schrieb am zuletzt editiert von
                    #21

                    Es gibt jetzt eine Version
                    https://github.com/iobroker-community-adapters/ioBroker.coronavirus-statistics

                    Jetzt funktioniert alles wieder einwandfrei :-)

                    K 1 Antwort Letzte Antwort
                    0
                    • M morpheus 0

                      Es gibt jetzt eine Version
                      https://github.com/iobroker-community-adapters/ioBroker.coronavirus-statistics

                      Jetzt funktioniert alles wieder einwandfrei :-)

                      K Offline
                      K Offline
                      klassisch
                      Most Active
                      schrieb am zuletzt editiert von
                      #22

                      @morpheus-0 bei mir auch, vielen Dank!

                      1 Antwort Letzte Antwort
                      0
                      • F fastfoot

                        @morpheus-0 Bitte LOG Ausgaben in Code Tags!

                        Das Problem liegt wohl an der geänderten Website

                        DutchmanD Offline
                        DutchmanD Offline
                        Dutchman
                        Developer Most Active Administrators
                        schrieb am zuletzt editiert von
                        #23

                        @fastfoot sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:

                        @morpheus-0 Bitte LOG Ausgaben in Code Tags!

                        Das Problem liegt wohl an der geänderten Website

                        @klassisch sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:

                        @fastfoot bei mir das gleiche

                        verwechselt bitte script nicht mit adapter, issues zu adapter bitte am besten immer git oder im betreffenden thread.
                        Obwohl in diesem fall zufällig @fastfoot auch fast gleichzeitig ne Lesung parat hatte :)

                        sissiwupS 1 Antwort Letzte Antwort
                        0
                        • DutchmanD Dutchman

                          @fastfoot sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:

                          @morpheus-0 Bitte LOG Ausgaben in Code Tags!

                          Das Problem liegt wohl an der geänderten Website

                          @klassisch sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:

                          @fastfoot bei mir das gleiche

                          verwechselt bitte script nicht mit adapter, issues zu adapter bitte am besten immer git oder im betreffenden thread.
                          Obwohl in diesem fall zufällig @fastfoot auch fast gleichzeitig ne Lesung parat hatte :)

                          sissiwupS Offline
                          sissiwupS Offline
                          sissiwup
                          schrieb am zuletzt editiert von sissiwup
                          #24

                          Mann, heute schon wieder eine Anpassung.
                          Die Reiter sind mal wieder umbenannt worden...
                          Habs oben im Skript angepaßt.

                          MfG

                          Sissi

                          –-----------------------------------------

                          1 CCU3 1 CCU2-Gateway 1 LanGateway 1 Pi-Gateway 1 I7 für ioBroker/MySQL


                          sissiwupS 1 Antwort Letzte Antwort
                          0
                          • sissiwupS sissiwup

                            Mann, heute schon wieder eine Anpassung.
                            Die Reiter sind mal wieder umbenannt worden...
                            Habs oben im Skript angepaßt.

                            sissiwupS Offline
                            sissiwupS Offline
                            sissiwup
                            schrieb am zuletzt editiert von
                            #25

                            @sissiwup
                            Und wieder mal neu, jetzt werden Formeln in der Excel verwendet.

                            MfG

                            Sissi

                            –-----------------------------------------

                            1 CCU3 1 CCU2-Gateway 1 LanGateway 1 Pi-Gateway 1 I7 für ioBroker/MySQL


                            1 Antwort Letzte Antwort
                            0
                            • F Offline
                              F Offline
                              fraltho
                              schrieb am zuletzt editiert von
                              #26

                              aktuell (seit ca. einer Woche) werden die Impfungen nicht mehr aktualisiert, generell? Oder nur bei mir und einigen wenigen anderen Kollegen?

                              Mfg
                              Frank

                              F 1 Antwort Letzte Antwort
                              0
                              • F fraltho

                                aktuell (seit ca. einer Woche) werden die Impfungen nicht mehr aktualisiert, generell? Oder nur bei mir und einigen wenigen anderen Kollegen?

                                Mfg
                                Frank

                                F Offline
                                F Offline
                                fastfoot
                                schrieb am zuletzt editiert von
                                #27

                                @fraltho sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:

                                aktuell (seit ca. einer Woche) werden die Impfungen nicht mehr aktualisiert, generell? Oder nur bei mir und einigen wenigen anderen Kollegen?

                                das obige Skript ist seit der Implementierung im Adapter eh obsolet und läuft auch mit den aktuellen Versionen des RKI Excelsheet nicht mehr. Das gleiche Problem hat wohl auch der Adapter, die RKI Leute wechseln das Layout ständig und auch nicht gerade auswertefreundlich. Leider ist das Excel die einzige mir bekannte Quelle für Impfdaten auf Bundeslandebene. Inwiefern @Dutchman da jetzt Änderungen im Adapter macht kann ich nicht sagen, meines Wissens wollte er sich das aber ansehen.

                                iobroker läuft unter Docker auf QNAP TS-451+
                                SkriptRecovery: https://forum.iobroker.net/post/930558

                                F 1 Antwort Letzte Antwort
                                0
                                • F fastfoot

                                  @fraltho sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:

                                  aktuell (seit ca. einer Woche) werden die Impfungen nicht mehr aktualisiert, generell? Oder nur bei mir und einigen wenigen anderen Kollegen?

                                  das obige Skript ist seit der Implementierung im Adapter eh obsolet und läuft auch mit den aktuellen Versionen des RKI Excelsheet nicht mehr. Das gleiche Problem hat wohl auch der Adapter, die RKI Leute wechseln das Layout ständig und auch nicht gerade auswertefreundlich. Leider ist das Excel die einzige mir bekannte Quelle für Impfdaten auf Bundeslandebene. Inwiefern @Dutchman da jetzt Änderungen im Adapter macht kann ich nicht sagen, meines Wissens wollte er sich das aber ansehen.

                                  F Offline
                                  F Offline
                                  fraltho
                                  schrieb am zuletzt editiert von
                                  #28

                                  @fastfoot es gibt ja ein issue darüber, warten wir also ab :)

                                  1 Antwort Letzte Antwort
                                  0
                                  • F fastfoot

                                    Hallo,
                                    seit ein paar Tagen ist das RKI-Impfquotenmonitoring online, leider gibt es die Daten nur als Exceldatei. Das vorliegende Skript liest diese Daten und stellt eine JSON-Tabelle zur Verfügung, welche man in der VIS verwenden kann. Evtl. werden die Daten auch bald im Covid-19 Adapter zur Verfügung stehen, weshalb ich auf die Erstellung einzelner Datenpunkte für die Bundesländer verzichtet habe. Die Daten werden nur einmal am Tag vom RKI aktualisiert, dementsprechend ist ein einmaliges schedule() um ca. 13-14Uhr völlig ausreichend!

                                    Voraussetzung zur Nutzung des Skripts:

                                    • Die NPM-Module axios, cheerio und xlsx müssen in der Javascript Instanz 0 eingetragen werden

                                    Features:

                                    • Die tgl. heruntergeladenen Exceldateien werden nicht gelöscht(kann man auch negativ sehen, jedoch plane ich noch eine grafische Ansicht des Verlaufs)
                                    • Datenpunkte für Refresh und die JSON Tabelle werden automatisch angelegt
                                    • JSON Tabellenwidget auf Basis des inventwo Widget Adapters

                                    Hier die Ausgabe
                                    Impfungen1.PNG

                                    /**
                                     * Zweck:           RKI Impfquotenmonitoring Deutschland incl. Bundesländer
                                     * Datum:           04.01.2021
                                     * Author:          @fastfoot
                                     * Forum:           https://forum.iobroker.net/topic/40394/skript-rki-impfquotenmonitoring-deutschland-incl-b-l%C3%A4nder
                                     * 
                                     * Voraussetzung:   Die npm-Module axios, cheerio und xlsx müssen in der JS-Instanz eingetragen werden
                                     * 
                                     */
                                    const axios = require('axios').default;
                                    const cheerio = require('cheerio');
                                    const Excel = require('xlsx'); 
                                    const fs = require('fs');
                                    const Path = require('path');
                                    const dbg = !true;
                                    const idBase = '0_userdata.0.Corona.Impfungen';
                                    const idRefresh = `${idBase}.Refresh`;
                                    const idJson = `${idBase}.json`;
                                    const idAdapter = `${idBase}.Adapter`;
                                    const mySchedule = '30 14 * * *';
                                    const filePath = '/opt/iobroker';
                                    let fileName = 'Impfquotenmonitoring_xxx.xlsx';
                                    
                                    async function main(refresh = false) {
                                        let firstRun = true, dataAdapter = {};
                                        
                                        firstRun = await createDatapoints();
                                    
                                        const Infos = await getInfos();
                                        if(refresh || firstRun) await getExcelFile(Infos.urlExcel, Infos.Version);
                                        const path = Path.resolve(filePath, '', fileName.replace('xxx',Infos.Version))
                                        const WorkBook = Excel.readFile(path, {sheetStubs: true});
                                        const WorkSheet = WorkBook.Sheets[WorkBook.SheetNames[1]];
                                        let now = formatDate(new Date(),'hh:mm')
                                        let data = Excel.utils.sheet_to_json(WorkSheet, {/*raw: true,dateNF: "DD-MMM-YYYY",header:0,*/defval: 0})
                                        data = data.slice(0,17)
                                        for(let record of data){
                                            if('__EMPTY' in record) delete record['__EMPTY'];
                                            if('__EMPTY_1' in record) delete record['__EMPTY_1'];
                                            record.Datum = Infos.datumSheet;
                                            record.Stand = Infos.Stand;
                                            record.Upd = now;
                                            dataAdapter[(record.Bundesland).replace(/\*/g,'')] = record["Impfungen kumulativ"];
                                        }
                                        setState(idJson, JSON.stringify(data));
                                        setState(idAdapter, JSON.stringify(dataAdapter));
                                    }
                                    
                                    // download and save excel file
                                    async function getExcelFile (url, Version) {  
                                        const path = Path.resolve(filePath, '', fileName.replace('xxx',Version))
                                        const writer = fs.createWriteStream(path)
                                    
                                        const response = await axios({
                                            url: url,
                                            method: 'GET',
                                            responseType: 'stream'
                                        })
                                        response.data.pipe(writer)
                                    
                                        return new Promise((resolve, reject) => {
                                            writer.on('finish', resolve)
                                            writer.on('error', reject)
                                        })
                                    }
                                    
                                    // get download link and vaccination date, prepare version number
                                    async function getInfos() {
                                        let Infos = {};
                                        const urlImpf = 'https://www.rki.de/DE/Content/InfAZ/N/Neuartiges_Coronavirus/Daten/Impfquoten-Tab.html'
                                        let html = cheerio.load((await axios.get(urlImpf)).data);
                                        let urlExcel = 'https://www.rki.de' + html('a.downloadlink').attr('href');
                                        let dat = /Stand:\s(\d+).(\d+).(\d+)/.exec(html('div.dateOfIssue').text());
                                        let zeit = '00:00';
                                        let Stand = getDateObject(dat[3] + '-' + ('0'+dat[2]).slice(-2) + '-' + ('0'+dat[1]).slice(-2) + 'T' + zeit);
                                        let tmpDat = getDateObject(dat[3] + '-' + ('0'+dat[2]).slice(-2) + '-' + ('0'+dat[1]).slice(-2) + 'T' + zeit);
                                        let Version = formatDate(Stand,'YYYY-MM-DD').replace(/-/g,'');
                                        let datumSheet = formatDate(tmpDat.setDate(Stand.getDate()-1),'DD.MM.YY');
                                        Infos = {
                                            urlExcel,
                                            datumSheet,
                                            Stand,
                                            Version
                                        }
                                        if(dbg) log(JSON.stringify(Infos,null,4));
                                        return Infos;
                                    
                                    }
                                    
                                    // create data points if not existing
                                    async function createDatapoints() {
                                        let dp,
                                            idKey,
                                            firstRun = false;
                                        
                                        const stateAttributes = {
                                            "json":{"name":"Daten","type":"string","role":"","read":true,"write":true,"desc":"von Skript erstellt","def":""},
                                            "Refresh":{"name":"Refresh","type":"boolean","role":"","read":true,"write":true,"desc":"von Skript erstellt","def":false},
                                            "Adapter":{"name":"Daten für Covid-19 Adapter","type":"string","role":"","read":true,"write":true,"desc":"von Skript erstellt","def": ""},
                                        }
                                    
                                        for(let key in stateAttributes) {
                                    
                                            idKey = idBase + '.' + key;
                                    
                                            if (!(await existsStateAsync(idKey))) {
                                                dp = stateAttributes[key];
                                                firstRun = true;
                                                await createStateAsync(idKey, dp);
                                            }
                                        }
                                    
                                        return firstRun;
                                    
                                    }
                                    
                                    schedule(mySchedule, () => {main(true)});
                                    
                                    on({id: idRefresh, change: 'any'},() => {main(true)})
                                    
                                    main(!true);
                                    

                                    [{"tpl":"i-vis-jsontable","data":{"g_fixed":false,"g_visibility":false,"g_css_font_text":false,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","iTblRowLimit":"17","iTableRefreshRate":"0","iColCount":"10","iColShow1":"true","iTblCellFormat1":"normal","iTblCellImageSize1":"200","iTblTextAlign1":"left","iOpacityAll":"1","iTblRowEvenColor":"#333333","iTblRowUnevenColor":"#455618","iTblHeaderColor":"#333333","iRowSpacing":"10","iTblRowEvenTextColor":"#ffffff","iTblRowUnevenTextColor":"#ffffff","iTblHeaderTextColor":"#ffffff","iBorderSize":"1","iBorderStyleLeft":"solid","iBorderStyleRight":"solid","iBorderStyleUp":"none","iBorderStyleDown":"none","iBorderColor":"#ffffff","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"oid":"0_userdata.0.Corona.Impfungen.json","iTblShowHead":true,"iColShow2":"true","iTblCellFormat2":"normal","iTblCellImageSize2":"200","iTblTextAlign2":"right","iColShow3":"true","iTblCellFormat3":"normal","iTblCellImageSize3":"200","iTblTextAlign3":"right","iColShow4":"true","iTblCellFormat4":"normal","iTblCellImageSize4":"200","iTblTextAlign4":"right","iColShow5":"true","iTblCellFormat5":"normal","iTblCellImageSize5":"200","iTblTextAlign5":"right","iColShow6":"true","iTblCellFormat6":"normal","iTblCellImageSize6":"200","iTblTextAlign6":"right","iColShow7":"true","iTblCellFormat7":"normal","iTblCellImageSize7":"200","iTblTextAlign7":"right","iColShow8":"true","iTblCellFormat8":"normal","iTblCellImageSize8":"200","iTblTextAlign8":"center","iColShow9":"true","iTblCellFormat9":"datetime","iTblCellImageSize9":"200","iTblTextAlign9":"center","iColShow10":"true","iTblCellFormat10":"normal","iTblCellImageSize10":"200","iTblTextAlign10":"center","iColShow11":"true","iTblCellFormat11":"normal","iTblCellImageSize11":"200","iTblTextAlign11":"left","iVertScroll":true,"iColShow12":"true","iTblCellFormat12":"normal","iTblCellImageSize12":"200","iTblTextAlign12":"left","iColShow13":"true","iTblCellFormat13":"normal","iTblCellImageSize13":"200","iTblTextAlign13":"left","iColShow14":"true","iTblCellFormat14":"normal","iTblCellImageSize14":"200","iTblTextAlign14":"left","iColShow15":"true","iTblCellFormat15":"normal","iTblCellImageSize15":"200","iTblTextAlign15":"left","iColWidth1":"200px","iTblCellDatetimeFormat8":"d.m. H:i","iTblCellDatetimeFormat9":"d.m. H:i","iTblCellPlaceholder1":"","iTblCellPlaceholder2":"","iTblCellPlaceholder3":"","iTblCellPlaceholder4":"","iTblCellPlaceholder5":"","iTblCellPlaceholder6":"","iTblCellPlaceholder7":"","iTblCellPlaceholder8":"","iTblCellPlaceholder9":"","iColAttr1":"Bundesland","iColAttr2":"Impfungen kumulativ","iColWidth2":"90px","iColWidth3":"90px","iColWidth4":"90px","iColWidth5":"90px","iColWidth6":"90px","iColWidth7":"90px","iColWidth8":"90px","iColWidth9":"100px","iColWidth10":"50px","iColName8":"Impfdatum"},"style":{"left":"10px","top":"60px","height":"612px","width":"1135px"},"widgetSet":"vis-inventwo"},{"tpl":"tplVis-materialdesign-Button-State","data":{"oid":"0_userdata.0.Corona.Impfungen.Refresh","g_fixed":false,"g_visibility":false,"g_css_font_text":true,"g_css_background":true,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","buttonStyle":"unelevated","vibrateOnMobilDevices":"50","iconPosition":"left","autoLockAfter":"10","lockFilterGrayscale":"30","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"buttontext":"Refresh","colorPress":"#ff0000","labelWidth":"0","exportData":"true","value":"true","textFontFamily":"{vis-materialdesign.0.fonts.button.text}","textFontSize":"{vis-materialdesign.0.fontSizes.button.text}","lockIconColor":"{mode:vis-materialdesign.0.colors.darkTheme;light:vis-materialdesign.0.colors.light.button.lock_icon;dark:vis-materialdesign.0.colors.dark.button.lock_icon; mode === \"true\" ? dark : light}","mdwButtonPrimaryColor":"{mode:vis-materialdesign.0.colors.darkTheme;light:vis-materialdesign.0.colors.light.button.default.primary;dark:vis-materialdesign.0.colors.dark.button.default.primary; mode === \"true\" ? dark : light}","mdwButtonSecondaryColor":"{mode:vis-materialdesign.0.colors.darkTheme;light:vis-materialdesign.0.colors.light.button.default.secondary;dark:vis-materialdesign.0.colors.dark.button.default.secondary; mode === \"true\" ? dark : light}"},"style":{"left":"10px","top":"10px","width":"71px","height":"29px","color":"#FF0000","background-color":"#000000"},"widgetSet":"materialdesign"}]
                                    

                                    frohes Monitoring

                                    M Offline
                                    M Offline
                                    morpheus 0
                                    schrieb am zuletzt editiert von
                                    #29

                                    @fastfoot
                                    Hallo @fastfoot: Leider wurde die Excelliste anscheinend schon wieder angepasst. Und die Zahlen passen nicht zusammen. Kannst Du mal einen Blick darauf werfen?

                                    343f0294-0e9c-40f6-b477-ae8085ab726c-image.png

                                    5bd4a36e-0088-4b2d-9426-045f6aa4354f-image.png

                                    Danke
                                    Gruß Christian

                                    F 1 Antwort Letzte Antwort
                                    0
                                    • M morpheus 0

                                      @fastfoot
                                      Hallo @fastfoot: Leider wurde die Excelliste anscheinend schon wieder angepasst. Und die Zahlen passen nicht zusammen. Kannst Du mal einen Blick darauf werfen?

                                      343f0294-0e9c-40f6-b477-ae8085ab726c-image.png

                                      5bd4a36e-0088-4b2d-9426-045f6aa4354f-image.png

                                      Danke
                                      Gruß Christian

                                      F Offline
                                      F Offline
                                      fastfoot
                                      schrieb am zuletzt editiert von
                                      #30

                                      @morpheus-0 Für den Covid Adapter ist ausschließlich @Dutchman zuständig, dies hier ist der Thread zum Skript, welches allerdings zur Zeit nicht weiterentwickelt wird und deshalb auch nicht funktioniert. Sorry dass ich da keine besseren Neuigkeiten habe

                                      iobroker läuft unter Docker auf QNAP TS-451+
                                      SkriptRecovery: https://forum.iobroker.net/post/930558

                                      sissiwupS 1 Antwort Letzte Antwort
                                      0
                                      • F fastfoot

                                        @morpheus-0 Für den Covid Adapter ist ausschließlich @Dutchman zuständig, dies hier ist der Thread zum Skript, welches allerdings zur Zeit nicht weiterentwickelt wird und deshalb auch nicht funktioniert. Sorry dass ich da keine besseren Neuigkeiten habe

                                        sissiwupS Offline
                                        sissiwupS Offline
                                        sissiwup
                                        schrieb am zuletzt editiert von
                                        #31

                                        Hi,

                                        hier mal die aktuelle Version:
                                        getImpfquoten.py:

                                        import openpyxl
                                        from pathlib import Path
                                        import requests
                                        import os,sys
                                        import csv
                                        from datetime import datetime
                                        
                                        url = "https://www.rki.de/DE/Content/InfAZ/N/Neuartiges_Coronavirus/Daten/Impfquotenmonitoring.xlsx;jsessionid=159D4550C958EDFAA9A49921FA132A35.internet122?__blob=publicationFile"
                                        # url = "https://www.rki.de/DE/Content/InfAZ/N/Neuartiges_Coronavirus/Daten/Impfquotenmonitoring.xlsx"
                                        r = requests.get(url, allow_redirects=True)
                                        open(r'/var/skripte/data/Impfquotenmonitoring.xlsx', 'wb').write(r.content)
                                        xlsx_file = Path(os.getcwd(), r'/var/skripte/data/Impfquotenmonitoring.xlsx')
                                        wb_obj = openpyxl.load_workbook(xlsx_file,data_only=True)
                                        
                                        datakt=datetime.now()
                                        dat="--"
                                        sheet=wb_obj.active
                                        for sht in wb_obj:
                                            print(sht.title)
                                            try:
                                                dat = datetime.strptime(sht.title[-8:],'%d.%m.%y')
                                                sheet=sht
                                            except:
                                                pass
                                        print("Selected: "+sheet.title)
                                        # print(dat)
                                        
                                        if dat=="--":
                                            print("Datum nicht ermittelbar!")
                                            sys.exit(99)
                                        
                                        #sheet = wb_obj.active
                                        sum = 0
                                        anzbl = 0
                                        titel = 0
                                        headline = None
                                        with open(r'/var/skripte/data/Impfquotenmonitoring.csv', 'w', newline="") as f:
                                            c = csv.writer(f)
                                            for row in sheet.iter_rows(min_row=1,max_col=25,max_row=19, values_only=True):
                                                try:
                                                    sum=sum+row[2]
                                                    nrow=[str(dat.date()),str(datakt),str(datetime.timestamp(dat))]
                                                    anzbl=anzbl+1
                                                    row = [x for x in row if x is not None]
                                                    nrow.extend(list(row))
                                                    if titel==0:
                                                        titel=1
                                                        headline = [x for x in headline if x is not None]
                                                        trow=['Datenstand','Dat-Import', 'Datenstand-Unix']
                                                        trow.extend(list(headline))
                                                        print(trow)
                                                        c.writerow(trow)
                                        
                                                    print(nrow)
                                                    c.writerow(nrow)
                                                except:
                                                    if headline==None:
                                                        headline=list(row)
                                                    else:
                                                        for i in range(0,len(headline)):
                                                            if row[i] is not None:
                                                                if headline[i] is None:
                                                                    headline[i]=row[i]
                                                                else:
                                                                    headline[i]=headline[i]+"."+row[i]
                                        
                                        if anzbl!=16:
                                            print("Es sollten 16 Bundesländer sein:",anzbl)
                                            sys.exit(99)
                                        
                                        if len(headline)!=15:
                                            print("Anzahl Spalten sollte 15 sein:",len(headline))
                                            sys.exit(99)
                                        
                                        print("Gesamtzahl der Impfungen in Deutschland: " + str(sum))
                                        print("Datenstand: " + str(dat) + " Sheetname:" + str(sheet.title))
                                        

                                        getImpfquoten.sh:

                                        #!/bin/bash
                                        NOW=`date +"%d.%m.%g %H:%M.%S"`
                                        NOWDAT=`date +"%u"`
                                        USER=usermysql
                                        PASS=passwordmysql
                                        
                                        echo "Starte Abgleich: $NOW"
                                        
                                        rm /var/skripte/data/Impfquotenmonitoring.csv
                                        rm /var/skripte/data/Impfquotenmonitoring.xlsx
                                        rm /var/skripte/data/cor_impfung.csv
                                        python3.9 -u /var/skripte/getImpfquoten.py
                                        if [ $? -eq 99 ]
                                        then
                                        	echo "Fehler bei Datenabholung"
                                        	cp /var/skripte/data/Impfquotenmonitoring.xlsx /var/skripte/data/Impquotenmonitoring_$NOWDAT.xlsx.backup
                                                cp /var/skripte/data/Impfquotenmonitoring.csv /var/skripte/data/Impfquotenmonitoring_$NOWDAT.csv.backup
                                        	exit 99
                                        fi
                                        cp /var/skripte/data/Impfquotenmonitoring.csv /var/skripte/data/Impfquotenmonitoring_$NOWDAT.csv.backup
                                        cp /var/skripte/data/Impfquotenmonitoring.csv /var/skripte/data/cor_impfung.csv
                                        echo "Starte Import $NOW"
                                        
                                        mysqlimport --fields-terminated-by=, --ignore-lines=1 --verbose --ignore --local -u $USER -p$PASS iobroker /var/skripte/data/cor_impfung.csv
                                        
                                        mysql -u $USER -p$PASS iobroker -e "DELETE i1.* from cor_impfung i1 inner join cor_impfung i2 on (i1.datenstand=i2.datenstand and i1.rs=i2.rs and i1.import_datum<i2.import_datum)"
                                        mysql -u $USER -p$PASS iobroker -e "UPDATE cor_impfung inner join cor_bundesland on rs=lan_ew_ags SET Bundesland=lan_ew_gen"
                                        

                                        Tabelle:

                                        CREATE TABLE `cor_impfung` (
                                          `datenstand` date NOT NULL DEFAULT current_timestamp(),
                                          `import_datum` datetime NOT NULL DEFAULT current_timestamp(),
                                          `datenstand_unix` bigint(20) NOT NULL DEFAULT 0,
                                          `RS` int(11) NOT NULL DEFAULT -1,
                                          `Bundesland` mediumtext COLLATE utf8_bin NOT NULL DEFAULT '\'"??"\'',
                                          `Gesamtimpfungen` int(11) NOT NULL DEFAULT 0,
                                          `Impfungen` int(11) DEFAULT 0,
                                          `BioNTech` int(11) NOT NULL DEFAULT 0,
                                          `Moderna` int(11) NOT NULL DEFAULT 0,
                                          `AstraZeneca` int(11) NOT NULL DEFAULT 0,
                                          `Differenz_Vortag` int(11) DEFAULT 0,
                                          `Impfquote` double NOT NULL DEFAULT 0,
                                          `Zweitimpfung` int(11) NOT NULL DEFAULT 0,
                                          `BioNTech_2` int(11) NOT NULL DEFAULT 0,
                                          `Moderna_2` int(11) NOT NULL DEFAULT 0,
                                          `AstraZeneca_2` int(11) NOT NULL DEFAULT 0,
                                          `Zweit_Differenz_Vortag` int(11) NOT NULL DEFAULT 0,
                                          `Impfquote_2` double NOT NULL DEFAULT 0
                                        ) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
                                        

                                        Index:

                                        ALTER TABLE `cor_impfung`
                                          ADD PRIMARY KEY (`datenstand`,`Bundesland`(24),`import_datum`),
                                          ADD KEY `datenstand-unix` (`datenstand_unix`,`Bundesland`(24));
                                        COMMIT;
                                        

                                        Erklärung siehe oben bei meinem letzten Post

                                        MfG

                                        Sissi

                                        –-----------------------------------------

                                        1 CCU3 1 CCU2-Gateway 1 LanGateway 1 Pi-Gateway 1 I7 für ioBroker/MySQL


                                        1 Antwort Letzte Antwort
                                        0
                                        Antworten
                                        • In einem neuen Thema antworten
                                        Anmelden zum Antworten
                                        • Älteste zuerst
                                        • Neuste zuerst
                                        • Meiste Stimmen


                                        Support us

                                        ioBroker
                                        Community Adapters
                                        Donate

                                        793

                                        Online

                                        32.4k

                                        Benutzer

                                        81.6k

                                        Themen

                                        1.3m

                                        Beiträge
                                        Community
                                        Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                                        ioBroker Community 2014-2025
                                        logo
                                        • Anmelden

                                        • Du hast noch kein Konto? Registrieren

                                        • Anmelden oder registrieren, um zu suchen
                                        • Erster Beitrag
                                          Letzter Beitrag
                                        0
                                        • Home
                                        • Aktuell
                                        • Tags
                                        • Ungelesen 0
                                        • Kategorien
                                        • Unreplied
                                        • Beliebt
                                        • GitHub
                                        • Docu
                                        • Hilfe