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
    3.2k

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

  • Weihnachtsangebot 2025! 🎄
    BluefoxB
    Bluefox
    25
    1
    2.4k

Skripten des E-Control Spritpreisrechners

Scheduled Pinned Locked Moved JavaScript
javascriptmonitoring
292 Posts 21 Posters 50.6k 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.
  • S salmi

    @klaus88 SUPER !!! Es Funktioniert.

    K Offline
    K Offline
    klaus88
    wrote on last edited by
    #247

    @salmi Perfekt - Schönes Wochenende!

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lastyle
      wrote on last edited by
      #248

      Hallo, danke für das Skript!

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

      danke

      metaxaM 1 Reply Last reply
      0
      • L lastyle

        Hallo, danke für das Skript!

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

        danke

        metaxaM Offline
        metaxaM Offline
        metaxa
        wrote on last edited by
        #249

        @lastyle sagte in Skripten des E-Control Spritpreisrechners:

        wie kann ich es auf eine bestimmte Tankstelle fixieren?

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

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

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

        LG, mxa

        L 1 Reply Last reply
        0
        • metaxaM metaxa

          @lastyle sagte in Skripten des E-Control Spritpreisrechners:

          wie kann ich es auf eine bestimmte Tankstelle fixieren?

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

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

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

          LG, mxa

          L Offline
          L Offline
          lastyle
          wrote on last edited by
          #250

          @metaxa :+1:

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

          metaxaM 1 Reply Last reply
          0
          • L lastyle

            @metaxa :+1:

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

            metaxaM Offline
            metaxaM Offline
            metaxa
            wrote on last edited by
            #251

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

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

              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 2 Replies 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
                #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
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          Support us

                                          ioBroker
                                          Community Adapters
                                          Donate

                                          647

                                          Online

                                          32.7k

                                          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