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

  • Default (No Skin)
  • No Skin
Collapse
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. JavaScript
  5. Skripten des E-Control Spritpreisrechners

NEWS

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    17
    1
    2.5k

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    13
    1
    986

  • Weihnachtsangebot 2025! 🎄
    BluefoxB
    Bluefox
    25
    1
    2.3k

Skripten des E-Control Spritpreisrechners

Scheduled Pinned Locked Moved JavaScript
javascriptmonitoring
292 Posts 21 Posters 49.9k Views 17 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Reese1

    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?

    NegaleinN Offline
    NegaleinN Offline
    Negalein
    Global Moderator
    wrote on last edited by
    #253

    @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.

    ° Node.js & System Update ---> sudo apt update, iob stop, sudo apt full-upgrade
    ° Node.js Fixer ---> iob nodejs-update
    ° Fixer ---> iob fix

    1 Reply Last reply
    0
    • R Online
      R Online
      Reese1
      wrote on last edited by Negalein
      #254

      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");
      });
      
      NegaleinN 1 Reply Last reply
      0
      • R Reese1

        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?

        NegaleinN Offline
        NegaleinN Offline
        Negalein
        Global Moderator
        wrote on last edited by
        #255

        @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?

        ° Node.js & System Update ---> sudo apt update, iob stop, sudo apt full-upgrade
        ° Node.js Fixer ---> iob nodejs-update
        ° Fixer ---> iob fix

        1 Reply Last reply
        0
        • R Online
          R Online
          Reese1
          wrote on last edited by
          #256

          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
          0
          • R Reese1

            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");
            });
            
            NegaleinN Offline
            NegaleinN Offline
            Negalein
            Global Moderator
            wrote on last edited by
            #257

            @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 ;)

            ° Node.js & System Update ---> sudo apt update, iob stop, sudo apt full-upgrade
            ° Node.js Fixer ---> iob nodejs-update
            ° Fixer ---> iob fix

            1 Reply Last reply
            0
            • R Online
              R Online
              Reese1
              wrote on last edited by
              #258

              ja genau so ist es auch, :grinning:

              NegaleinN 1 Reply Last reply
              0
              • R Reese1

                ja genau so ist es auch, :grinning:

                NegaleinN Offline
                NegaleinN Offline
                Negalein
                Global Moderator
                wrote on last edited by
                #259

                @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.

                ° Node.js & System Update ---> sudo apt update, iob stop, sudo apt full-upgrade
                ° Node.js Fixer ---> iob nodejs-update
                ° Fixer ---> iob fix

                1 Reply Last reply
                0
                • R Online
                  R Online
                  Reese1
                  wrote on last edited by
                  #260

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

                  NegaleinN 1 Reply Last reply
                  0
                  • R Reese1

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

                    NegaleinN Offline
                    NegaleinN Offline
                    Negalein
                    Global Moderator
                    wrote on last edited by
                    #261

                    @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

                    ° Node.js & System Update ---> sudo apt update, iob stop, sudo apt full-upgrade
                    ° Node.js Fixer ---> iob nodejs-update
                    ° Fixer ---> iob fix

                    1 Reply Last reply
                    0
                    • R Online
                      R Online
                      Reese1
                      wrote on last edited by
                      #262

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

                      NegaleinN 1 Reply Last reply
                      0
                      • R Reese1

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

                        NegaleinN Offline
                        NegaleinN Offline
                        Negalein
                        Global Moderator
                        wrote on last edited by
                        #263

                        @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

                        ° Node.js & System Update ---> sudo apt update, iob stop, sudo apt full-upgrade
                        ° Node.js Fixer ---> iob nodejs-update
                        ° Fixer ---> iob fix

                        1 Reply Last reply
                        0
                        • NegaleinN Offline
                          NegaleinN Offline
                          Negalein
                          Global Moderator
                          wrote on last edited by
                          #264

                          @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.

                          ° Node.js & System Update ---> sudo apt update, iob stop, sudo apt full-upgrade
                          ° Node.js Fixer ---> iob nodejs-update
                          ° Fixer ---> iob fix

                          maximal1981M 1 Reply Last reply
                          0
                          • R Online
                            R Online
                            Reese1
                            wrote on last edited by
                            #265

                            super Vielen Dank, teste ich gleich, :slightly_smiling_face:

                            1 Reply Last reply
                            0
                            • NegaleinN Negalein

                              @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.

                              maximal1981M Offline
                              maximal1981M Offline
                              maximal1981
                              wrote on last edited by
                              #266

                              @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

                              NegaleinN 1 Reply Last reply
                              0
                              • maximal1981M maximal1981

                                @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

                                NegaleinN Offline
                                NegaleinN Offline
                                Negalein
                                Global Moderator
                                wrote on last edited by
                                #267

                                @maximal1981 sagte in Skripten des E-Control Spritpreisrechners:

                                Denke aber es würde etlichen helfen, wenn du dein Script um gewisse Tankstellen erweiterst, oder es vernünftig erklärst.

                                Vorweg, das Script ist nicht von mir.
                                Ist ursprünglich von @steinejo_io erstellt worden. Dann von @metaxa und @klaus88 erweitert worden.

                                Zu deinem Problem.

                                Was kommt bei dir, wenn du die JSON im Browser aufrufst?

                                Wie sehen deine Logos aus?

                                Was hast du am Script angepasst?

                                ° Node.js & System Update ---> sudo apt update, iob stop, sudo apt full-upgrade
                                ° Node.js Fixer ---> iob nodejs-update
                                ° Fixer ---> iob fix

                                maximal1981M 1 Reply Last reply
                                0
                                • NegaleinN Negalein

                                  @maximal1981 sagte in Skripten des E-Control Spritpreisrechners:

                                  Denke aber es würde etlichen helfen, wenn du dein Script um gewisse Tankstellen erweiterst, oder es vernünftig erklärst.

                                  Vorweg, das Script ist nicht von mir.
                                  Ist ursprünglich von @steinejo_io erstellt worden. Dann von @metaxa und @klaus88 erweitert worden.

                                  Zu deinem Problem.

                                  Was kommt bei dir, wenn du die JSON im Browser aufrufst?

                                  Wie sehen deine Logos aus?

                                  Was hast du am Script angepasst?

                                  maximal1981M Offline
                                  maximal1981M Offline
                                  maximal1981
                                  wrote on last edited by
                                  #268

                                  @Negalein said in Skripten des E-Control Spritpreisrechners:

                                  Wie sehen deine Logos aus?

                                  Was hast du am Script angepasst?

                                  Logos hab ich noch keine. Bin aktuell nur am Admin-Interface unterwegs.

                                  mein Script sieht aktuell so aus:

                                  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                  //  "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', 'JOBA'];
                                  	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");
                                  });
                                  

                                  was ich mich nur bis dato Frage, warum hat keiner einen Adapter daraus gebaut, sondern "parst" das ganze?
                                  Im Endeffekt macht der Adapter eh das selbe, aber man kann leichter mehrere Instanzen erzeugen, aber bin auf eure Antworten diesbezüglich gespannt.

                                  NegaleinN 1 Reply Last reply
                                  0
                                  • maximal1981M maximal1981

                                    @Negalein said in Skripten des E-Control Spritpreisrechners:

                                    Wie sehen deine Logos aus?

                                    Was hast du am Script angepasst?

                                    Logos hab ich noch keine. Bin aktuell nur am Admin-Interface unterwegs.

                                    mein Script sieht aktuell so aus:

                                    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                    //  "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', 'JOBA'];
                                    	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");
                                    });
                                    

                                    was ich mich nur bis dato Frage, warum hat keiner einen Adapter daraus gebaut, sondern "parst" das ganze?
                                    Im Endeffekt macht der Adapter eh das selbe, aber man kann leichter mehrere Instanzen erzeugen, aber bin auf eure Antworten diesbezüglich gespannt.

                                    NegaleinN Offline
                                    NegaleinN Offline
                                    Negalein
                                    Global Moderator
                                    wrote on last edited by
                                    #269

                                    @maximal1981 sagte in Skripten des E-Control Spritpreisrechners:

                                    was ich mich nur bis dato Frage, warum hat keiner einen Adapter daraus gebaut, sondern "parst" das ganze?

                                    schätze Österreich ist einfach zu klein dafür.

                                    Fangen wir der Reihe nach an.
                                    Logos machen wir ganz am Schluss.

                                    Schick mir mal die Ausgabe vom API-Link im Browser.
                                    https://api.e-control.at/sprit/1.0/search/gas-stations/by-address?latitude=XX.XXXXXX&longitude=XX.XXXXXX&fuelType=DIE&includeClosed=false

                                    latitude XX.XXXXXX & longitude XX.XXXXXX durch deine bevorzugten Koordinaten ersetzen.

                                    Längen und Breitengrad zB auf https://www.latlong.net/

                                    ° Node.js & System Update ---> sudo apt update, iob stop, sudo apt full-upgrade
                                    ° Node.js Fixer ---> iob nodejs-update
                                    ° Fixer ---> iob fix

                                    maximal1981M 1 Reply Last reply
                                    0
                                    • NegaleinN Negalein

                                      @maximal1981 sagte in Skripten des E-Control Spritpreisrechners:

                                      was ich mich nur bis dato Frage, warum hat keiner einen Adapter daraus gebaut, sondern "parst" das ganze?

                                      schätze Österreich ist einfach zu klein dafür.

                                      Fangen wir der Reihe nach an.
                                      Logos machen wir ganz am Schluss.

                                      Schick mir mal die Ausgabe vom API-Link im Browser.
                                      https://api.e-control.at/sprit/1.0/search/gas-stations/by-address?latitude=XX.XXXXXX&longitude=XX.XXXXXX&fuelType=DIE&includeClosed=false

                                      latitude XX.XXXXXX & longitude XX.XXXXXX durch deine bevorzugten Koordinaten ersetzen.

                                      Längen und Breitengrad zB auf https://www.latlong.net/

                                      maximal1981M Offline
                                      maximal1981M Offline
                                      maximal1981
                                      wrote on last edited by
                                      #270

                                      @Negalein said in Skripten des E-Control Spritpreisrechners:

                                      Schick mir mal die Ausgabe vom API-Link im Browser.

                                      das ist ja kein Problem, den hab ich schon im Parser:

                                      [{"id":33596,"name":"AVIA ","location":{"address":"Keltenstraße 2","postalCode":"3100","city":"St. Pölten-Ratzersdorf","latitude":48.2279934,"longitude":15.6768304},"contact":{"telephone":"43274224668","fax":"43274224677","mail":"avia@marchhart.com","website":"http://www.peugeot-marchhart.at"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"05:00","to":"22:00"},{"day":"DI","label":"Dienstag","order":2,"from":"05:00","to":"22:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"05:00","to":"22:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"05:00","to":"22:00"},{"day":"FR","label":"Freitag","order":5,"from":"05: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,"others":"AVIAmat-Tankkarte"},"paymentArrangements":{"cooperative":false,"clubCard":false},"otherServiceOffers":"Portalwaschanlage, SB-Waschbox, SB-Sauger, LKW-tauglich, LKW-Hochleistungssäule, CNG/Erdgas, AdBlue, Shop, Bistro, Kundentelefon, Vignettenverkauf, Internet-Terminal","position":1,"open":true,"distance":4.388640888551343,"prices":[{"fuelType":"SUP","amount":1.072,"label":"Super 95"}]},{"id":109233,"name":"JOBA-Diskont Tanken","location":{"address":"Hauptstrasse 48","postalCode":"3140","city":"Pottenbrunn","latitude":48.234907,"longitude":15.6905083},"contact":{"telephone":"43274242522","fax":"43274242516","mail":"tankstelle.bichler@aon.at"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"06:00","to":"21:00"},{"day":"DI","label":"Dienstag","order":2,"from":"06:00","to":"21:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"06:00","to":"21:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"06:00","to":"21:00"},{"day":"FR","label":"Freitag","order":5,"from":"06:00","to":"21:00"},{"day":"SA","label":"Samstag","order":6,"from":"07:00","to":"20:00"},{"day":"SO","label":"Sonntag","order":7,"from":"07:00","to":"20:00"},{"day":"FE","label":"Feiertag","order":8,"from":"07:00","to":"20:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":false},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true},"paymentArrangements":{"cooperative":false,"clubCard":false},"otherServiceOffers":"Tankstelle,Gasthaus,,Lotto,Blumengeschäft,Postpartner,Shop,Werkstätte,Zimmer.\r\nWir betanken auch gerne(falls gewünscht)Ihr Fahrzeug!","position":2,"open":true,"distance":4.590168849388595,"prices":[{"fuelType":"SUP","amount":1.073,"label":"Super 95"}]},{"id":33627,"name":"AVIA mit Bedienung","location":{"postalCode":"3071","city":"Fahrafeld 15","latitude":48.146059,"longitude":15.749009},"contact":{"telephone":"4327445619","fax":"4327445619","mail":"office@eigl.at"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"07:00","to":"18:00"},{"day":"DI","label":"Dienstag","order":2,"from":"07:00","to":"18:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"07:00","to":"18:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"07:00","to":"18:00"},{"day":"FR","label":"Freitag","order":5,"from":"07:00","to":"18:00"},{"day":"SA","label":"Samstag","order":6,"from":"07:00","to":"13:00"},{"day":"SO","label":"Sonntag","order":7,"from":"07:00","to":"20:00"},{"day":"FE","label":"Feiertag","order":8,"from":"07:00","to":"20:00"}],"offerInformation":{"service":true,"selfService":false,"unattended":false},"paymentMethods":{"cash":true,"debitCard":false,"creditCard":false},"paymentArrangements":{"cooperative":false,"clubCard":false},"otherServiceOffers":"Kaufhaus","position":3,"open":false,"distance":6.225483712914487,"prices":[{"fuelType":"SUP","amount":1.079,"label":"Super 95"}]},{"id":6219,"name":"Genol - Raiffeisenlagerhaus St. Pölten","location":{"address":"Obere Hauptstrasse 41","postalCode":"3071","city":"Böheimkirchen","latitude":48.198248,"longitude":15.753644},"contact":{"telephone":"4327432224","fax":"432743222475","mail":"energie@stpoelten.rlh.at","website":"http://www.lagerhaus-stpoelten.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":true,"creditCard":true,"others":"Kundenkarte"},"paymentArrangements":{"cooperative":false,"clubCard":false},"otherServiceOffers":"Kundenkarte holen und Geld sparen.\r\nTanken Sie von 00.00 bis 24.00 Uhr mit Bankomat, Kreditkarte und Kundenkarte.","position":4,"open":true,"distance":3.114868916867809,"prices":[{"fuelType":"SUP","amount":1.084,"label":"Super 95"}]},{"id":1354797,"name":"avanti - Sankt Pölten Wiener Straße 92","location":{"address":"Wiener Strasse 92","postalCode":"3100","city":"Sankt Poelten","latitude":48.20673,"longitude":15.64125},"contact":{"telephone":"800202055","fax":"800","website":"www.omv.com"},"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":true},"paymentMethods":{"cash":false,"debitCard":true,"creditCard":true,"others":"OMV STATIONSKARTE, DKV, MASTERCARD, MAESTRO, ROUTEX, DINERS, VISA"},"paymentArrangements":{"cooperative":false,"clubCard":false},"position":5,"open":true,"distance":5.363257419264544,"prices":[{"fuelType":"SUP","amount":1.084,"label":"Super 95"}]},{"id":4089,"name":"Tankstopp","location":{"address":"Hauptstraße 8","postalCode":"3143","city":"Pyhra","latitude":48.1590154,"longitude":15.6848005},"contact":{"telephone":"43274583083","fax":"43274583084","mail":"office@tankstopp.at","website":"http://www.tankstopp.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":"19:00"},{"day":"FE","label":"Feiertag","order":8,"from":"07:00","to":"19:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":false},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true,"others":"Tankkarte"},"paymentArrangements":{"cooperative":false,"clubCard":false},"otherServiceOffers":"Stammkundenkartenrabatt 1Cent/Liter","position":6,"open":true,"distance":4.595653008197485,"prices":[]},{"id":247881,"name":"eni","location":{"address":"Wiener Strasse 66","postalCode":"3100","city":"St. Pölten","latitude":48.203264,"longitude":15.637852},"contact":{"telephone":"02742258633","fax":"027422586334"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"05:00","to":"23:00"},{"day":"DI","label":"Dienstag","order":2,"from":"05:00","to":"23:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"05:00","to":"23:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"05:00","to":"23:00"},{"day":"FR","label":"Freitag","order":5,"from":"05:00","to":"23:00"},{"day":"SA","label":"Samstag","order":6,"from":"05:00","to":"23:00"},{"day":"SO","label":"Sonntag","order":7,"from":"05:00","to":"23:00"},{"day":"FE","label":"Feiertag","order":8,"from":"05:00","to":"23:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":false},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true,"others":"AMEX,Maestro,Diners Club,DKV,GUTS,LOGP,MasterCard,Routex,UTA,VISA"},"paymentArrangements":{"cooperative":false,"clubCard":false},"position":7,"open":true,"distance":5.541807776579032,"prices":[]},{"id":35664,"name":"BP","location":{"address":"Hainfelderstr. ","postalCode":"3071","city":"Boeheimkirchen","latitude":48.194014,"longitude":15.765381},"contact":{"telephone":"4327433265","fax":"432743231220","mail":"tremmel.transporte@aon.at"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"06:00","to":"20:30"},{"day":"DI","label":"Dienstag","order":2,"from":"06:00","to":"20:30"},{"day":"MI","label":"Mittwoch","order":3,"from":"06:00","to":"20:30"},{"day":"DO","label":"Donnerstag","order":4,"from":"06:00","to":"20:30"},{"day":"FR","label":"Freitag","order":5,"from":"06:00","to":"20:30"},{"day":"SA","label":"Samstag","order":6,"from":"06:00","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":true,"unattended":false},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true,"others":"Routex"},"paymentArrangements":{"cooperative":false,"clubCard":false},"otherServiceOffers":"Autowash, SB-Wash","position":8,"open":false,"distance":3.984712299523193,"prices":[]},{"id":35766,"name":"BP","location":{"address":"Niederoesterreichring 20 ","postalCode":"3100","city":"St. Poelten","latitude":48.1979429,"longitude":15.6397468},"contact":{"telephone":"432742230033","mail":"R52571@bprosi.at"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"05:00","to":"24:00"},{"day":"DI","label":"Dienstag","order":2,"from":"05:00","to":"24:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"05:00","to":"24:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"05:00","to":"24:00"},{"day":"FR","label":"Freitag","order":5,"from":"05:00","to":"24:00"},{"day":"SA","label":"Samstag","order":6,"from":"05:00","to":"24:00"},{"day":"SO","label":"Sonntag","order":7,"from":"05:00","to":"24:00"},{"day":"FE","label":"Feiertag","order":8,"from":"05:00","to":"24:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":false},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true,"others":"Routex"},"paymentArrangements":{"cooperative":false,"clubCard":false},"otherServiceOffers":"Waschstrasse, Wild Bean Cafe, Staubsauger","position":9,"open":true,"distance":5.348706403529263,"prices":[]},{"id":248033,"name":"eni","location":{"address":"S 33","postalCode":"3100","city":"St. Pölten","latitude":48.19600961,"longitude":15.66120386},"contact":{"telephone":"02742230070","fax":"0274223007021"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"04:00","to":"23:00"},{"day":"DI","label":"Dienstag","order":2,"from":"04:00","to":"22:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"04:00","to":"23:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"04:00","to":"23:00"},{"day":"FR","label":"Freitag","order":5,"from":"04:00","to":"23:00"},{"day":"SA","label":"Samstag","order":6,"from":"04:00","to":"23:00"},{"day":"SO","label":"Sonntag","order":7,"from":"04:00","to":"23:00"},{"day":"FE","label":"Feiertag","order":8,"from":"04:00","to":"23:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":false},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true,"others":"AMEX,Maestro,Diners Club,DKV,GUTS,LOGP,MasterCard,Routex,UTA,VISA"},"paymentArrangements":{"cooperative":false,"clubCard":false},"position":10,"open":true,"distance":3.7530527119611987,"prices":[]}]
                                      

                                      Aber nochmals zum Adapter, das scheint nicht so schwer zu sein, bzw. vll könnte ich wenn auftreiben, der darüber gerne ein TuT machen würde und somit v0.1 erstellen könnte.

                                      Den Rest können ja dann die schlauen Köpfe hier übernehmen.

                                      NegaleinN 1 Reply Last reply
                                      0
                                      • metaxaM Offline
                                        metaxaM Offline
                                        metaxa
                                        wrote on last edited by metaxa
                                        #271

                                        @maximal1981 sagte in Skripten des E-Control Spritpreisrechners:

                                        das scheint nicht so schwer zu sein

                                        Bitte mach unbedingt, es fehlt den schlauen Köpfen hier im Forum oft an Freizeit um die scheinbar leichte Entwicklung von Adaptern aus dem Ärmel zu schütteln :flushed:
                                        Ich bin für meinen Teil jedenfalls zufrieden und verwende den Parser direkt schon lange nicht mehr. Ich parse im weiterentwickelten Script (danke Rainer!!). Stelle es dir zur Unterstützung bei der Enwicklung des Adapters gerne zur Verfügung.

                                        LG, mxa

                                        1 Reply Last reply
                                        1
                                        • maximal1981M maximal1981

                                          @Negalein said in Skripten des E-Control Spritpreisrechners:

                                          Schick mir mal die Ausgabe vom API-Link im Browser.

                                          das ist ja kein Problem, den hab ich schon im Parser:

                                          [{"id":33596,"name":"AVIA ","location":{"address":"Keltenstraße 2","postalCode":"3100","city":"St. Pölten-Ratzersdorf","latitude":48.2279934,"longitude":15.6768304},"contact":{"telephone":"43274224668","fax":"43274224677","mail":"avia@marchhart.com","website":"http://www.peugeot-marchhart.at"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"05:00","to":"22:00"},{"day":"DI","label":"Dienstag","order":2,"from":"05:00","to":"22:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"05:00","to":"22:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"05:00","to":"22:00"},{"day":"FR","label":"Freitag","order":5,"from":"05: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,"others":"AVIAmat-Tankkarte"},"paymentArrangements":{"cooperative":false,"clubCard":false},"otherServiceOffers":"Portalwaschanlage, SB-Waschbox, SB-Sauger, LKW-tauglich, LKW-Hochleistungssäule, CNG/Erdgas, AdBlue, Shop, Bistro, Kundentelefon, Vignettenverkauf, Internet-Terminal","position":1,"open":true,"distance":4.388640888551343,"prices":[{"fuelType":"SUP","amount":1.072,"label":"Super 95"}]},{"id":109233,"name":"JOBA-Diskont Tanken","location":{"address":"Hauptstrasse 48","postalCode":"3140","city":"Pottenbrunn","latitude":48.234907,"longitude":15.6905083},"contact":{"telephone":"43274242522","fax":"43274242516","mail":"tankstelle.bichler@aon.at"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"06:00","to":"21:00"},{"day":"DI","label":"Dienstag","order":2,"from":"06:00","to":"21:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"06:00","to":"21:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"06:00","to":"21:00"},{"day":"FR","label":"Freitag","order":5,"from":"06:00","to":"21:00"},{"day":"SA","label":"Samstag","order":6,"from":"07:00","to":"20:00"},{"day":"SO","label":"Sonntag","order":7,"from":"07:00","to":"20:00"},{"day":"FE","label":"Feiertag","order":8,"from":"07:00","to":"20:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":false},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true},"paymentArrangements":{"cooperative":false,"clubCard":false},"otherServiceOffers":"Tankstelle,Gasthaus,,Lotto,Blumengeschäft,Postpartner,Shop,Werkstätte,Zimmer.\r\nWir betanken auch gerne(falls gewünscht)Ihr Fahrzeug!","position":2,"open":true,"distance":4.590168849388595,"prices":[{"fuelType":"SUP","amount":1.073,"label":"Super 95"}]},{"id":33627,"name":"AVIA mit Bedienung","location":{"postalCode":"3071","city":"Fahrafeld 15","latitude":48.146059,"longitude":15.749009},"contact":{"telephone":"4327445619","fax":"4327445619","mail":"office@eigl.at"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"07:00","to":"18:00"},{"day":"DI","label":"Dienstag","order":2,"from":"07:00","to":"18:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"07:00","to":"18:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"07:00","to":"18:00"},{"day":"FR","label":"Freitag","order":5,"from":"07:00","to":"18:00"},{"day":"SA","label":"Samstag","order":6,"from":"07:00","to":"13:00"},{"day":"SO","label":"Sonntag","order":7,"from":"07:00","to":"20:00"},{"day":"FE","label":"Feiertag","order":8,"from":"07:00","to":"20:00"}],"offerInformation":{"service":true,"selfService":false,"unattended":false},"paymentMethods":{"cash":true,"debitCard":false,"creditCard":false},"paymentArrangements":{"cooperative":false,"clubCard":false},"otherServiceOffers":"Kaufhaus","position":3,"open":false,"distance":6.225483712914487,"prices":[{"fuelType":"SUP","amount":1.079,"label":"Super 95"}]},{"id":6219,"name":"Genol - Raiffeisenlagerhaus St. Pölten","location":{"address":"Obere Hauptstrasse 41","postalCode":"3071","city":"Böheimkirchen","latitude":48.198248,"longitude":15.753644},"contact":{"telephone":"4327432224","fax":"432743222475","mail":"energie@stpoelten.rlh.at","website":"http://www.lagerhaus-stpoelten.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":true,"creditCard":true,"others":"Kundenkarte"},"paymentArrangements":{"cooperative":false,"clubCard":false},"otherServiceOffers":"Kundenkarte holen und Geld sparen.\r\nTanken Sie von 00.00 bis 24.00 Uhr mit Bankomat, Kreditkarte und Kundenkarte.","position":4,"open":true,"distance":3.114868916867809,"prices":[{"fuelType":"SUP","amount":1.084,"label":"Super 95"}]},{"id":1354797,"name":"avanti - Sankt Pölten Wiener Straße 92","location":{"address":"Wiener Strasse 92","postalCode":"3100","city":"Sankt Poelten","latitude":48.20673,"longitude":15.64125},"contact":{"telephone":"800202055","fax":"800","website":"www.omv.com"},"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":true},"paymentMethods":{"cash":false,"debitCard":true,"creditCard":true,"others":"OMV STATIONSKARTE, DKV, MASTERCARD, MAESTRO, ROUTEX, DINERS, VISA"},"paymentArrangements":{"cooperative":false,"clubCard":false},"position":5,"open":true,"distance":5.363257419264544,"prices":[{"fuelType":"SUP","amount":1.084,"label":"Super 95"}]},{"id":4089,"name":"Tankstopp","location":{"address":"Hauptstraße 8","postalCode":"3143","city":"Pyhra","latitude":48.1590154,"longitude":15.6848005},"contact":{"telephone":"43274583083","fax":"43274583084","mail":"office@tankstopp.at","website":"http://www.tankstopp.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":"19:00"},{"day":"FE","label":"Feiertag","order":8,"from":"07:00","to":"19:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":false},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true,"others":"Tankkarte"},"paymentArrangements":{"cooperative":false,"clubCard":false},"otherServiceOffers":"Stammkundenkartenrabatt 1Cent/Liter","position":6,"open":true,"distance":4.595653008197485,"prices":[]},{"id":247881,"name":"eni","location":{"address":"Wiener Strasse 66","postalCode":"3100","city":"St. Pölten","latitude":48.203264,"longitude":15.637852},"contact":{"telephone":"02742258633","fax":"027422586334"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"05:00","to":"23:00"},{"day":"DI","label":"Dienstag","order":2,"from":"05:00","to":"23:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"05:00","to":"23:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"05:00","to":"23:00"},{"day":"FR","label":"Freitag","order":5,"from":"05:00","to":"23:00"},{"day":"SA","label":"Samstag","order":6,"from":"05:00","to":"23:00"},{"day":"SO","label":"Sonntag","order":7,"from":"05:00","to":"23:00"},{"day":"FE","label":"Feiertag","order":8,"from":"05:00","to":"23:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":false},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true,"others":"AMEX,Maestro,Diners Club,DKV,GUTS,LOGP,MasterCard,Routex,UTA,VISA"},"paymentArrangements":{"cooperative":false,"clubCard":false},"position":7,"open":true,"distance":5.541807776579032,"prices":[]},{"id":35664,"name":"BP","location":{"address":"Hainfelderstr. ","postalCode":"3071","city":"Boeheimkirchen","latitude":48.194014,"longitude":15.765381},"contact":{"telephone":"4327433265","fax":"432743231220","mail":"tremmel.transporte@aon.at"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"06:00","to":"20:30"},{"day":"DI","label":"Dienstag","order":2,"from":"06:00","to":"20:30"},{"day":"MI","label":"Mittwoch","order":3,"from":"06:00","to":"20:30"},{"day":"DO","label":"Donnerstag","order":4,"from":"06:00","to":"20:30"},{"day":"FR","label":"Freitag","order":5,"from":"06:00","to":"20:30"},{"day":"SA","label":"Samstag","order":6,"from":"06:00","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":true,"unattended":false},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true,"others":"Routex"},"paymentArrangements":{"cooperative":false,"clubCard":false},"otherServiceOffers":"Autowash, SB-Wash","position":8,"open":false,"distance":3.984712299523193,"prices":[]},{"id":35766,"name":"BP","location":{"address":"Niederoesterreichring 20 ","postalCode":"3100","city":"St. Poelten","latitude":48.1979429,"longitude":15.6397468},"contact":{"telephone":"432742230033","mail":"R52571@bprosi.at"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"05:00","to":"24:00"},{"day":"DI","label":"Dienstag","order":2,"from":"05:00","to":"24:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"05:00","to":"24:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"05:00","to":"24:00"},{"day":"FR","label":"Freitag","order":5,"from":"05:00","to":"24:00"},{"day":"SA","label":"Samstag","order":6,"from":"05:00","to":"24:00"},{"day":"SO","label":"Sonntag","order":7,"from":"05:00","to":"24:00"},{"day":"FE","label":"Feiertag","order":8,"from":"05:00","to":"24:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":false},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true,"others":"Routex"},"paymentArrangements":{"cooperative":false,"clubCard":false},"otherServiceOffers":"Waschstrasse, Wild Bean Cafe, Staubsauger","position":9,"open":true,"distance":5.348706403529263,"prices":[]},{"id":248033,"name":"eni","location":{"address":"S 33","postalCode":"3100","city":"St. Pölten","latitude":48.19600961,"longitude":15.66120386},"contact":{"telephone":"02742230070","fax":"0274223007021"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"04:00","to":"23:00"},{"day":"DI","label":"Dienstag","order":2,"from":"04:00","to":"22:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"04:00","to":"23:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"04:00","to":"23:00"},{"day":"FR","label":"Freitag","order":5,"from":"04:00","to":"23:00"},{"day":"SA","label":"Samstag","order":6,"from":"04:00","to":"23:00"},{"day":"SO","label":"Sonntag","order":7,"from":"04:00","to":"23:00"},{"day":"FE","label":"Feiertag","order":8,"from":"04:00","to":"23:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":false},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true,"others":"AMEX,Maestro,Diners Club,DKV,GUTS,LOGP,MasterCard,Routex,UTA,VISA"},"paymentArrangements":{"cooperative":false,"clubCard":false},"position":10,"open":true,"distance":3.7530527119611987,"prices":[]}]
                                          

                                          Aber nochmals zum Adapter, das scheint nicht so schwer zu sein, bzw. vll könnte ich wenn auftreiben, der darüber gerne ein TuT machen würde und somit v0.1 erstellen könnte.

                                          Den Rest können ja dann die schlauen Köpfe hier übernehmen.

                                          NegaleinN Offline
                                          NegaleinN Offline
                                          Negalein
                                          Global Moderator
                                          wrote on last edited by Negalein
                                          #272

                                          @maximal1981 sagte in Skripten des E-Control Spritpreisrechners:

                                          Aber nochmals zum Adapter, das scheint nicht so schwer zu sein, bzw. vll könnte ich wenn auftreiben, der darüber gerne ein TuT machen würde und somit v0.1 erstellen könnte.

                                          Wenn jemand einen Adapter erstellt, hätt ich auch nichts dagegen.
                                          Das Script funktioniert aber sehr gut und frisst bestimmt weniger Resourcen.

                                          das ist ja kein Problem, den hab ich schon im Parser:

                                          Ok, dir fehlt dann quasi die Zuordnung der Bilder zu den DP.

                                          Im Script änderst du diesen Teil

                                          //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', 'JOBA'];
                                          

                                          in diesen Teil

                                          //AVIA=1, JOBA=2, Genol=3, avanti=4, Tankstopp=5, eni=6, BP=7
                                              var arrMarke = ['AVIA', 'JOBA', 'Genol', 'avanti', 'Tankstopp', 'eni', 'BP'];
                                          

                                          Jetzt such dir die Logos in Google raus und nummeriere sie 1-7.
                                          Also zB für AVIA benennst du die Datei 1.png
                                          Für JOBA dann 2.png
                                          usw.

                                          ° Node.js & System Update ---> sudo apt update, iob stop, sudo apt full-upgrade
                                          ° Node.js Fixer ---> iob nodejs-update
                                          ° Fixer ---> iob fix

                                          T 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          Support us

                                          ioBroker
                                          Community Adapters
                                          Donate

                                          674

                                          Online

                                          32.6k

                                          Users

                                          82.3k

                                          Topics

                                          1.3m

                                          Posts
                                          Community
                                          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                                          ioBroker Community 2014-2025
                                          logo
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Home
                                          • Recent
                                          • Tags
                                          • Unread 0
                                          • Categories
                                          • Unreplied
                                          • Popular
                                          • GitHub
                                          • Docu
                                          • Hilfe