Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. Wunsch: Pollenflug-(Adapter/wasauchimmer)

    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

    Wunsch: Pollenflug-(Adapter/wasauchimmer)

    This topic has been deleted. Only users with topic management privileges can see it.
    • Thisoft
      Thisoft last edited by

      Hast du bei den betreffenden DP's die SQL-Historie aktiviert?

      1 Reply Last reply Reply Quote 0
      • S
        simpixo last edited by

        Ja hatte ich aktiv, aber nach dem löschen habe ich sie noch nicht wieder aktiviert!

        Hat das was damit zutun!?

        Gesendet von iPhone mit Tapatalk Pro

        1 Reply Last reply Reply Quote 0
        • Thisoft
          Thisoft last edited by

          Jein 😉

          Wenn du sie noch nicht wieder aktiviert hast dürfte der Fehler zwar m.E. nicht auftreten, aber es ist definitiv so dass es Probleme gibt wenn man einen DP früher als Text definiert hatte und dann mal auf Zahl geändert. Die alten (Text)Werte stehen immer noch in der Datenbank und bei einer neuen Abfrage auf Zahlenwerte gibt's dann Ärger. Brauchst du die Werte von früher noch? Wenn nicht solltest Du die aus der Db löschen, zum Löschen einzelner DP's aus der SQL-Db gibt's aktuell im Forum Threads…

          1 Reply Last reply Reply Quote 0
          • S
            simpixo last edited by

            Ok das versuche ich mal, guter Ansatz!

            Vielleicht ist es der Grund! Ich werde berichten

            Gruß

            Adrian

            Gesendet von iPhone mit Tapatalk Pro

            1 Reply Last reply Reply Quote 0
            • S
              simpixo last edited by

              Hallo

              leider hat das nicht geholfen. Der Fehler ist immer noch da auch nachdem ich die Daten aus der DB gelöscht habe

              @Steinwedel @steinwedel:

              Hilfe 🙂 `

              Weißt du das was da los ist? Wurde auf der Website was geändert? Ich erhalte nämlich die folgenden Fehler ???? :shock:

              javascript.0   2017-02-19 11:58:31.686   info   script.js.Umwelt.Pollenflug_Vorhersage: erle undefined
              javascript.0   2017-02-19 11:58:31.686   warn   Wrong type of javascript.0.Umwelt.Pollenvorhersage.heute.erle: "undefined". Please fix, while deprecated and will not work in next versions.
              
              javascript.0   2017-02-19 11:58:31.681   info   script.js.Umwelt.Pollenflug_Vorhersage: hasel undefined
              javascript.0   2017-02-19 11:58:31.680   warn   Wrong type of javascript.0.Umwelt.Pollenvorhersage.heute.hasel: "undefined". Please fix, while deprecated and will not work in next versions.
              
              

              Danke in voraus

              Gruß

              Adrian

              1 Reply Last reply Reply Quote 0
              • S
                simpixo last edited by

                Hallo zusammen

                ohne irgendein zutun funktioniert es wieder ohne einen Fehler im Log! Auch die DP´s werden richtig gefüllt 😉 komische Sache :roll:

                Gruß

                Adrian

                1 Reply Last reply Reply Quote 0
                • R
                  Romö last edited by

                  Hallo

                  ich bin ein ioBroker Anfänger und gerade am Zusammenstellen einer individuellen Smarthome Steuerung.

                  Seit Tagen versuche ich schon das Script zur Polenabfrage hinzubekommen. Leider werden Pollen die größer 0 sind nicht angezeigt.

                  javascript.0	2018-01-08 14:04:41.396	info	script.js.Wetter.Pollenflug.Pollenflug: hasel undefined
                  javascript.0	2018-01-08 14:04:41.395	info	script.js.Wetter.Pollenflug.Pollenflug: setForeignState(id=javascript.0.WetterOnline.pollenvorhersage.heute.hasel, state=undefined)
                  

                  ich verwende folgendes Script:

                  `/* Pollenflug Parser von wetteronline.de
                  
                  http://forum.iobroker.net/viewtopic.php?f=23&t=2799&sid=936235bdac98a70a1d8672897d334a07#p25266
                  
                  05.05.2016 erstellt von steinwedel für homoran
                  06.05.2016 Anpassung durch pix
                  */
                  
                  var url = "https://www.wetteronline.de/pollen/jesenwang";
                  var pfad = "WetterOnline.pollenvorhersage.";
                  var logging = true;
                  
                  // ab hier nix ändern
                  var Pollenarten = ['Pappel','Weide','Ulme','Birke','Buche','Ampfer','Roggen','Gräser','Eiche','Wegerich','Beifuß','Ambrosia','Hasel','Erle' ];
                  var tage_vorhersage = ['heute','morgen','übermorgen'];
                  var request = require('request');
                  
                  function dpAnlegen(y) {
                      for(var i=0;i<pollenarten.length;i++) {/createstate(pfad/+/tage_vorhersage[y]/'.'/pollenarten[i].tolowercase(),0,/name:/'wetteronline/pollenvorhersage/'/pollenarten[i],/desc:/'vorhersage/für/pollenbelastung/durch/type:/'number'/});/}/function/readpollenwetter(x)/var/options="{" url:/((x="">0) ? url + '?fcdatstr=' + tag(x) : url),   // korrekten Link erstellen
                          headers: {
                              'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1'
                          }
                      };    
                      try {
                          request(options, function (error, response, body) {
                              if (!error && response.statusCode == 200) {              // kein Fehler, Inhalt in body
                                  body=body.replaceAll(String.fromCharCode(13),"");
                                  body=body.replaceAll(String.fromCharCode(10),"");
                                  body=body.replaceAll(String.fromCharCode(9),"");
                                  body=strip_tags(body);
                                  for(var i=0;i<pollenarten.length;i++) 0/60/1000/20160506/{/setstate(pfad/+/tage_vorhersage[x]/'.'/pollenarten[i].tolowercase(),/getpollenindex(pollenarten[i],body));/if/(logging)/log(pollenarten[i].tolowercase()/'/}/else/log("statuscode="+response.statusCode);
                                  log(error,'error');                               // Error beim Einlesen
                              }
                          });
                      } catch (e) {
                          log('Fehler (try) leseWebseite: ' + e, 'error');
                      }
                  }
                  
                  function strip_tags(data) {
                      var rueckgabe = data.replace(/(&nbsp;|<([^>]+)>)/ig, " ");/return(rueckgabe);/function/getpollenindex(pflanze,/html)/var/code="{'kein'" :0,/'schwach'/:1,/'mäßig'/:2,/'stark'/:3};/result/;/start="html.indexOf(pflanze)+pflanze.length;" stop="result.indexOf('" ');/return/code[result];/string.prototype.replaceall="function(find," replace)/str="this;" str.replace(new/regexp(find.replace(/([.*+?^="!:${}()|[]\/\])/g," "\\$1"),/'g'),/replace);/};/tag/(abstand)/eingabe/0,/1,/2,/.../jetzt="new" date();/jetzt.sethours(0);/jetzt.setminutes(0);/jetzt.setseconds(0);/jetzt.setmilliseconds(0);/newdate="new" newdate.settime(jetzt.gettime()/(24/*/abstand)/);/heute/anzahl/tage/ins/millisekunden/date="newdate.getDate();" month="newdate.getMonth()+1;" year="newdate.getFullYear();" </10)/?/'0'/:/date;/month;/rueckgabe="year.toString()+month.toString()+date.toString();" log('datum/in/link:/rueckgabe);/(rueckgabe);/ausgabe/z.b./alle/aus/dem/array/durchgehen/(x)/main()/for/(var/x="0;" tage_vorhersage.length;/x++)/dpanlegen(x);/readpollenwetter(x);/main();/schedule("5/*",/main);<e=""></pollenarten.length;i++)></pollenarten.length;i++)>`
                  
                  kann mir wer einen Tip geben
                  
                  Viele Grüße Hans[/i][/i][/i][/i][/i][/i][/i]
                  
                  1 Reply Last reply Reply Quote 0
                  • lobomau
                    lobomau last edited by

                    @Romö:

                    Hallo

                    ich bin ein ioBroker Anfänger und gerade am Zusammenstellen einer individuellen Smarthome Steuerung.

                    Seit Tagen versuche ich schon das Script zur Polenabfrage hinzubekommen. Leider werden Pollen die größer 0 sind nicht angezeigt.

                    javascript.0	2018-01-08 14:04:41.396	info	script.js.Wetter.Pollenflug.Pollenflug: hasel undefined
                    javascript.0	2018-01-08 14:04:41.395	info	script.js.Wetter.Pollenflug.Pollenflug: setForeignState(id=javascript.0.WetterOnline.pollenvorhersage.heute.hasel, state=undefined)
                    

                    ich verwende folgendes Script:

                    `/* Pollenflug Parser von wetteronline.de
                    
                    http://forum.iobroker.net/viewtopic.php?f=23&t=2799&sid=936235bdac98a70a1d8672897d334a07#p25266
                    
                    05.05.2016 erstellt von steinwedel für homoran
                    06.05.2016 Anpassung durch pix
                    */
                    
                    var url = "https://www.wetteronline.de/pollen/jesenwang";
                    var pfad = "WetterOnline.pollenvorhersage.";
                    var logging = true;
                    
                    // ab hier nix ändern
                    var Pollenarten = ['Pappel','Weide','Ulme','Birke','Buche','Ampfer','Roggen','Gräser','Eiche','Wegerich','Beifuß','Ambrosia','Hasel','Erle' ];
                    var tage_vorhersage = ['heute','morgen','übermorgen'];
                    var request = require('request');
                    
                    function dpAnlegen(y) {
                        for(var i=0;i<pollenarten.length;i++) {/createstate(pfad/+/tage_vorhersage[y]/'.'/pollenarten[i].tolowercase(),0,/name:/'wetteronline/pollenvorhersage/'/pollenarten[i],/desc:/'vorhersage/für/pollenbelastung/durch/type:/'number'/});/}/function/readpollenwetter(x)/var/options="{" url:/((x="">0) ? url + '?fcdatstr=' + tag(x) : url),   // korrekten Link erstellen
                            headers: {
                                'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1'
                            }
                        };    
                        try {
                            request(options, function (error, response, body) {
                                if (!error && response.statusCode == 200) {              // kein Fehler, Inhalt in body
                                    body=body.replaceAll(String.fromCharCode(13),"");
                                    body=body.replaceAll(String.fromCharCode(10),"");
                                    body=body.replaceAll(String.fromCharCode(9),"");
                                    body=strip_tags(body);
                                    for(var i=0;i<pollenarten.length;i++) 0/60/1000/20160506/{/setstate(pfad/+/tage_vorhersage[x]/'.'/pollenarten[i].tolowercase(),/getpollenindex(pollenarten[i],body));/if/(logging)/log(pollenarten[i].tolowercase()/'/}/else/log("statuscode="+response.statusCode);
                                    log(error,'error');                               // Error beim Einlesen
                                }
                            });
                        } catch (e) {
                            log('Fehler (try) leseWebseite: ' + e, 'error');
                        }
                    }
                    
                    function strip_tags(data) {
                        var rueckgabe = data.replace(/(&nbsp;|<([^>]+)>)/ig, " ");/return(rueckgabe);/function/getpollenindex(pflanze,/html)/var/code="{'kein'" :0,/'schwach'/:1,/'mäßig'/:2,/'stark'/:3};/result/;/start="html.indexOf(pflanze)+pflanze.length;" stop="result.indexOf('" ');/return/code[result];/string.prototype.replaceall="function(find," replace)/str="this;" str.replace(new/regexp(find.replace(/([.*+?^="!:${}()|[]\/\])/g," "\\$1"),/'g'),/replace);/};/tag/(abstand)/eingabe/0,/1,/2,/.../jetzt="new" date();/jetzt.sethours(0);/jetzt.setminutes(0);/jetzt.setseconds(0);/jetzt.setmilliseconds(0);/newdate="new" newdate.settime(jetzt.gettime()/(24/*/abstand)/);/heute/anzahl/tage/ins/millisekunden/date="newdate.getDate();" month="newdate.getMonth()+1;" year="newdate.getFullYear();" </10)/?/'0'/:/date;/month;/rueckgabe="year.toString()+month.toString()+date.toString();" log('datum/in/link:/rueckgabe);/(rueckgabe);/ausgabe/z.b./alle/aus/dem/array/durchgehen/(x)/main()/for/(var/x="0;" tage_vorhersage.length;/x++)/dpanlegen(x);/readpollenwetter(x);/main();/schedule("5/*",/main);<e=""></pollenarten.length;i++)></pollenarten.length;i++)>`
                    
                    kann mir wer einen Tip geben
                    
                    Viele Grüße Hans
                    "request" als npm Modul ist installiert? 
                    
                    Ich habe es auch eben installiert. Sollte eigentlich für morgen Hasel schwach anzeigen. Tut es aber nicht. Gibt nur Warnungen:
                    `~~[code]~~javascript.0	2018-01-11 20:43:53.896	info	script.js.common.Pollenflug: erle undefined
                    javascript.0	2018-01-11 20:43:53.895	warn	at process._tickCallback (internal/process/next_tick.js:104:9)
                    javascript.0	2018-01-11 20:43:53.895	warn	at _combinedTickCallback (internal/process/next_tick.js:80:11)
                    javascript.0	2018-01-11 20:43:53.895	warn	at endReadableNT (_stream_readable.js:974:12)
                    javascript.0	2018-01-11 20:43:53.895	warn	at IncomingMessage.emit (events.js:185:7)
                    javascript.0	2018-01-11 20:43:53.895	warn	at emitNone (events.js:91:20)
                    javascript.0	2018-01-11 20:43:53.894	warn	at IncomingMessage.g (events.js:292:16)
                    javascript.0	2018-01-11 20:43:53.894	warn	at IncomingMessage. (/opt/iobroker/node_modules/iobroker.javascript/node_modules/request/request.js:1085:12)
                    javascript.0	2018-01-11 20:43:53.894	warn	at Request.emit (events.js:188:7)
                    javascript.0	2018-01-11 20:43:53.893	warn	at emitOne (events.js:96:13)
                    javascript.0	2018-01-11 20:43:53.893	warn	at Request. (/opt/iobroker/node_modules/iobroker.javascript/node_modules/request/request.js:1163:10)
                    javascript.0	2018-01-11 20:43:53.893	warn	at Request.emit (events.js:191:7)
                    javascript.0	2018-01-11 20:43:53.893	warn	at emitTwo (events.js:106:13)
                    javascript.0	2018-01-11 20:43:53.892	warn	at Request.self.callback (/opt/iobroker/node_modules/iobroker.javascript/node_modules/request/request.js:186:22)
                    javascript.0	2018-01-11 20:43:53.892	warn	at Request._callback (script.js.common.Pollenflug:43:17)
                    javascript.0	2018-01-11 20:43:53.888	warn	Wrong type of javascript.0.WetterOnline.pollenvorhersage.übermorgen.erle: "undefined". Please fix, while deprecated and will not work in next versions.
                    javascript.0	2018-01-11 20:43:53.887	info	script.js.common.Pollenflug: hasel undefined
                    javascript.0	2018-01-11 20:43:53.887	warn	at process._tickCallback (internal/process/next_tick.js:104:9)
                    javascript.0	2018-01-11 20:43:53.887	warn	at _combinedTickCallback (internal/process/next_tick.js:80:11)
                    javascript.0	2018-01-11 20:43:53.886	warn	at endReadableNT (_stream_readable.js:974:12)
                    javascript.0	2018-01-11 20:43:53.886	warn	at IncomingMessage.emit (events.js:185:7)
                    javascript.0	2018-01-11 20:43:53.886	warn	at emitNone (events.js:91:20)
                    javascript.0	2018-01-11 20:43:53.885	warn	at IncomingMessage.g (events.js:292:16)
                    javascript.0	2018-01-11 20:43:53.885	warn	at IncomingMessage. (/opt/iobroker/node_modules/iobroker.javascript/node_modules/request/request.js:1085:12)
                    javascript.0	2018-01-11 20:43:53.885	warn	at Request.emit (events.js:188:7)
                    javascript.0	2018-01-11 20:43:53.885	warn	at emitOne (events.js:96:13)
                    javascript.0	2018-01-11 20:43:53.884	warn	at Request. (/opt/iobroker/node_modules/iobroker.javascript/node_modules/request/request.js:1163:10)
                    javascript.0	2018-01-11 20:43:53.884	warn	at Request.emit (events.js:191:7)
                    javascript.0	2018-01-11 20:43:53.884	warn	at emitTwo (events.js:106:13)
                    javascript.0	2018-01-11 20:43:53.884	warn	at Request.self.callback (/opt/iobroker/node_modules/iobroker.javascript/node_modules/request/request.js:186:22)
                    javascript.0	2018-01-11 20:43:53.883	warn	at Request._callback (script.js.common.Pollenflug:43:17)
                    javascript.0	2018-01-11 20:43:53.882	warn	Wrong type of javascript.0.WetterOnline.pollenvorhersage.übermorgen.hasel: "undefined". Please fix, while deprecated and will not work in next versions.
                    javascript.0	2018-01-11 20:43:53.881	info	script.js.common.Pollenflug: ambrosia 0
                    javascript.0	2018-01-11 20:43:53.880	info	script.js.common.Pollenflug: beifuß 0
                    javascript.0	2018-01-11 20:43:53.880	info	script.js.common.Pollenflug: wegerich 0
                    javascript.0	2018-01-11 20:43:53.879	info	script.js.common.Pollenflug: eiche 0
                    javascript.0	2018-01-11 20:43:53.878	info	script.js.common.Pollenflug: gräser 0
                    javascript.0	2018-01-11 20:43:53.878	info	script.js.common.Pollenflug: roggen 0
                    javascript.0	2018-01-11 20:43:53.877	info	script.js.common.Pollenflug: ampfer 0
                    javascript.0	2018-01-11 20:43:53.877	info	script.js.common.Pollenflug: buche 0
                    javascript.0	2018-01-11 20:43:53.876	info	script.js.common.Pollenflug: birke 0
                    javascript.0	2018-01-11 20:43:53.874	info	script.js.common.Pollenflug: ulme 0
                    javascript.0	2018-01-11 20:43:53.873	info	script.js.common.Pollenflug: weide 0
                    javascript.0	2018-01-11 20:43:53.872	info	script.js.common.Pollenflug: pappel 0
                    javascript.0	2018-01-11 20:43:53.850	info	script.js.common.Pollenflug: erle undefined[/code]`[/i][/i][/i][/i][/i][/i][/i]
                    ``` ` 
                    1 Reply Last reply Reply Quote 0
                    • ?
                      A Former User last edited by

                      Hallo Zusammen,

                      habe das gleiche Problem mit dem Script…. denke mal, die Website wurde geändert... hab mal kurz draufeschaut in der Tabelle mit den Pollen sind keine Zahlen mehr sondern Symbole (icons) mit dem entsprechenden Wert, denke mals das "parsing" muss hier angepasst werden.

                      Equilora

                      1 Reply Last reply Reply Quote 0
                      • R
                        robsdobs last edited by

                        Hallo,

                        ich hab eine angepasste Form des Scriptes, die bei mir funktioniert.

                        Aber Achtung, ist nicht Javascript sondern TypeScript –>also den richtigen Engine-Typ wählen:
                        1367_bild_050.png

                        `// ########################################################################################################
                        // Polleninfo auswerten
                        // Version 1.3
                        // ########################################################################################################
                        
                        /**************************************************************************************************
                        * Initiale Optionen
                        **************************************************************************************************/
                        
                        var options = {
                          url: "https://www.wetteronline.de/pollen/bad-arolsen",
                          headers: {
                            'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1'
                          }
                        };
                        
                        /**************************************************************************************************
                        * Globale TypeScript Definitionen
                        **************************************************************************************************/
                        // -----------------------------------------------------------------------------	
                        /* Die folgenden Funktionen sind bei mir in einem globalen script.
                           Wenn man diese global definieren will, muss man das lokal referenzieren mit:
                        declare function isPrimitive(obj:any):boolean
                        declare function logDebug(...param: any[]):void;
                        declare function logInfo(...param: any[]):void;
                        declare function logWarning(...param: any[]):void;
                        declare function logError(...param: any[]):void;
                        */
                        
                        /**
                         * Function for check if a object is a primitive object (string, number, etc)
                         * @param    obj           any object to check if it is a primitive object
                         * @returns              boolean which is true if object in parameter is a primitive object
                         */
                        function isPrimitive(obj:any):boolean {
                            return (obj !== Object(obj));
                        }
                        
                        /**
                         * write any objects given as parameter to log as debug
                         * @param    param       a nist of different objects
                         */
                        function logDebug(...param: any[]):void {
                        	if (arguments.length > 0) {
                        		var text:string[] = [];
                        		for (var i = 0; i < arguments.length; i++) {
                                    if (typeof arguments[i] === 'string' || arguments[i] instanceof String) {
                                        text.push(arguments[i]);
                        		    } else if(arguments[i] === null) {
                                        text.push('null');
                        		    } else if(arguments[i] === undefined) {
                                        text.push('undefined');
                                    } else if (isPrimitive(arguments[i])) {
                                        text.push(arguments[i]);
                                    } else {
                                        text.push(JSON.stringify(arguments[i]));
                                    }
                                    //enum close bracket cannot be found in "channel[state.id=*.TEMPERATURE](rooms=WZ|Wohnung|Wohnzimmer"
                        
                        		}
                        		log(text.join(' '), 'debug');
                        	}
                        }
                        
                        /**
                         * write any objects given as parameter to log as Information
                         * @param    param       a nist of different objects
                         */
                        function logInfo(...param: any[]):void {
                        	if (arguments.length > 0) {
                        		var text:string[] = [];
                        		for (var i = 0; i < arguments.length; i++) {
                                    if (typeof arguments[i] === 'string' || arguments[i] instanceof String) {
                                        text.push(arguments[i]);
                        		    } else if(arguments[i] === null) {
                                        text.push('null');
                        		    } else if(arguments[i] === undefined) {
                                        text.push('undefined');
                                    } else if (isPrimitive(arguments[i])) {
                                        text.push(arguments[i]);
                                    } else {
                                        text.push(JSON.stringify(arguments[i]));
                                    }
                                    //enum close bracket cannot be found in "channel[state.id=*.TEMPERATURE](rooms=WZ|Wohnung|Wohnzimmer"
                        
                        		}
                        		log(text.join(' '), 'info');
                        		setState("javascript.0.Ereignisliste.event",'INFO|'+text.join(' '));
                        	}
                            //logEnhanced(logtext, 'info');
                        	//console.debug(p);
                        	//logs(logtext,loglevels.debug);
                        }
                        
                        /**
                         * write any objects given as parameter to log as warning
                         * @param    param       a nist of different objects
                         */
                        function logWarning(...param: any[]):void {
                        	if (arguments.length > 0) {
                        		var text:string[] = [];
                        		for (var i = 0; i < arguments.length; i++) {
                                    if (typeof arguments[i] === 'string' || arguments[i] instanceof String) {
                                        text.push(arguments[i]);
                        		    } else if(arguments[i] === null) {
                                        text.push('null');
                        		    } else if(arguments[i] === undefined) {
                                        text.push('undefined');
                                    } else if (isPrimitive(arguments[i])) {
                                        text.push(arguments[i]);
                                    } else {
                                        text.push(JSON.stringify(arguments[i]));
                                    }
                                    //enum close bracket cannot be found in "channel[state.id=*.TEMPERATURE](rooms=WZ|Wohnung|Wohnzimmer"
                        
                        		}
                        		log(text.join(' '), 'warn');
                        		setState("javascript.0.Ereignisliste.event",'WARN|'+text.join(' '));
                        	}
                            //logEnhanced(logtext, 'warn');
                        	//console.warn(p);
                        	//logs(logtext,loglevels.warn);
                        }
                        
                        /**
                         * write any objects given as parameter to log as error
                         * @param    param       a nist of different objects
                         */
                        function logError(...param: any[]):void {
                        	if (arguments.length > 0) {
                        		var text:string[] = [];
                        		for (var i = 0; i < arguments.length; i++) {
                                    if (typeof arguments[i] === 'string' || arguments[i] instanceof String) {
                                        text.push(arguments[i]);
                        		    } else if(arguments[i] === null) {
                                        text.push('null');
                        		    } else if(arguments[i] === undefined) {
                                        text.push('undefined');
                                    } else if (isPrimitive(arguments[i])) {
                                        text.push(arguments[i]);
                                    } else {
                                        text.push(JSON.stringify(arguments[i]));
                                    }
                                    //enum close bracket cannot be found in "channel[state.id=*.TEMPERATURE](rooms=WZ|Wohnung|Wohnzimmer"
                        
                        		}
                        		log(text.join(' '), 'error');
                        		setState("javascript.0.Ereignisliste.event",'ERROR|'+text.join(' '));
                        	}
                        }
                        // ########################################################################################################
                        // Lokale TypeScript Definitionen
                        // ########################################################################################################
                        import request = require("request");
                        
                        var Pollenarten:string[] = ['Erle','Hasel','Pappel','Weide','Ulme','Birke','Buche','Ampfer','Roggen','Gräser','Eiche','Wegerich','Beifuß','Ambrosia'];
                        
                        function strip_tags(data:string):string {
                            var rueckgabe:string = data.replace(/( |<([^>]+)>)/ig, "");
                            return(rueckgabe);
                        }
                        
                        function GetPollenIndex(pflanze:string, html:string):number {
                            var code ={'kein':0, 'schwach':1, 'mäßig':2, 'stark':3}; 
                            var result:string= "";
                            var start:number =html.indexOf(pflanze)+pflanze.length;
                        
                            result=html.slice(start);
                            result=result.trim();
                        	//logDebug('result for ',pflanze,html.slice(0,600));
                            var stop:number =result.indexOf(' ');
                            result=result.slice(0,stop);
                            //logDebug('pflanze=',pflanze,'code=',result);
                            return code[result];
                        }
                        
                        function initializePollenwetter():void {
                            for(var i=0;i<pollenarten.length;i++) {/createstate("wetter.pollenvorhersage."+pollenarten[i].tolowercase(),0,false,/name:/'pollenart/'+/pollenarten[i],/type:/"number",/role:/'value',/read:/true,/write:/false});/}/readpollenwetter();/function/readpollenwetter():void/logdebug("start");/try/request(options,/(error,/response,/body):void/if/(!error/&&/response.statuscode="=" 200)/kein/fehler,/inhalt/in/body/'/');/'');/var/start:number="body.indexOf('<ul" id="pollentable">');
                        				if (start>-1) { body=body.slice(start); }
                                        body=strip_tags(body);
                        				//logDebug('body',body);
                                        for(var i=0;i<pollenarten.length;i++) 0/5/{/setstate("wetter.pollenvorhersage."+pollenarten[i].tolowercase(),getpollenindex(pollenarten[i],body));/}/else/loginfo("statuscode="+response.statusCode);
                                        logError(error);                               // Error beim Einlesen
                                    }
                                });
                            } catch (e) {
                                logError('Fehler (try) leseWebseite: ' + e);
                            }
                        }
                        
                        initializePollenwetter();
                        schedule(" */*",/readpollenwetter);<e=""></pollenarten.length;i++)></pollenarten.length;i++)>`[/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i]
                        
                        1 Reply Last reply Reply Quote 0
                        • R
                          Romö last edited by

                          Hallo robsdobs,

                          ich komm mit deinem Script nicht klar. Es enthält globale und lokale Teile. Wo soll ich was speichern.

                          Wäre toll wenn Du mir helfen könntest.

                          Gruß

                          Romö

                          1 Reply Last reply Reply Quote 0
                          • R
                            robsdobs last edited by

                            Du kannst alles komplett in einem Script unter common lassen.

                            Ich habe die Teile, welche bei mir global sind reinkopiert.

                            1 Reply Last reply Reply Quote 0
                            • D
                              DiJaexxl last edited by

                              Hallo, ich habe die Zeile mit Pollen in Dresen noch ausgetauscht.

                              Aber ich bekomme folgende Log Fehlermeldungen:

                              javascript.1	2018-01-21 13:05:40.127	error	ERROR: Property 'replaceAll' does not exist on type 'String'.
                              javascript.1	2018-01-21 13:05:40.127	error	^
                              javascript.1	2018-01-21 13:05:40.127	error	String.prototype.replaceAll = function(this: string, find: string, replace: string): string {
                              javascript.1	2018-01-21 13:05:40.127	error	script.js.Test.Pollen_test: TypeScript compilation failed:
                              javascript.1	2018-01-21 13:05:40.112	info	script.js.Test.Pollen_test: compiling TypeScript source...
                              
                              
                              1 Reply Last reply Reply Quote 0
                              • R
                                robsdobs last edited by

                                Danke für die Rückmeldung. Ich habe das Script oben nochmal angepasst.

                                1 Reply Last reply Reply Quote 0
                                • D
                                  DiJaexxl last edited by

                                  Hallo,

                                  mmmmmh. Mache ich was Falsch?

                                  Das wirft mein Logfile raus:

                                  javascript.0	2018-01-26 19:50:35.479	error	ERROR: Property 'replaceAll' does not exist on type 'String'.
                                  javascript.0	2018-01-26 19:50:35.479	error	^
                                  javascript.0	2018-01-26 19:50:35.479	error	String.prototype.replaceAll = function(this: string, find: string, replace: string): string {
                                  javascript.0	2018-01-26 19:50:35.479	error	ERROR: Property 'replaceAll' does not exist on type 'String'.
                                  javascript.0	2018-01-26 19:50:35.479	error	^
                                  javascript.0	2018-01-26 19:50:35.479	error	if (typeof String.prototype.replaceAll === 'undefined') {
                                  javascript.0	2018-01-26 19:50:35.479	error	script.js.Test.Pollen_test: TypeScript compilation failed: 
                                  

                                  Ergebnisse kommen aber leider nicht raus

                                  1 Reply Last reply Reply Quote 0
                                  • I
                                    ioTechnik last edited by

                                    Hallo robsdobs

                                    Ich habe das gleiche Problem wie DiJaexxl. Dabei hoffte ich, dass Dein Script angepasst ist, wie Du beschrieben hast.

                                    Ist es das Script aus Beitrag oben

                                    http://forum.iobroker.net/viewtopic.php … 40#p115126

                                    Geht bei mir leider nicht

                                    Wäre sehr dankbar für weitere Unterstützung

                                    Habe das für Testzwecke auf nem Pi1. Der neue kommt erst heute.

                                    1 Reply Last reply Reply Quote 0
                                    • R
                                      robsdobs last edited by

                                      Ok, schaue ich mir heute Abend an.

                                      Gesendet von meinem A0001 mit Tapatalk

                                      1 Reply Last reply Reply Quote 0
                                      • K
                                        Knusterus last edited by

                                        hallo

                                        Ich hänge mich mal mit rein. Ich scheitere leider schon beim Enginetyp. Bei mir steht nur "Blocky, Javascript und Coffeescript.

                                        So habe jetzt den JS. Adapter aktualisiert jetzt habe ich auch Typescript.

                                        Jetzt habe ich den Pollenteil unter Common in ein neues Skript eigefügt. Und bekomme folgenden Fehler.

                                        `Log
                                        17:57:20.989	[info]	javascript.0 script.js.common.Pollen: compiling TypeScript source...
                                        17:57:20.989	[error]	javascript.0 script.js.common.Pollen: TypeScript compilation failed: createStateG("wetter.pollenvorhersage."+Pollenarten[i].toLowerCase(),0,'number','value','Pollenart '+Pollenarten[i]); ^ ERROR: Cannot find name 'createStateG'. Did you mean 'createState'? request(options, function (error, response, body):void { ^ ERROR: Cannot find name 'request'. Did you mean 'Request'? logInfo("StatusCode="+response.statusCode); ^ ERROR: Cannot find name 'logInfo'. logError(error); // Error beim Einlesen ^ ERROR: Cannot find name 'logError'. Did you mean 'onerror'? logError('Fehler (try) leseWebseite: ' + e); ^ ERROR: Cannot find name 'logError'. Did you mean 'onerror'?` 
                                        
                                        Hier noch mal mein Script.
                                        
                                        `~~[code]~~var Pollenarten:string[] = ['Erle','Hasel','Pappel','Weide','Ulme','Birke','Buche','Ampfer','Roggen','Gräser','Eiche','Wegerich','Beifuß','Ambrosia'];
                                        
                                        var options = {
                                          url: "https://www.wetteronline.de/pollen/bad-arolsen",
                                          headers: {
                                            'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1'
                                          }
                                        };
                                        
                                        function strip_tags(data:string):string {
                                            var rueckgabe:string = data.replace(/( |<([^>]+)>)/ig, "");
                                            return(rueckgabe);
                                        }
                                        
                                        function GetPollenIndex(pflanze:string, html:string):number {
                                            var code ={'kein':0, 'schwach':1, 'mäßig':2, 'stark':3}; 
                                            var result:string= "";
                                            var start:number =html.indexOf(pflanze)+pflanze.length;
                                        
                                            result=html.slice(start);
                                            result=result.trim();
                                           //logDebug('result for ',pflanze,html.slice(0,600));
                                            var stop:number =result.indexOf(' ');
                                            result=result.slice(0,stop);
                                            //logDebug('pflanze=',pflanze,'code=',result);
                                            return code[result];
                                        }
                                        
                                        function initializePollenwetter():void {
                                            for(var i=0;i<pollenarten.length;i++) {/createstateg("wetter.pollenvorhersage."+pollenarten[i].tolowercase(),0,'number','value','pollenart/'+pollenarten[i]);/}/readpollenwetter();/function/readpollenwetter():void/logdebug("start");/try/request(options,/(error,/response,/body):void/if/(!error/&&/response.statuscode="=" 200)/kein/fehler,/inhalt/in/body/");/var/start:number="body.indexOf('<ul" id="pollentable">');
                                                    if (start>-1) { body=body.slice(start); }
                                                        body=strip_tags(body);
                                                    //logDebug('body',body);
                                                        for(var i=0;i<pollenarten.length;i++) 0/5/{/setstate("wetter.pollenvorhersage."+pollenarten[i].tolowercase(),getpollenindex(pollenarten[i],body));/}/else/loginfo("statuscode="+response.statusCode);
                                                        logError(error);                               // Error beim Einlesen
                                                    }
                                                });
                                            } catch (e) {
                                                logError('Fehler (try) leseWebseite: ' + e);
                                            }
                                        }
                                        
                                        initializePollenwetter();
                                        schedule(" */*",/readpollenwetter);<e=""></pollenarten.length;i++)></pollenarten.length;i++)>`
                                        
                                        Bitte um Hilfe
                                        
                                        Knusterus[/i][/i][/i][/i][/code][/i][/i]
                                        
                                        1 Reply Last reply Reply Quote 0
                                        • R
                                          robsdobs last edited by

                                          @ioTechnik und @DiJaexxl mir ist zwar nicht ganz klar wo der Fehler herkommt, ich habe jetzt eine Version ohne replaceAll erstellt.

                                          @Knusterus: In deinem Script fehlen die Grundfunktionen. Probiere Bitte auch mal dieses Script.

                                          `// ########################################################################################################
                                          // Polleninfo auswerten
                                          // Version 1.3
                                          // ########################################################################################################
                                          
                                          /**************************************************************************************************
                                          * Initiale Optionen
                                          **************************************************************************************************/
                                          
                                          var options = {
                                            url: "https://www.wetteronline.de/pollen/bad-arolsen",
                                            headers: {
                                              'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1'
                                            }
                                          };
                                          
                                          /**************************************************************************************************
                                          * Globale TypeScript Definitionen
                                          **************************************************************************************************/
                                          // -----------------------------------------------------------------------------	
                                          /* Die folgenden Funktionen sind bei mir in einem globalen script.
                                             Wenn man diese global definieren will, muss man das lokal referenzieren mit:
                                          declare function isPrimitive(obj:any):boolean
                                          declare function logDebug(...param: any[]):void;
                                          declare function logInfo(...param: any[]):void;
                                          declare function logWarning(...param: any[]):void;
                                          declare function logError(...param: any[]):void;
                                          */
                                          
                                          /**
                                           * Function for check if a object is a primitive object (string, number, etc)
                                           * @param    obj           any object to check if it is a primitive object
                                           * @returns              boolean which is true if object in parameter is a primitive object
                                           */
                                          function isPrimitive(obj:any):boolean {
                                              return (obj !== Object(obj));
                                          }
                                          
                                          /**
                                           * write any objects given as parameter to log as debug
                                           * @param    param       a nist of different objects
                                           */
                                          function logDebug(...param: any[]):void {
                                          	if (arguments.length > 0) {
                                          		var text:string[] = [];
                                          		for (var i = 0; i < arguments.length; i++) {
                                                      if (typeof arguments[i] === 'string' || arguments[i] instanceof String) {
                                                          text.push(arguments[i]);
                                          		    } else if(arguments[i] === null) {
                                                          text.push('null');
                                          		    } else if(arguments[i] === undefined) {
                                                          text.push('undefined');
                                                      } else if (isPrimitive(arguments[i])) {
                                                          text.push(arguments[i]);
                                                      } else {
                                                          text.push(JSON.stringify(arguments[i]));
                                                      }
                                                      //enum close bracket cannot be found in "channel[state.id=*.TEMPERATURE](rooms=WZ|Wohnung|Wohnzimmer"
                                          
                                          		}
                                          		log(text.join(' '), 'debug');
                                          	}
                                          }
                                          
                                          /**
                                           * write any objects given as parameter to log as Information
                                           * @param    param       a nist of different objects
                                           */
                                          function logInfo(...param: any[]):void {
                                          	if (arguments.length > 0) {
                                          		var text:string[] = [];
                                          		for (var i = 0; i < arguments.length; i++) {
                                                      if (typeof arguments[i] === 'string' || arguments[i] instanceof String) {
                                                          text.push(arguments[i]);
                                          		    } else if(arguments[i] === null) {
                                                          text.push('null');
                                          		    } else if(arguments[i] === undefined) {
                                                          text.push('undefined');
                                                      } else if (isPrimitive(arguments[i])) {
                                                          text.push(arguments[i]);
                                                      } else {
                                                          text.push(JSON.stringify(arguments[i]));
                                                      }
                                                      //enum close bracket cannot be found in "channel[state.id=*.TEMPERATURE](rooms=WZ|Wohnung|Wohnzimmer"
                                          
                                          		}
                                          		log(text.join(' '), 'info');
                                          		setState("javascript.0.Ereignisliste.event",'INFO|'+text.join(' '));
                                          	}
                                              //logEnhanced(logtext, 'info');
                                          	//console.debug(p);
                                          	//logs(logtext,loglevels.debug);
                                          }
                                          
                                          /**
                                           * write any objects given as parameter to log as warning
                                           * @param    param       a nist of different objects
                                           */
                                          function logWarning(...param: any[]):void {
                                          	if (arguments.length > 0) {
                                          		var text:string[] = [];
                                          		for (var i = 0; i < arguments.length; i++) {
                                                      if (typeof arguments[i] === 'string' || arguments[i] instanceof String) {
                                                          text.push(arguments[i]);
                                          		    } else if(arguments[i] === null) {
                                                          text.push('null');
                                          		    } else if(arguments[i] === undefined) {
                                                          text.push('undefined');
                                                      } else if (isPrimitive(arguments[i])) {
                                                          text.push(arguments[i]);
                                                      } else {
                                                          text.push(JSON.stringify(arguments[i]));
                                                      }
                                                      //enum close bracket cannot be found in "channel[state.id=*.TEMPERATURE](rooms=WZ|Wohnung|Wohnzimmer"
                                          
                                          		}
                                          		log(text.join(' '), 'warn');
                                          		setState("javascript.0.Ereignisliste.event",'WARN|'+text.join(' '));
                                          	}
                                              //logEnhanced(logtext, 'warn');
                                          	//console.warn(p);
                                          	//logs(logtext,loglevels.warn);
                                          }
                                          
                                          /**
                                           * write any objects given as parameter to log as error
                                           * @param    param       a nist of different objects
                                           */
                                          function logError(...param: any[]):void {
                                          	if (arguments.length > 0) {
                                          		var text:string[] = [];
                                          		for (var i = 0; i < arguments.length; i++) {
                                                      if (typeof arguments[i] === 'string' || arguments[i] instanceof String) {
                                                          text.push(arguments[i]);
                                          		    } else if(arguments[i] === null) {
                                                          text.push('null');
                                          		    } else if(arguments[i] === undefined) {
                                                          text.push('undefined');
                                                      } else if (isPrimitive(arguments[i])) {
                                                          text.push(arguments[i]);
                                                      } else {
                                                          text.push(JSON.stringify(arguments[i]));
                                                      }
                                                      //enum close bracket cannot be found in "channel[state.id=*.TEMPERATURE](rooms=WZ|Wohnung|Wohnzimmer"
                                          
                                          		}
                                          		log(text.join(' '), 'error');
                                          		setState("javascript.0.Ereignisliste.event",'ERROR|'+text.join(' '));
                                          	}
                                          }
                                          // ########################################################################################################
                                          // Lokale TypeScript Definitionen
                                          // ########################################################################################################
                                          import request = require("request");
                                          
                                          var Pollenarten:string[] = ['Erle','Hasel','Pappel','Weide','Ulme','Birke','Buche','Ampfer','Roggen','Gräser','Eiche','Wegerich','Beifuß','Ambrosia'];
                                          
                                          function strip_tags(data:string):string {
                                              var rueckgabe:string = data.replace(/( |<([^>]+)>)/ig, "");
                                              return(rueckgabe);
                                          }
                                          
                                          function GetPollenIndex(pflanze:string, html:string):number {
                                              var code ={'kein':0, 'schwach':1, 'mäßig':2, 'stark':3}; 
                                              var result:string= "";
                                              var start:number =html.indexOf(pflanze)+pflanze.length;
                                          
                                              result=html.slice(start);
                                              result=result.trim();
                                          	//logDebug('result for ',pflanze,html.slice(0,600));
                                              var stop:number =result.indexOf(' ');
                                              result=result.slice(0,stop);
                                              logDebug('pflanze=',pflanze,'code=',result);
                                              return code[result];
                                          }
                                          
                                          function initializePollenwetter():void {
                                              logDebug('initialize Pollenwetter, creating states');
                                              for(var i=0;i<pollenarten.length;i++) {/createstate("wetter.pollenvorhersage."+pollenarten[i].tolowercase(),0,false,/name:/'pollenart/'+/pollenarten[i],/type:/"number",/role:/'value',/read:/true,/write:/false});/}/logdebug('initiale/read');/readpollenwetter();/function/readpollenwetter():void/logdebug("start");/try/request(options,/(error,/response,/body):void/if/(!error/&&/response.statuscode="=" 200)/kein/fehler,/inhalt/in/body/'/');/'');/var/start:number="body.indexOf('<ul" id="pollentable">');
                                          				if (start>-1) { body=body.slice(start); }
                                                          body=strip_tags(body);
                                          				//logDebug('body',body);
                                                          for(var i=0;i<pollenarten.length;i++) 0/5/{/setstate("wetter.pollenvorhersage."+pollenarten[i].tolowercase(),getpollenindex(pollenarten[i],body));/}/else/loginfo("statuscode="+response.statusCode);
                                                          logError(error);                               // Error beim Einlesen
                                                      }
                                                  });
                                              } catch (e) {
                                                  logError('Fehler (try) leseWebseite: ' + e);
                                              }
                                          }
                                          
                                          initializePollenwetter();
                                          schedule(" */*",/readpollenwetter);<e=""></pollenarten.length;i++)></pollenarten.length;i++)>`[/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i]
                                          
                                          1 Reply Last reply Reply Quote 0
                                          • D
                                            DiJaexxl last edited by

                                            Hallo robsdobs,

                                            jetzt geht es. DANKE!

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate
                                            FAQ Cloud / IOT
                                            HowTo: Node.js-Update
                                            HowTo: Backup/Restore
                                            Downloads
                                            BLOG

                                            405
                                            Online

                                            31.9k
                                            Users

                                            80.1k
                                            Topics

                                            1.3m
                                            Posts

                                            43
                                            266
                                            44139
                                            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