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

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Skripten des E-Control Spritpreisrechners

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

      @sigi234
      Würdest du die Tankstellenbilder zur Verfügung stellen?

      sigi234 1 Reply Last reply Reply Quote 0
      • sigi234
        sigi234 Forum Testing Most Active @Negalein last edited by

        @Negalein

        logo-JET.png Logo-Avanti.jpg logo_IQ.jpg avialogo_aktuell.jpg

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

          @sigi234 sagte in Skripten des E-Control Spritpreisrechners:

          Denke vielleicht mit Signalbilder und Text besteht aus : Name Tankstelle (avanti)
          Da spiele ich mal ein bisschen damit.........

          Screenshot (2777).png

          Servus

          Das mit den Logos funktioniert bei dir auch nicht?
          Finde ebenfalls keine passende LKösung.

          sigi234 1 Reply Last reply Reply Quote 0
          • sigi234
            sigi234 Forum Testing Most Active @Negalein last edited by

            @Negalein sagte in Skripten des E-Control Spritpreisrechners:

            @sigi234 sagte in Skripten des E-Control Spritpreisrechners:

            Denke vielleicht mit Signalbilder und Text besteht aus : Name Tankstelle (avanti)
            Da spiele ich mal ein bisschen damit.........

            Screenshot (2777).png

            Servus

            Das mit den Logos funktioniert bei dir auch nicht?
            Finde ebenfalls keine passende LKösung.

            Leider nein.

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

              Hallo Leute,
              vorneweg - DANKE für das Script, denn es hat mir in letzter Zeit sehr viel Geld erspart 😊

              Ich habe das Problem mit den Logos folgendermaßen gelöst, wobei ich gleich sagen muss, dass ich ein absoluter Beginner in Sachen javascript bin, aber vielleicht hilft es euch bzw. ihr bekommt dadurch Tipps:

              Code:

              
              
              //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
              
              //  "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   
              
              // 	Link Essling:  https://api.e-control.at/sprit/1.0/search/gas-stations/by-address?latitude=48.213813&longitude=16.486721&fuelType=DIE&includeClosed=true                                             //
              
              //	Link Region: https://api.e-control.at/sprit/1.0/search/gas-stations/by-region?code=922&type=PB&fuelType=DIE&includeClosed=true
              
              //  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, Genol=9, AVIA=10, A1=11, DISKONT=12
              	var arrMarke = ['Aral', 'eni', 'Shell', 'OMV', 'avanti', 'bp', 'JET', 'Turmöl', 'Genol', 'AVIA', 'A1', 'DISKONT'];
                  var i = 0;
                  for (var i = 1; i <= 5; i++) {
                      //console.log(i);
                      //console.log("javascript.0.scriptDatenPunkte.Sprit_AT.name_"+i);
              		createState("javascript.0.scriptDatenPunkte.Sprit_AT.Treffer_"+i+".Name_"+i, {type: "string", name: "Platz "+i, read: true, write: true});
                      createState("javascript.0.scriptDatenPunkte.Sprit_AT.Treffer_"+i+".Preis_"+i, {type: "string", name: "Platz "+i, read: true, write: true});
                      createState("javascript.0.scriptDatenPunkte.Sprit_AT.Treffer_"+i+".PreisP_"+i, {type: "string", name: "Platz "+i, read: true, write: true});
                      createState("javascript.0.scriptDatenPunkte.Sprit_AT.Treffer_"+i+".Strasse_"+i, {type: "string", name: "Platz "+i, read: true, write: true});
              		createState("javascript.0.scriptDatenPunkte.Sprit_AT.Treffer_"+i+".PLZ_Ort_"+i, {type: "string", name: "Platz "+i, read: true, write: true});
              		createState("javascript.0.scriptDatenPunkte.Sprit_AT.Treffer_"+i+".Logo_"+i, {type: "number", name: "Logo "+i, read: true, write: true});
              		createState("javascript.0.scriptDatenPunkte.Sprit_AT.Treffer_"+i+".Latitude_"+i, {type: "number", name: "Latitude "+i, read: true, write: true});
              		createState("javascript.0.scriptDatenPunkte.Sprit_AT.Treffer_"+i+".Longitude_"+i, {type: "number", name: "Longitude "+i, read: true, write: true});
              		createState("javascript.0.scriptDatenPunkte.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.scriptDatenPunkte.Sprit_AT.Treffer_"+(index+1)+".Name_"+(index+1), markenname);
              		setState("javascript.0.scriptDatenPunkte.Sprit_AT.Treffer_"+(index+1)+".Preis_"+(index+1), (gasStation[index].prices[0].amount).toString().replace(".",","));
              		setState("javascript.0.scriptDatenPunkte.Sprit_AT.Treffer_"+(index+1)+".PreisP_"+(index+1), (gasStation[index].prices[0].amount).toString().replace(".","."));
              		setState("javascript.0.scriptDatenPunkte.Sprit_AT.Treffer_"+(index+1)+".Strasse_"+(index+1), (gasStation[index].location.address));
              		setState("javascript.0.scriptDatenPunkte.Sprit_AT.Treffer_"+(index+1)+".PLZ_Ort_"+(index+1), (gasStation[index].location.postalCode) + " " + (gasStation[index].location.city));
              		setState("javascript.0.scriptDatenPunkte.Sprit_AT.Treffer_"+(index+1)+".Latitude_"+(index+1), (gasStation[index].location.latitude));
              		setState("javascript.0.scriptDatenPunkte.Sprit_AT.Treffer_"+(index+1)+".Longitude_"+(index+1), (gasStation[index].location.longitude));
              		setState("javascript.0.scriptDatenPunkte.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, Genol=9, AVIA=10, A1=11, DISKONT=12
              		
              		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.scriptDatenPunkte.Sprit_AT.Treffer_"+(index+1)+".Logo_"+(index+1), (x+1));
              			}
              		}
              		
              		}
              log("Ende Spritvergleich");
              
              });
              
              

              Dann die Logos der Tankstellen einfach mit nummern bezeichnen und am iobroker Server ablegen:
              //Aral=1, eni=2, Shell=3, OMV=4, avanti=5, bp=6, JET=7, Turmöl=8, Genol=9, AVIA=10, A1=11, DISKONT=12

              wie sieht es aus als View :
              Bild Text

              Nachdem wir 2 Autos haben (eines Diesel und eines Super) läuft das selbe script - nur mit einem Link zu den Superdaten nochmals -und davon hole ich mir dann die Daten zum anzeigen.

              Hoffe es hilft euch - und guten Rutsch ins neue Jahr
              lg
              Klaus

              Negalein sigi234 M 4 Replies Last reply Reply Quote 3
              • Negalein
                Negalein Global Moderator @klaus88 last edited by

                @klaus88 sagte in Skripten des E-Control Spritpreisrechners:

                Hoffe es hilft euch - und guten Rutsch ins neue Jahr

                Danke, werde ich gleich testen.

                Dein View schaut interessant aus. Könntest du es zur Verfügung stellen?

                K 1 Reply Last reply Reply Quote 0
                • sigi234
                  sigi234 Forum Testing Most Active @klaus88 last edited by

                  @klaus88

                  Hallo, Super. Muss im Skript was angepasst werden?
                  Die Logos wie benennen? Sind ja unter vis.0 .
                  Also Aral Logo soll dann auf 1.png umbenannt werden?

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

                    @Negalein : Anbei der View exportiert
                    spritpreis.txt

                    Ich habe mir das alles aus diesem Forum geholt und weiß absolut nicht mehr von wem was ist - DANKE an alle für die Vorlagen!

                    1 Reply Last reply Reply Quote 1
                    • K
                      klaus88 @sigi234 last edited by

                      @sigi234 :

                      Anpassen musst du natürlich den Link, denn derzeit ist der natürlich auf meine Umgebung eingestellt.
                      Die Logos so benennen bzw. dort auswählen wo du sie uploadest
                      //Aral=1, eni=2, Shell=3, OMV=4, avanti=5, bp=6, JET=7, Turmöl=8, Genol=9, AVIA=10, A1=11, DISKONT=12

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

                        @klaus88 sagte in Skripten des E-Control Spritpreisrechners:

                        Ich habe das Problem mit den Logos folgendermaßen gelöst

                        Hi Klaus!

                        Habe heute dein Script in Angriff genommen, bzw. meins mit deinen Zeilen passend erweitert.

                        Muss der Tankstellenname so geschrieben werden, wie in das Script vom Parser bekommt?
                        Also DISKONT<-->Diskont?

                        So steht es im Script:

                            var arrMarke = ['Aral', 'eni', 'Shell', 'OMV', 'avanti', 'bp', 'JET', 'Turmöl', 'Genol', 'AVIA', 'A1', 'DISKONT' 'IQ'];
                        

                        So in den Objekten:
                        objects - ioBroker (8).png

                        Und wie am Screenshot ersichtlich werden einige DP nicht befüllt.

                        Liegt es eventuell an den Parser-Einstellungen?

                        https://api.e-control.at/sprit/1.0/search/gas-stations/by-address?latitude=48.456680&longitude=13.431940&fuelType=DIE&includeClosed=false
                        

                        EDIT: Funktioniert nun, nachdem ich im Parser kurz von JSON auf BOOLEAN umgestellt habe, gespeichert, wieder von BOOLEAN auf JSON und wieder gespeichert.

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

                          @klaus88

                          Könntest du mir noch den View 610_Sprit1 zur Verfügung stellen?

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

                            @Negalein Hallo Negalein

                            1. Ja die Tankstelle muss so geschrieben sein wie sie vom Spritpreisrechner zur Verfügung gestellt wird - dadurch filtere ich raus, welche es ist bzw. welches Logo dann weiter zur Verfügung gestellt wird. Also auch Groß-Kleinschreibung beachten. Am besten, du schaust mal im Originallink (einfach Link in Wbbbrowswer eingeben) nach, welche Tankstellen du in der Nähe hast bzw. wie sie geschrieben sind. Du kannst dann das Array natürlich auch erweitern, denn in OÖ sind ja die Hofer Tankstellen recht billig und die habe ich nicht in Wien 😊
                            2. Ach Gott hast du das Problem auch mit dem Parser - und ich dachte das ist nur bei mir. Ich weiß es nicht, liegt es an meiner Installation, am Script oder was auch immer, aber ich habe es auch nur wegbekommen, indem ich ein paar mal von JSON auf Boolean umgestellt habe.
                            3. View 610_Sprit1 ist anbei ist "nur" die Kartendarstellung der Adresse:
                              610_Sprit1.txt

                            Hoffe es geht alles bei dir - rutsch gut rüber heute!

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

                              @klaus88 sagte in Skripten des E-Control Spritpreisrechners:

                              View 610_Sprit1 ist anbei ist "nur" die Kartendarstellung der Adresse:

                              Hi Klaus!

                              Danke dir.

                              Allerdings wird mir nichts angezeigt im Editor.

                              EDIT: hab das Widget noch nicht installiert. 😉

                              K 1 Reply Last reply Reply Quote 1
                              • K
                                klaus88 @Negalein last edited by

                                @Negalein Ja sorry vergessen - du brauchst den "vis map Widgets" Adapter und dort ist es das OpenStreetMap Widget

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

                                  @klaus88

                                  Mit den Logos will es nicht ganz klappen.

                                  So ist mein 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 (gasStation.length === 0) return;
                                     //Aral=1, eni=2, Shell=3, OMV=4, avanti=5, bp=6, JET=7, Turmöl=8, Genol=9, AVIA=10, A1=11, DISKONT=12, IQ=13
                                     var arrMarke = ['Aral', 'eni', 'Shell', 'OMV', 'avanti', 'bp', 'JET', 'Turmöl', 'Lagerhaus Genol', 'AVIA', 'A1', 'Diskont', 'IQ'];
                                     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 Genol=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");
                                  });
                                  

                                  So kommen die Daten rein:


                                  objects - ioBroker (9).png

                                  Logo müsste eigentlich 9 sein, wird aber 6 eingetragen.


                                  Edit vis (5).png

                                  Hab ich im Script einen Fehler?

                                  sigi234 K 2 Replies Last reply Reply Quote 0
                                  • sigi234
                                    sigi234 Forum Testing Most Active @Negalein last edited by sigi234

                                    @Negalein sagte in Skripten des E-Control Spritpreisrechners:

                                    @klaus88

                                    Mit den Logos will es nicht ganz klappen.

                                    Kannst du die Logos bitte mal reinstellen, finde sie nicht mehr.

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

                                      @sigi234 sagte in Skripten des E-Control Spritpreisrechners:

                                      Kannst du die Logos bitte mal reinstellen, finde sie nicht mehr.

                                      13.png 12.png 11.png 10.png 9.png 8.png 7.png 6.png 5.png 4.png 3.png 2.png 1.png

                                      1 Reply Last reply Reply Quote 1
                                      • K
                                        klaus88 @Negalein last edited by

                                        Hab ich im Script einen Fehler?

                                        Hallo!
                                        Oje du hast einen Fehler in meinem Script gefunden, den ich nicht habe: Lagerhaus Genol hat ein Leerzeichen --> dadurch erkennt er nur Lagerhaus. Bitte probier mal, dass du im Array nicht "Lagerhaus Genol" schreibst sonder nur "Lagerhaus".
                                        Vielleicht geht es dann!

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

                                          @klaus88 sagte in Skripten des E-Control Spritpreisrechners:

                                          Bitte probier mal, dass du im Array nicht "Lagerhaus Genol" schreibst sonder nur "Lagerhaus".

                                          bleibt leider beim Fehler

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

                                            @klaus88

                                            So schaut aktuell das Script aus:

                                            '*/5 * * * *'
                                            //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                            //  "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
                                               var arrMarke = ['Aral', 'eni', 'Shell', 'OMV', 'avanti', 'bp', 'JET', 'Turmöl', 'Lagerhaus', 'AVIA', 'A1', 'Diskont', 'IQ'];
                                               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
                                               
                                               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");
                                            });
                                            

                                            Und so die Ausgabe vom Api-Link:

                                            [{"id":227,"name":"avanti - Sankt Florian/Inn Bundesstraße 129","location":{"address":"Bundesstrasse 129","postalCode":"4780","city":"Sankt Florian/Inn","latitude":48.43865,"longitude":13.44392},"contact":{"telephone":"800202055","fax":"800","website":"www.omv.com"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"00:00","to":"24:00"},{"day":"DI","label":"Dienstag","order":2,"from":"00:00","to":"24:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"00:00","to":"24:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"00:00","to":"24:00"},{"day":"FR","label":"Freitag","order":5,"from":"00:00","to":"24:00"},{"day":"SA","label":"Samstag","order":6,"from":"00:00","to":"24:00"},{"day":"SO","label":"Sonntag","order":7,"from":"00:00","to":"24:00"},{"day":"FE","label":"Feiertag","order":8,"from":"00:00","to":"24:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":true},"paymentMethods":{"cash":false,"debitCard":true,"creditCard":true,"others":"OMV STATIONSKARTE, DKV, MASTERCARD, MAESTRO, ROUTEX, DINERS, VISA"},"paymentArrangements":{"cooperative":false,"clubCard":false},"position":1,"open":true,"distance":2.1930579551820806,"prices":[{"fuelType":"DIE","amount":1.177,"label":"Diesel"}]},{"id":43946,"name":"SB-Tankstelle Zauner","location":{"address":"Ludwig-Paglstr. 1","postalCode":"4780","city":"Schärding","latitude":48.447209,"longitude":13.439305},"contact":{"website":"http://www.auto-zauner.at"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"00:00","to":"24:00"},{"day":"DI","label":"Dienstag","order":2,"from":"00:00","to":"24:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"00:00","to":"24:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"00:00","to":"24:00"},{"day":"FR","label":"Freitag","order":5,"from":"00:00","to":"24:00"},{"day":"SA","label":"Samstag","order":6,"from":"00:00","to":"24:00"},{"day":"SO","label":"Sonntag","order":7,"from":"00:00","to":"24:00"},{"day":"FE","label":"Feiertag","order":8,"from":"00:00","to":"24:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":true},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":false},"paymentArrangements":{"cooperative":false,"clubCard":false},"position":2,"open":true,"distance":1.1861150291611577,"prices":[{"fuelType":"DIE","amount":1.18,"label":"Diesel"}]},{"id":1354925,"name":"JET TANKSTELLE","location":{"address":"LINZERSTRASSE 58","postalCode":"4780","city":"SCHÄRDING","latitude":48.450421,"longitude":13.436477},"contact":{"telephone":"0771235972"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"06:00","to":"22:00"},{"day":"DI","label":"Dienstag","order":2,"from":"06:00","to":"22:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"06:00","to":"22:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"06:00","to":"22:00"},{"day":"FR","label":"Freitag","order":5,"from":"06:00","to":"22:00"},{"day":"SA","label":"Samstag","order":6,"from":"06:00","to":"22:00"},{"day":"SO","label":"Sonntag","order":7,"from":"07:00","to":"22:00"},{"day":"FE","label":"Feiertag","order":8,"from":"07:00","to":"22:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":true},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true},"paymentArrangements":{"cooperative":false,"clubCard":false},"otherServiceOffers":"Billa shop & shop, Backshop, Vignetten-Verkauf","position":3,"open":true,"distance":0.7729766074116283,"prices":[{"fuelType":"DIE","amount":1.182,"label":"Diesel"}]},{"id":4398,"name":"Bp","location":{"address":"Linzerstraße 52","postalCode":"4780","city":"Schärding","latitude":48.4511296,"longitude":13.4359547},"contact":{"telephone":"4377122194","fax":"43771221944","mail":"info@hell-alfred.at","website":"http://www.hell-alfred.at"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"06:00","to":"22:00"},{"day":"DI","label":"Dienstag","order":2,"from":"06:00","to":"22:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"06:00","to":"22:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"06:00","to":"22:00"},{"day":"FR","label":"Freitag","order":5,"from":"06:00","to":"22:00"},{"day":"SA","label":"Samstag","order":6,"from":"06:00","to":"22:00"},{"day":"SO","label":"Sonntag","order":7,"from":"07:00","to":"21:00"},{"day":"FE","label":"Feiertag","order":8,"from":"07:00","to":"21:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":false},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true},"paymentArrangements":{"cooperative":false,"clubCard":false},"position":4,"open":true,"distance":0.6851881360486911,"prices":[{"fuelType":"DIE","amount":1.192,"label":"Diesel"}]},{"id":34459,"name":"Lagerhaus Genol","location":{"address":"Otterbacherstrasse 2","postalCode":"4786","city":"Brunnenthal","latitude":48.4584665,"longitude":13.4449326},"contact":{"telephone":"4377123135","mail":"rlh_schaerding@schaerding.rlh.at"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"00:00","to":"24:00"},{"day":"DI","label":"Dienstag","order":2,"from":"00:00","to":"24:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"00:00","to":"24:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"00:00","to":"24:00"},{"day":"FR","label":"Freitag","order":5,"from":"00:00","to":"24:00"},{"day":"SA","label":"Samstag","order":6,"from":"00:00","to":"24:00"},{"day":"SO","label":"Sonntag","order":7,"from":"00:00","to":"24:00"},{"day":"FE","label":"Feiertag","order":8,"from":"00:00","to":"24:00"}],"offerInformation":{"service":false,"selfService":false,"unattended":true},"paymentMethods":{"cash":false,"debitCard":false,"creditCard":false},"paymentArrangements":{"cooperative":false,"clubCard":false},"position":5,"open":true,"distance":0.9795663890363353,"prices":[{"fuelType":"DIE","amount":1.192,"label":"Diesel"}]},{"id":1132040,"name":"Diskont Tankstelle","location":{"address":"Othmar-Spanlang-Straße 1 (\"Hofer Parkplatz\")","postalCode":"4780","city":"Schärding","latitude":48.446581,"longitude":13.439444},"contact":{"mail":"tankstellen@gutmann.cc","website":"http://www.gutmann.cc"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"06:00","to":"22:00"},{"day":"DI","label":"Dienstag","order":2,"from":"06:00","to":"22:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"06:00","to":"22:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"06:00","to":"22:00"},{"day":"FR","label":"Freitag","order":5,"from":"06:00","to":"22:00"},{"day":"SA","label":"Samstag","order":6,"from":"06:00","to":"22:00"},{"day":"SO","label":"Sonntag","order":7,"from":"06:00","to":"22:00"},{"day":"FE","label":"Feiertag","order":8,"from":"06:00","to":"22:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":true},"paymentMethods":{"cash":false,"debitCard":true,"creditCard":true,"others":"AP Karte"},"paymentArrangements":{"cooperative":false,"clubCard":false},"position":6,"open":true,"distance":1.2531494440658468,"prices":[]},{"id":33765,"name":"Land lebt auf Suben Gmbh","location":{"address":"Schnelldorf 60","postalCode":"4975","city":"Suben","latitude":48.4186387,"longitude":13.4362911},"contact":{"telephone":"436644558554","fax":"437711315835","mail":"Landlebtauf.suben@pfeiffer.at"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"05:30","to":"20:30"},{"day":"DI","label":"Dienstag","order":2,"from":"05:30","to":"20:30"},{"day":"MI","label":"Mittwoch","order":3,"from":"05:30","to":"20:30"},{"day":"DO","label":"Donnerstag","order":4,"from":"05:30","to":"20:30"},{"day":"FR","label":"Freitag","order":5,"from":"05:30","to":"20:30"},{"day":"SA","label":"Samstag","order":6,"from":"05:30","to":"20:30"},{"day":"SO","label":"Sonntag","order":7,"from":"07:00","to":"20:30"},{"day":"FE","label":"Feiertag","order":8,"from":"07:00","to":"20:30"}],"offerInformation":{"service":false,"selfService":false,"unattended":false},"paymentMethods":{"cash":false,"debitCard":false,"creditCard":false},"paymentArrangements":{"cooperative":false,"clubCard":false,"accessMod":"Freie Tankstelle"},"otherServiceOffers":"Nahversorger zu Günstigen Preisen!\r\nLebensmittelmarkt zu Diskountpreisen!\r\nBackstation!\r\nLotto-Toto !\r\nAuto-Waschbox!\r\nPost-Servicestelle","position":7,"open":true,"distance":4.2461735768192215,"prices":[]},{"id":35778,"name":"BP","location":{"address":"Passauer Strasse 29 ","postalCode":"4780","city":"Schaerding","latitude":48.4640812,"longitude":13.4356825},"contact":{"telephone":"4377122261","fax":"437712226116","mail":"R52445@bprosi.at"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"06:00","to":"22:00"},{"day":"DI","label":"Dienstag","order":2,"from":"06:00","to":"22:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"06:00","to":"22:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"06:00","to":"22:00"},{"day":"FR","label":"Freitag","order":5,"from":"06:00","to":"22:00"},{"day":"SA","label":"Samstag","order":6,"from":"06:00","to":"22:00"},{"day":"SO","label":"Sonntag","order":7,"from":"06:00","to":"22:00"},{"day":"FE","label":"Feiertag","order":8,"from":"06:00","to":"22:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":false},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true,"others":"Routex"},"paymentArrangements":{"cooperative":false,"clubCard":false},"otherServiceOffers":"Merkur Inside, Car Wash","position":8,"open":true,"distance":0.8688480164956199,"prices":[]},{"id":262902,"name":"Shell Schaerding","location":{"address":"Passauer Strasse 21","postalCode":"4780","city":"Schaerding","latitude":48.46383,"longitude":13.4332573},"contact":{"telephone":"771236040","mail":"office@stiglechner.co.at"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"06:00","to":"22:00"},{"day":"DI","label":"Dienstag","order":2,"from":"06:00","to":"22:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"06:00","to":"22:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"06:00","to":"22:00"},{"day":"FR","label":"Freitag","order":5,"from":"06:00","to":"22:00"},{"day":"SA","label":"Samstag","order":6,"from":"07:00","to":"22:00"},{"day":"SO","label":"Sonntag","order":7,"from":"08:00","to":"22:00"},{"day":"FE","label":"Feiertag","order":8,"from":"08:00","to":"22:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":false},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true,"others":"IQ Card, Euroshell"},"paymentArrangements":{"cooperative":false,"clubCard":false},"otherServiceOffers":"Bistro, Shop, Portalwaschanlage, SB-Sauger","position":9,"open":true,"distance":0.8017144638408347,"prices":[]},{"id":448796,"name":"Shell Austria","location":{"address":"ETZELSHOFEN 125","postalCode":"4975","city":"SUBEN","latitude":48.40061,"longitude":13.42603},"contact":{"telephone":"0771131620"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"00:00","to":"24:00"},{"day":"DI","label":"Dienstag","order":2,"from":"00:00","to":"24:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"00:00","to":"24:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"00:00","to":"24:00"},{"day":"FR","label":"Freitag","order":5,"from":"00:00","to":"24:00"},{"day":"SA","label":"Samstag","order":6,"from":"00:00","to":"24:00"},{"day":"SO","label":"Sonntag","order":7,"from":"00:00","to":"24:00"},{"day":"FE","label":"Feiertag","order":8,"from":"00:00","to":"24:00"}],"offerInformation":{"service":false,"selfService":false,"unattended":false},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true},"paymentArrangements":{"cooperative":false,"clubCard":false},"position":10,"open":true,"distance":6.255841554824173,"prices":[]}]
                                            

                                            Das Script starte ich mit einem Cron alle 5 Minuten neu und der Parser holt den Link alle 10 Sekunden.

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            1.0k
                                            Online

                                            31.7k
                                            Users

                                            79.7k
                                            Topics

                                            1.3m
                                            Posts

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