Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Mal wieder Webseite auslesen

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    Mal wieder Webseite auslesen

    This topic has been deleted. Only users with topic management privileges can see it.
    • liv-in-sky
      liv-in-sky @Homoran last edited by

      @homoran

      ok - was mit einem wert funktioniert , muss auch mit den anderen funktionieren - das muss dann normalerweise ein syntax thema sein

      1 Reply Last reply Reply Quote 0
      • Homoran
        Homoran Global Moderator Administrators @liv-in-sky last edited by

        @liv-in-sky sagte in Mal wieder Webseite auslesen:

        @homoran

        welche meinst du - das sind die spalten

        Image 6.png

        kannst du vielleicht nochmal helfen, bitte?

        Ich bekomme heute auf einmal schwachsinige Werte.
        Erst fange ich an, an den Formeln zu schrauben.
        und jetzt nehme ich an, dass sich das xls geändert und die Spaltennummern nicht mehr stimmrn.

        Wie hast du die Spaltennummern erzeugt?

        liv-in-sky 1 Reply Last reply Reply Quote 0
        • liv-in-sky
          liv-in-sky @Homoran last edited by

          @homoran
          sorry - heute geht es nicht mehr - aber morgen schaue ich mir das nochmal an

          Homoran 1 Reply Last reply Reply Quote 0
          • Homoran
            Homoran Global Moderator Administrators @liv-in-sky last edited by Homoran

            @liv-in-sky sagte in Mal wieder Webseite auslesen:

            @homoran
            sorry - heute geht es nicht mehr - aber morgen schaue ich mir das nochmal an

            Nicht nötig! DANKE!

            Hab es gerade hinbekommen.

            liv-in-sky 1 Reply Last reply Reply Quote 0
            • liv-in-sky
              liv-in-sky @Homoran last edited by

              @homoran

              das war ja dann einfach für mich 🙂

              Homoran 1 Reply Last reply Reply Quote 0
              • Homoran
                Homoran Global Moderator Administrators @liv-in-sky last edited by

                @liv-in-sky sagte in Mal wieder Webseite auslesen:

                @homoran

                das war ja dann einfach für mich 🙂

                das jetzt wahrscheinlich auch 😉

                Heute morgen bekomme ich einen Schreck:
                Wartung01.png

                Haben die etwa schon wieder die Website geändert???
                Auf der Website standen aber tatsächlich keine Werte - jetzt steht da:
                Wartung.png

                Also wollte ich das Skript (function) ändern, dass nur geschrieben wird, wenn der Wert > 0 ist.

                Habe mal so angefangen:

                var parse = require('csv-parse');
                // var input = require('fs').readFileSync('/Daten/covid19_5.csv').toString();
                
                
                
                try {
                  require("request")('https://www.lzg.nrw.de/covid19/daten/covid19_5.csv', async function (error, response, result) {
                   // console.log(result);
                   
                parse(result, {comment: '#'}, function(err, output){
                	// show result
                	// console.log(JSON.stringify(output));
                for(let r=0;r<output.length;r++){
                   // log(output[r][46])
                }
                
                d65=Number(Math.round((output[output.length-1][74])*10000)/100)
                log(d65)//Intensivbelegung
                d37=Number(Math.round((output[output.length-1][46]) * 100)/100)// /1000
                log(d37)//Hospitalisierung
                d35=Number(Math.round((output[output.length-1][44]) * 100)/100)// /1000
                log(d35)//Inzidenz
                d99=Number(Math.round((output[output.length-1][46])/(output[output.length-1][44])*10000)/100)
                log(d99)//Prozent Hospitalisierte;
                
                if (d65>0)
                setState(s65,d65,true);
                
                setState(s35,d35,true)
                setState(s37,d37,true)
                setState(s99,d99,true)
                });
                  
                 }).on("error", function (e) {console.error(e);});
                } catch (e) { console.error(e); }
                

                Mit viel trial & error habe ich jetzt schon mal keine Meckerwellen mehr in Zeile 25-28.

                Wäre das so richtig??

                Mit Klammern und Semikola hab ich es noch nicht 😞

                liv-in-sky 1 Reply Last reply Reply Quote 0
                • liv-in-sky
                  liv-in-sky @Homoran last edited by

                  @homoran sagte in Mal wieder Webseite auslesen:

                  if (d65>0)

                  schreibe es in eine zeile, dann ist klarer, dass es zusammengehört - es gilt ja nur für deneinen setState, der danach kommt

                  if (d65>0) setState(s65,d65,true);
                  
                  

                  willst du alle setState vermeiden

                  if (d65>0) {setState(s65,d65,true);
                                    setState(s35,d35,true)
                                    setState(s37,d37,true)
                                    setState(s99,d99,true)
                                    }
                  
                  Homoran 1 Reply Last reply Reply Quote 0
                  • Homoran
                    Homoran Global Moderator Administrators @liv-in-sky last edited by

                    @liv-in-sky sagte in Mal wieder Webseite auslesen:

                    willst du alle setState vermeiden

                    ja, aber nur wenn auch deren Wert jeweils 0 ist.

                    Also werde ich die Zeile if (d65>0) setState(s65,d65,true); entsprechend anpassen

                    DANKE!

                    liv-in-sky 1 Reply Last reply Reply Quote 0
                    • liv-in-sky
                      liv-in-sky @Homoran last edited by

                      @homoran

                      habe keinen zugriff mehr auf link - ws ist bei dir ?

                      Homoran 1 Reply Last reply Reply Quote 0
                      • Homoran
                        Homoran Global Moderator Administrators @liv-in-sky last edited by

                        @liv-in-sky
                        da war Wartung. Dann klappte es wieder einmal. jetzt ist schluss.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post

                        Support us

                        ioBroker
                        Community Adapters
                        Donate

                        699
                        Online

                        31.8k
                        Users

                        80.0k
                        Topics

                        1.3m
                        Posts

                        monitoring
                        3
                        53
                        1231
                        Loading More Posts
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes
                        Reply
                        • Reply as topic
                        Log in to reply
                        Community
                        Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                        The ioBroker Community 2014-2023
                        logo