Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. Skripten des E-Control Spritpreisrechners

    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

    Skripten des E-Control Spritpreisrechners

    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      klaus88 @salmi last edited by

      @salmi Perfekt - Schönes Wochenende!

      1 Reply Last reply Reply Quote 0
      • L
        lastyle last edited by

        Hallo, danke für das Skript!

        Meine Frage dazu: wie kann ich es auf eine bestimmte Tankstelle fixieren?
        Ich will nicht die 5 billigsten in der Umgebung, sondern einfach die Näheste.
        Grund: ich habe eine Turmöl-Karte und da gibts nur eine in der Nähe...

        danke

        metaxa 1 Reply Last reply Reply Quote 0
        • metaxa
          metaxa @lastyle last edited by

          @lastyle sagte in Skripten des E-Control Spritpreisrechners:

          wie kann ich es auf eine bestimmte Tankstelle fixieren?

          Ich habe es bei mir so umgesetzt:
          Tankscript.png
          Die ersten 5 machen ja durchaus Sinn, in der Praxis fahre ich eh immer die gleiche Diskonttankste an und will eigentlich nur wissen ob ich damit eh in einer vernünftigen Preisspanne liege.

          Wichtig ist die ID deiner Wunschtankstelle.
          Mein ursprüngliches Script habe ich dann um folgende Teile erweitert:

              /// console.log((String('Start eine Tankstelle finden')));
              createState("javascript.0.scriptDatenPunkte.Sprit_AT.Favorit.Preis", 0,{type: 'string', name: 'Preis', read: true, write: true});
              createState("javascript.0.scriptDatenPunkte.Sprit_AT.Favorit.Name", 0,{type: 'string', name: 'Name', read: true, write: true});
              createState("javascript.0.scriptDatenPunkte.Sprit_AT.Favorit.Adresse", 0,{type: 'string', name: 'Adresse', read: true, write: true});
              createState("javascript.0.scriptDatenPunkte.Sprit_AT.Favorit.Offen", 0,{type: 'boolean', name: 'Offen', read: true, write: true});
              setState("javascript.0.scriptDatenPunkte.Sprit_AT.Favorit.Preis", "kein Preis verfügbar");
              for (index = 0; index < gasStation.length; index++)
              {
                  if (gasStation[index].id == 146xxxx) {    //Wunschtankstelle
          
                      if ((gasStation[index].prices[0])!=undefined){
                          setState("javascript.0.scriptDatenPunkte.Sprit_AT.Favorit.Preis", (gasStation[index].prices[0].amount).toString().replace(".",","));
                      };
          
                      setState("javascript.0.scriptDatenPunkte.Sprit_AT.Favorit.Name", gasStation[index].name);
                      setState("javascript.0.scriptDatenPunkte.Sprit_AT.Favorit.Adresse", gasStation[index].location.postalCode + " " + gasStation[index].location.city + ", " + gasStation[index].location.address);
                      setState("javascript.0.scriptDatenPunkte.Sprit_AT.Favorit.Offen", gasStation[index].open);
                  }
              }
              /// console.log((String('Ende eine Tankstelle finden')));
          

          LG, mxa

          L 1 Reply Last reply Reply Quote 0
          • L
            lastyle @metaxa last edited by

            @metaxa 👍

            Danke, werd ich heut abend gleich einbauen.... dein Visu Ausschnitt sieht sehr nett aus. Hast du diese hier im Forum vorgestellt? Ich bin momentan noch am testen und habe mich noch nicht ums Design gekümmert...

            metaxa 1 Reply Last reply Reply Quote 0
            • metaxa
              metaxa @lastyle last edited by

              @lastyle
              Nein, das veröffentlichen überlasse ich den Designprofis in diesem Forum. Meine Views stammen großteils noch aus Zeiten der legendären "ccu.io".
              66e38d4b-0e13-4d0d-bfd7-58872394924f-grafik.png
              Pass bitte bei den Datenpunkten auf, die habe ich nach meinen Gegebenheiten gecodet.
              mxa

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

                kann mann denn die zahlen beliebig wählen?
                //Aral=1, eni=2, Shell=3,
                hab nähmlich 2 verschiedene Tankstellen die aber die selbe Bild nummer haben?
                zb.: bp=6 und die discont tankstelle in der nähe hat auch du nr. 6, wie kann ich dass ändern?

                Negalein 2 Replies Last reply Reply Quote 0
                • Negalein
                  Negalein Global Moderator @Reese1 last edited by

                  @Reese1 sagte in Skripten des E-Control Spritpreisrechners:

                  kann mann denn die zahlen beliebig wählen?
                  //Aral=1, eni=2, Shell=3,
                  hab nähmlich 2 verschiedene Tankstellen die aber die selbe Bild nummer haben?
                  zb.: bp=6 und die discont tankstelle in der nähe hat auch du nr. 6, wie kann ich dass ändern?

                  Ja, geht.
                  und Bilder dann richtig benennen.

                  Zeig mal dein Script.

                  1 Reply Last reply Reply Quote 0
                  • R
                    Reese1 last edited by Negalein

                    hier dass script, nur 16 und 17 laufen nicht.

                    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //  "Spritpreise_AT v.0.5"                                                                                                              //
                    //  e-control Spritpreise                                                                                                               //    
                    //  ursprüngl. Script von steinejo_io vom                                                                                               //
                    //                                                                                                                                      //
                    //  Zwingend erforderlich sind der Parser Adapter und die URL aus der API. Links und Hilfe zum Erstellemn findet ihr im Folgenden Lnk:  //
                    //  https://forum.iobroker.net/topic/20314/skripten-des-e-control-spritpreisrechners                                                    //
                    //  Das manuelle Anlegen von Daenpunkten ist nicht mehr notwendig. erledigt das Script beim ersten Aufruf.                              //
                    //  Auf das "E" Zeichen habe ich verzichtet, da es in VIS genz einfach an der jeweils gewünschten Stelle produzierbar ist.              //
                    //                                                                                                                                      //
                    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    
                    on({id: "parser.0.Spritpreisrechner"/*Spritpreisrechner*/, change: 'any'}, function(obj)
                    
                    {
                    log("Start Spritvergleich");
                    
                       var gasStation = JSON.parse(obj.state.val);
                    
                       if (gasStation.length === 0) return;
                    
                       //Aral=1, eni=2, Shell=3, OMV=4, avanti=5, bp=6, JET=7, Turmöl=8, Lagerhaus=9, AVIA=10, A1=11, Diskont=12, IQ=13, Heppner & Oberndorfer Bedienungstankstelle=14, Genol - Lagerhaus=15, Land lebt auf Suben Gmbh=16, SB-Tankstelle Zauner=17,
                    
                       var arrMarke = ['Aral', 'eni', 'Shell', 'OMV', 'avanti', 'bp', 'JET', 'Turmöl', 'Lagerhaus', 'AVIA', 'A1', 'Diskont', 'IQ', 'Heppner & Oberndorfer Bedienungstankstelle', 'Genol - Lagerhaus', 'Land lebt auf Suben Gmbh', 'SB-Tankstelle Zauner' ];
                    
                       var i = 0;
                    
                       for (var i = 1; i <= 5; i++) {
                    
                           // console.log(i);
                           // console.log("javascript.0.Sprit_AT.name_"+i);
                    
                           createState("javascript.0.Sprit_AT.Treffer_"+i+".Name_"+i, {type: "string", name: "Platz "+i, read: true, write: true});
                           createState("javascript.0.Sprit_AT.Treffer_"+i+".Preis_"+i, {type: "string", name: "Platz "+i, read: true, write: true});
                           createState("javascript.0.Sprit_AT.Treffer_"+i+".PreisP_"+i, {type: "string", name: "Platz "+i, read: true, write: true});
                       	createState("javascript.0.Sprit_AT.Treffer_"+i+".Strasse_"+i, {type: "string", name: "Platz "+i, read: true, write: true});
                           createState("javascript.0.Sprit_AT.Treffer_"+i+".PLZ_Ort_"+i, {type: "string", name: "Platz "+i, read: true, write: true});
                           createState("javascript.0.Sprit_AT.Treffer_"+i+".Logo_"+i, {type: "number", name: "Logo "+i, read: true, write: true});
                       	createState("javascript.0.Sprit_AT.Treffer_"+i+".Latitude_"+i, {type: "number", name: "Latitude "+i, read: true, write: true});
                       	createState("javascript.0.Sprit_AT.Treffer_"+i+".Longitude_"+i, {type: "number", name: "Longitude "+i, read: true, write: true});
                       	createState("javascript.0.Sprit_AT.Treffer_"+i+".offen_"+i, {type: "boolean", name: "offen "+i, read: true, write: true});
                    
                       }
                    
                       var index = 0;
                    
                       //for (index = 0; index < gasStation.length; ++index) {
                       for (index = 0; index <= 4; ++index) {
                    
                       var arrname = gasStation[index].name.split(' ');
                       	if (arrname.length > 0) {
                       			var markenname = arrname[0];
                       		}
                       		else
                       		{
                       			var markenname = gasStation[index].name;
                       		}
                       	var station = gasStation[index].name;
                       setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".Name_"+(index+1), gasStation[index].name);
                       setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".Preis_"+(index+1), (gasStation[index].prices[0].amount).toString().replace(".",","));
                       setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".PreisP_"+(index+1), (gasStation[index].prices[0].amount).toString().replace(".","."));
                       setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".Strasse_"+(index+1), (gasStation[index].location.address));
                       setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".PLZ_Ort_"+(index+1), (gasStation[index].location.postalCode) + " " + (gasStation[index].location.city));
                       setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".Latitude_"+(index+1), (gasStation[index].location.latitude));
                       setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".Longitude_"+(index+1), (gasStation[index].location.longitude));
                       setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".offen_"+(index+1), (gasStation[index].open));
                    
                       // Aral=1, eni=2, Shell=3, OMV=4, avanti=5, bp=6, JET=7, Turmöl=8, Lagerhaus=9, AVIA=10, A1=11, Diskont=12, IQ=13, Heppner & Oberndorfer Bedienungstankstelle=14, Genol - Lagerhaus=15, Land lebt auf Suben Gmbh=16, SB-Tankstelle Zauner=17, 
                    
                       var markennameklein=markenname.toLowerCase();
                       var x= 0;
                       for (x=0; x < arrMarke.length; x++) {
                       	var arrMklein=arrMarke[x].toLowerCase();
                       	//console.log("x=" + x + "/ Markennameklein =" + markennameklein + "/ Array =" + arrMklein);
                       	if (arrMklein == markennameklein) {
                       		setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".Logo_"+(index+1), (x+1));
                       	}
                       }
                       }
                    log("Ende Spritvergleich");
                    });
                    
                    Negalein 1 Reply Last reply Reply Quote 0
                    • Negalein
                      Negalein Global Moderator @Reese1 last edited by

                      @Reese1 sagte in Skripten des E-Control Spritpreisrechners:

                      bp=6 und die discont tankstelle in der nähe hat auch du nr. 6

                      wie kommst du auf Nr. 6 bei der Discont?

                      Welche möchtest du im Script, bzw. welche scheinen bei dir bei der Abfrage auf?

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

                        ich möchte die SB Tankstelle Zauner zb mit nummer 17, und die Tankstelle land lebt auf mit nummer 16, aber auch nach ändern im script wird bei der ersten tankstelle bild nr 6 abgerufen,

                        1 Reply Last reply Reply Quote 0
                        • Negalein
                          Negalein Global Moderator @Reese1 last edited by

                          @Reese1 sagte in Skripten des E-Control Spritpreisrechners:

                          nur 16 und 17 laufen nicht.

                          wenn die funktionieren sollen, müsstest du in meiner Nachbarschaft sein 😉

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

                            ja genau so ist es auch, 😀

                            Negalein 1 Reply Last reply Reply Quote 0
                            • Negalein
                              Negalein Global Moderator @Reese1 last edited by

                              @Reese1 sagte in Skripten des E-Control Spritpreisrechners:

                              ja genau so ist es auch

                              Cool, von wo genau? Gerne auch als PN.

                              Schreib hier mal, welche Tankstellen du möchtest und schick auch die Bilder mit.

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

                                folgende bilder habe ich:
                                hofer, avanti, bp, jet, aral, lagerhaus
                                fehlen tun mir
                                land lebt auf suben, tankstelle zauner

                                Negalein 1 Reply Last reply Reply Quote 0
                                • Negalein
                                  Negalein Global Moderator @Reese1 last edited by

                                  @Reese1 sagte in Skripten des E-Control Spritpreisrechners:

                                  folgende bilder habe ich:
                                  hofer, avanti, bp, jet, aral, lagerhaus
                                  fehlen tun mir
                                  land lebt auf suben, tankstelle zauner

                                  Ok, warte kurz

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

                                    wo ist der button für pn?? bin wohl blind 😎

                                    Negalein 1 Reply Last reply Reply Quote 0
                                    • Negalein
                                      Negalein Global Moderator @Reese1 last edited by

                                      @Reese1 sagte in Skripten des E-Control Spritpreisrechners:

                                      wo ist der button für pn?? bin wohl blind

                                      auf mein Profilbild klicken
                                      rechts dann die 3 Punkte
                                      Beginne einen neuen Chat mit

                                      1 Reply Last reply Reply Quote 0
                                      • Negalein
                                        Negalein Global Moderator last edited by

                                        @Reese1

                                        Hier mal die Bilder! BP ist 2x, da es oft bpund oft BPgeschrieben wird.


                                        9.png 8.png 7.png 6.png 5.png 4.png 3.png 2.png 1.png

                                        Hier das Script

                                        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                        //  "Spritpreise_AT v.0.5"                                                                                                              //
                                        //  e-control Spritpreise                                                                                                               //    
                                        //  ursprüngl. Script von steinejo_io vom                                                                                               //
                                        //                                                                                                                                      //
                                        //  Zwingend erforderlich sind der Parser Adapter und die URL aus der API. Links und Hilfe zum Erstellemn findet ihr im Folgenden Lnk:  //
                                        //  https://forum.iobroker.net/topic/20314/skripten-des-e-control-spritpreisrechners                                                    //
                                        //  Das manuelle Anlegen von Daenpunkten ist nicht mehr notwendig. erledigt das Script beim ersten Aufruf.                              //
                                        //  Auf das "E" Zeichen habe ich verzichtet, da es in VIS genz einfach an der jeweils gewünschten Stelle produzierbar ist.              //
                                        //                                                                                                                                      //
                                        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                         
                                        on({id: "parser.0.Spritpreisrechner"/*Spritpreisrechner*/, change: 'any'}, function(obj)
                                        {
                                        log("Start Spritvergleich");
                                         
                                        var gasStation = JSON.parse(obj.state.val);
                                        if (!Array.isArray(gasStation) || gasStation.length === 0) return;
                                        gasStation = gasStation.filter(g => g.prices.length > 0);
                                        if (gasStation.length === 0) return;
                                            //Aral=1, avanti=2, bp=3, JET=4, Lagerhaus=5, Diskont=6, SB-Tankstelle=7, Land=8, BP=9
                                            var arrMarke = ['Aral', 'avanti', 'bp', 'JET', 'Lagerhaus', 'Diskont', 'SB-Tankstelle', 'Land', 'BP'];
                                        	var i = 0;
                                            for (var i = 1; i <= 5; i++) {
                                                // console.log(i);
                                                // console.log("javascript.0.Sprit_AT.name_"+i);
                                                createState("javascript.0.Sprit_AT.Treffer_"+i+".Name_"+i, {type: "string", name: "Platz "+i, read: true, write: true});
                                                createState("javascript.0.Sprit_AT.Treffer_"+i+".Preis_"+i, {type: "string", name: "Platz "+i, read: true, write: true});
                                                createState("javascript.0.Sprit_AT.Treffer_"+i+".PreisP_"+i, {type: "string", name: "Platz "+i, read: true, write: true});
                                        		createState("javascript.0.Sprit_AT.Treffer_"+i+".Strasse_"+i, {type: "string", name: "Platz "+i, read: true, write: true});
                                                createState("javascript.0.Sprit_AT.Treffer_"+i+".PLZ_Ort_"+i, {type: "string", name: "Platz "+i, read: true, write: true});
                                                createState("javascript.0.Sprit_AT.Treffer_"+i+".Logo_"+i, {type: "number", name: "Logo "+i, read: true, write: true});
                                        		createState("javascript.0.Sprit_AT.Treffer_"+i+".Latitude_"+i, {type: "number", name: "Latitude "+i, read: true, write: true});
                                        		createState("javascript.0.Sprit_AT.Treffer_"+i+".Longitude_"+i, {type: "number", name: "Longitude "+i, read: true, write: true});
                                        		createState("javascript.0.Sprit_AT.Treffer_"+i+".offen_"+i, {type: "boolean", name: "offen "+i, read: true, write: true});
                                        	}
                                        	
                                         
                                            var index = 0;
                                            //for (index = 0; index < gasStation.length; ++index) {
                                            for (index = 0; index <= 4; ++index) {
                                        	if (gasStation[index].prices.length < 1) continue;
                                        	var arrname = gasStation[index].name.split(' ');
                                        		if (arrname.length > 0) {
                                        				var markenname = arrname[0];
                                        			}
                                        			else
                                        			{
                                        				var markenname = gasStation[index].name;
                                        			}
                                        		var station = gasStation[index].name;
                                            setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".Name_"+(index+1), gasStation[index].name);
                                            setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".Preis_"+(index+1), (gasStation[index].prices[0].amount).toString().replace(".",","));
                                            setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".PreisP_"+(index+1), (gasStation[index].prices[0].amount).toString().replace(".","."));
                                        	setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".Strasse_"+(index+1), (gasStation[index].location.address));
                                            setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".PLZ_Ort_"+(index+1), (gasStation[index].location.postalCode) + " " + (gasStation[index].location.city));
                                            setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".Latitude_"+(index+1), (gasStation[index].location.latitude));
                                        	setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".Longitude_"+(index+1), (gasStation[index].location.longitude));
                                        	setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".offen_"+(index+1), (gasStation[index].open));
                                        	
                                        	//Aral=1, eni=2, Shell=3, OMV=4, avanti=5, bp=6, JET=7, Turmöl=8, Lagerhaus=9, AVIA=10, A1=11, Diskont=12, IQ=13
                                        	
                                        	var markennameklein=markenname.toLowerCase();
                                        	var x= 0;
                                        	for (x=0; x < arrMarke.length; x++) {
                                        		var arrMklein=arrMarke[x].toLowerCase();
                                        		//console.log("x=" + x + "/ Markennameklein =" + markennameklein + "/ Array =" + arrMklein);
                                        		if (arrMklein == markennameklein) {
                                        			setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".Logo_"+(index+1), (x+1));
                                        		}
                                        	}
                                        	
                                        	}
                                         
                                        log("Ende Spritvergleich");
                                        });
                                        

                                        Probier es mal. Müsste passen.

                                        maximal1981 1 Reply Last reply Reply Quote 0
                                        • R
                                          Reese1 last edited by

                                          super Vielen Dank, teste ich gleich, 🙂

                                          1 Reply Last reply Reply Quote 0
                                          • maximal1981
                                            maximal1981 @Negalein last edited by

                                            @Negalein said in Skripten des E-Control Spritpreisrechners:

                                            @Reese1

                                            Hier mal die Bilder! BP ist 2x, da es oft bpund oft BPgeschrieben wird.


                                            9.png 8.png 7.png 6.png 5.png 4.png 3.png 2.png 1.png

                                            Hier das Script

                                            //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                            //  "Spritpreise_AT v.0.5"                                                                                                              //
                                            //  e-control Spritpreise                                                                                                               //    
                                            //  ursprüngl. Script von steinejo_io vom                                                                                               //
                                            //                                                                                                                                      //
                                            //  Zwingend erforderlich sind der Parser Adapter und die URL aus der API. Links und Hilfe zum Erstellemn findet ihr im Folgenden Lnk:  //
                                            //  https://forum.iobroker.net/topic/20314/skripten-des-e-control-spritpreisrechners                                                    //
                                            //  Das manuelle Anlegen von Daenpunkten ist nicht mehr notwendig. erledigt das Script beim ersten Aufruf.                              //
                                            //  Auf das "E" Zeichen habe ich verzichtet, da es in VIS genz einfach an der jeweils gewünschten Stelle produzierbar ist.              //
                                            //                                                                                                                                      //
                                            //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                             
                                            on({id: "parser.0.Spritpreisrechner"/*Spritpreisrechner*/, change: 'any'}, function(obj)
                                            {
                                            log("Start Spritvergleich");
                                             
                                            var gasStation = JSON.parse(obj.state.val);
                                            if (!Array.isArray(gasStation) || gasStation.length === 0) return;
                                            gasStation = gasStation.filter(g => g.prices.length > 0);
                                            if (gasStation.length === 0) return;
                                                //Aral=1, avanti=2, bp=3, JET=4, Lagerhaus=5, Diskont=6, SB-Tankstelle=7, Land=8, BP=9
                                                var arrMarke = ['Aral', 'avanti', 'bp', 'JET', 'Lagerhaus', 'Diskont', 'SB-Tankstelle', 'Land', 'BP'];
                                            	var i = 0;
                                                for (var i = 1; i <= 5; i++) {
                                                    // console.log(i);
                                                    // console.log("javascript.0.Sprit_AT.name_"+i);
                                                    createState("javascript.0.Sprit_AT.Treffer_"+i+".Name_"+i, {type: "string", name: "Platz "+i, read: true, write: true});
                                                    createState("javascript.0.Sprit_AT.Treffer_"+i+".Preis_"+i, {type: "string", name: "Platz "+i, read: true, write: true});
                                                    createState("javascript.0.Sprit_AT.Treffer_"+i+".PreisP_"+i, {type: "string", name: "Platz "+i, read: true, write: true});
                                            		createState("javascript.0.Sprit_AT.Treffer_"+i+".Strasse_"+i, {type: "string", name: "Platz "+i, read: true, write: true});
                                                    createState("javascript.0.Sprit_AT.Treffer_"+i+".PLZ_Ort_"+i, {type: "string", name: "Platz "+i, read: true, write: true});
                                                    createState("javascript.0.Sprit_AT.Treffer_"+i+".Logo_"+i, {type: "number", name: "Logo "+i, read: true, write: true});
                                            		createState("javascript.0.Sprit_AT.Treffer_"+i+".Latitude_"+i, {type: "number", name: "Latitude "+i, read: true, write: true});
                                            		createState("javascript.0.Sprit_AT.Treffer_"+i+".Longitude_"+i, {type: "number", name: "Longitude "+i, read: true, write: true});
                                            		createState("javascript.0.Sprit_AT.Treffer_"+i+".offen_"+i, {type: "boolean", name: "offen "+i, read: true, write: true});
                                            	}
                                            	
                                             
                                                var index = 0;
                                                //for (index = 0; index < gasStation.length; ++index) {
                                                for (index = 0; index <= 4; ++index) {
                                            	if (gasStation[index].prices.length < 1) continue;
                                            	var arrname = gasStation[index].name.split(' ');
                                            		if (arrname.length > 0) {
                                            				var markenname = arrname[0];
                                            			}
                                            			else
                                            			{
                                            				var markenname = gasStation[index].name;
                                            			}
                                            		var station = gasStation[index].name;
                                                setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".Name_"+(index+1), gasStation[index].name);
                                                setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".Preis_"+(index+1), (gasStation[index].prices[0].amount).toString().replace(".",","));
                                                setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".PreisP_"+(index+1), (gasStation[index].prices[0].amount).toString().replace(".","."));
                                            	setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".Strasse_"+(index+1), (gasStation[index].location.address));
                                                setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".PLZ_Ort_"+(index+1), (gasStation[index].location.postalCode) + " " + (gasStation[index].location.city));
                                                setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".Latitude_"+(index+1), (gasStation[index].location.latitude));
                                            	setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".Longitude_"+(index+1), (gasStation[index].location.longitude));
                                            	setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".offen_"+(index+1), (gasStation[index].open));
                                            	
                                            	//Aral=1, eni=2, Shell=3, OMV=4, avanti=5, bp=6, JET=7, Turmöl=8, Lagerhaus=9, AVIA=10, A1=11, Diskont=12, IQ=13
                                            	
                                            	var markennameklein=markenname.toLowerCase();
                                            	var x= 0;
                                            	for (x=0; x < arrMarke.length; x++) {
                                            		var arrMklein=arrMarke[x].toLowerCase();
                                            		//console.log("x=" + x + "/ Markennameklein =" + markennameklein + "/ Array =" + arrMklein);
                                            		if (arrMklein == markennameklein) {
                                            			setState("javascript.0.Sprit_AT.Treffer_"+(index+1)+".Logo_"+(index+1), (x+1));
                                            		}
                                            	}
                                            	
                                            	}
                                             
                                            log("Ende Spritvergleich");
                                            });
                                            

                                            Probier es mal. Müsste passen.

                                            hab mal dein Script ausprobiert, leider bekomme ich nur laut aktuellem Preisstand nur beim 1. Treffer für das Logo einen Wert retour. Liegt vermutlich daran, dass es hier ein paar unbekannte Anbieter gibt. kann man das vll vernünftig einbinden?
                                            ich hab leider keine Ahnung wie ich das realisieren kann.
                                            Denke aber es würde etlichen helfen, wenn du dein Script um gewisse Tankstellen erweiterst, oder es vernünftig erklärst.

                                            tempsnip.png

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            678
                                            Online

                                            31.9k
                                            Users

                                            80.1k
                                            Topics

                                            1.3m
                                            Posts

                                            javascript monitoring
                                            21
                                            292
                                            33345
                                            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