NEWS
Skripten des E-Control Spritpreisrechners
-
@Negalein
ich habe inzwischen einen URL erzeugt - weiß der Teufel wo das ist, ich bin keine Alpenländler.So ganz einfach wie ich es mir vorgestellt habe wird es fast nicht.
Ich hatte die Regionensuche bemüht und ein json zurückbekommen.
Das kann man wie ich es wollte schnell mit regex auseinandernehmen - ganz ohne javascript.Bedingung ist, die Reihenfolge in dem json bleibt unverändert, und man will nur wenige Stationen monitoren.
Dann kann mal alleine mit dem Parser mit wenigen Zeilen zu einem Ergebnis kommen.
-
@SmarthomeMF
Ich hab mir gerade die Ausgabe des Links in einem Editor angeschaut.Wie ich bereits vermutet habe, werden sowieso nur bei den ersten 5 billigsten Tankstellen die Preise angezeigt.
-
Hier mal das Vorgehen:
Voraussetzung ist, dass sich die Reihenfolge bei den Abfragen NICHT ändert. sonst braucht es eine weitere Zeile je Tankstelle
URL und REGEX eingeben wie gehabt.
Name entspricht der Tankstelle
NUM ist die Position dieser Tankstelle im JSON (-1)fertig
-
@Negalein
so ist es.
Heisst das , dass sich die Reihenfolge ändert?Dann muss jeweils eine weiter Zeile, gleicher URL, gleiche NUM mit Regex
me":"(\D+)","
Typ Text
Der gibt dann den Namen der Tankstelle aus -
Hallo, kann ich das auch haben? Wie bekomme ich die Url für meinen Ort heraus?
-
@Homoran sagte in Skripten des E-Control Spritpreisrechners:
Heisst das , dass sich die Reihenfolge ändert?
Ja!
Es werden 10 Tankstellen angezeigt, aber nur bei den 5 günstigsten scheint der Preis auf.
Siehe auch www.spritpreisrechner.at
Kannst ja mal meinen Ort (Schärding) eingeben. -
@Negalein sagte in Skripten des E-Control Spritpreisrechners:
Ja!
Es werden 10 Tankstellen angezeigt, aber nur bei den 5 günstigsten scheint der Preis auf.
Siehe auch www.spritpreisrechner.at
Kannst ja mal meinen Ort (Schärding) eingeben.ja ich brauche immer etwas länger....
habe es auch schon gemerkt.
Es sind 10 da aber nur 5 mit Preise.
Ich brauche aber mehr als die 5.
Aber mal schauen was da vom @Homoran noch kommt.
Ich bin froh für jede Lösung den ich kenne mich nicht aus.
Danke für die Tolle Arbeit! -
@sigi234 sagte in Skripten des E-Control Spritpreisrechners:
Hallo, kann ich das auch haben? Wie bekomme ich die Url für meinen Ort heraus?
Dieser Link ist für meine Koordinaten. Und Treibstoff DIE (Diesel)!
https://api.e-control.at/sprit/1.0/search/gas-stations/by-address?latitude=XX.XXXXXX&longitude=XX.XXXXXX&fuelType=DIE&includeClosed=falseKoordinaten bekommst du hier raus.
Dann den erzeugten Link in Parser als JSON eintragen.
Datenpunkte unter javascript. erzeugen.
Script anpassen
fertig -
@sigi234 sagte in Skripten des E-Control Spritpreisrechners:
Wie bekomme ich die Url für meinen Ort heraus?
wurde oben schon von den Kollegen genau beschrieben.
das habe sogar ich geschafft!
dann schaffst du das auch. -
@SmarthomeMF sagte in Skripten des E-Control Spritpreisrechners:
Ich brauche aber mehr als die 5.
Dann musst du mit 2 unterschiedlichen Gebieten/Links arbeiten.
Im Umkreis von deinen Koordinaten werden nur 5 mit Preisen angezeigt. -
@SmarthomeMF sagte in Skripten des E-Control Spritpreisrechners:
@sigi234 sagte in Skripten des E-Control Spritpreisrechners:
Wie bekomme ich die Url für meinen Ort heraus?
wurde oben schon von den Kollegen genau beschrieben.
das habe sogar ich geschafft!
dann schaffst du das auch.Ja, Danke überlesen........funktioniert schon, diese stehen ja eigentlich auch im Admin Adapter drinnen.
Welches ist jetzt das aktuelle Skript? -
@SmarthomeMF sagte in Skripten des E-Control Spritpreisrechners:
Aber mal schauen was da vom @Homoran noch kommt.
Ich kann auch nicht zaubern
Wenn da keine Preise verschickt werden, kann ich auch keine extrahieren.Mein Ansatz war nur alles ohne Javascript hinzubekommen.
-
@sigi234 sagte in Skripten des E-Control Spritpreisrechners:
Welches ist jetzt das aktuelle Skript?
Das von @metaxa ist das aktuelle Script mit Preis, Name und Adresse.
-
@Homoran sagte in Skripten des E-Control Spritpreisrechners:
Ich kann auch nicht zaubern
wann dann doch du!!
ich bekomme nicht mal 5 aktualisiert! -
@SmarthomeMF sagte in Skripten des E-Control Spritpreisrechners:
ich bekomme nicht mal 5 aktualisiert!
Dann versuch mal folgendes!
- stell im Parser wieder von JSON auf irgendwas anderes um
- lösch das Script
- lösch alle erstellten DP
- starte ioBroker neu
- erstell die DP
- erstell das Script
- stell im Parser wieder auf JSON um
-
@SmarthomeMF
Ich kann halt auch nur rudimentär mit Blockly scripten.
Da wollte ich es mal nur mit dem Parser testen.mit C&P habe ich jetzt eine zweite Tankstelle in weniger als einer Minute angelegt.
Ich weiß nicht wie oft in A sich die Preise ändern, hier in D kann das schon im 10-Minutentakt passieren, aber laut Eröffnungspost habe ich das mal auf 3600000 Millisekunden (=1 Stunde) eingestellt.
Ob sich dann da etwas aktualisiert, aknn ich jetzt auch noch nicht sagen.
-
Hallo, was mache ich Falsch?
-
@sigi234
Was kommt denn raus? -
@Homoran sagte in Skripten des E-Control Spritpreisrechners:
@sigi234
Was kommt denn raus?[{"id":34612,"name":"AVIA Xpress (Automaten-Tankstelle)","location":{"address":"Wiener Straße 33","postalCode":"4053","city":"Haid","latitude":48.197898,"longitude":14.251821},"contact":{"telephone":"43775287991","fax":"4377528799184","mail":"vertrieb@seifriedsberger.at","website":"http://www.seifriedsberger.at"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"06:00","to":"22:00"},{"day":"DI","label":"Dienstag","order":2,"from":"06:00","to":"22:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"06:00","to":"22:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"06:00","to":"22:00"},{"day":"FR","label":"Freitag","order":5,"from":"06:00","to":"22:00"},{"day":"SA","label":"Samstag","order":6,"from":"06:00","to":"22:00"},{"day":"SO","label":"Sonntag","order":7,"from":"06:00","to":"22:00"},{"day":"FE","label":"Feiertag","order":8,"from":"06:00","to":"22:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":true},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true,"others":"AVIAmat-Tankkarte"},"paymentArrangements":{"cooperative":false,"clubCard":false},"otherServiceOffers":"LKW-tauglich","position":1,"open":true,"distance":6.890972361536602,"prices":[{"fuelType":"DIE","amount":1.174,"label":"Diesel"}]},{"id":264416,"name":"AVIA Xpress (Automaten-Tankstelle)","location":{"address":"Kremstalstrasse 50","postalCode":"4501","city":"Neuhofen an der Krems","latitude":48.131053,"longitude":14.220532},"contact":{"telephone":"43775287991","fax":"4377528799184","mail":"office@seifriedsberger.at","website":"http://www.seifriedsberger.at"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"06:00","to":"22:00"},{"day":"DI","label":"Dienstag","order":2,"from":"06:00","to":"22:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"06:00","to":"22:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"06:00","to":"22:00"},{"day":"FR","label":"Freitag","order":5,"from":"06:00","to":"22:00"},{"day":"SA","label":"Samstag","order":6,"from":"06:00","to":"22:00"},{"day":"SO","label":"Sonntag","order":7,"from":"06:00","to":"22:00"},{"day":"FE","label":"Feiertag","order":8,"from":"06:00","to":"22:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":true},"paymentMethods":{"cash":false,"debitCard":true,"creditCard":true,"others":"AVIAmat Tankkarte"},"paymentArrangements":{"cooperative":false,"clubCard":false,"accessMod":"AVIAmat Tankkarte"},"position":2,"open":true,"distance":0.9709991509304108,"prices":[{"fuelType":"DIE","amount":1.177,"label":"Diesel"}]},{"id":1406206,"name":"Turmöl","location":{"address":"Sipbach 10","postalCode":"4511","city":"Allhaming","latitude":48.150116,"longitude":14.1789738},"contact":{"telephone":"437227710417","fax":"437227710418"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"06:00","to":"22:00"},{"day":"DI","label":"Dienstag","order":2,"from":"06:00","to":"22:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"06:00","to":"22:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"06:00","to":"22:00"},{"day":"FR","label":"Freitag","order":5,"from":"06:00","to":"22:00"},{"day":"SA","label":"Samstag","order":6,"from":"06:00","to":"22:00"},{"day":"SO","label":"Sonntag","order":7,"from":"06:00","to":"22:00"},{"day":"FE","label":"Feiertag","order":8,"from":"06:00","to":"22:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":false},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true},"paymentArrangements":{"cooperative":false,"clubCard":false},"position":3,"open":true,"distance":3.918723482306115,"prices":[{"fuelType":"DIE","amount":1.177,"label":"Diesel"}]},{"id":621253,"name":"OIL! Tankstelle","location":{"address":"Salzburgerstrasse 12","postalCode":"4053","city":"Haid","latitude":48.2032,"longitude":14.2496},"contact":{},"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":"08:00","to":"21:00"},{"day":"FE","label":"Feiertag","order":8,"from":"08:00","to":"21:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":false},"paymentMethods":{"cash":true,"debitCard":false,"creditCard":false},"paymentArrangements":{"cooperative":false,"clubCard":true},"otherServiceOffers":"Werkstatt, Autopflege, Reifenservice, Bistro, Vignette","position":4,"open":true,"distance":7.427065116028797,"prices":[{"fuelType":"DIE","amount":1.187,"label":"Diesel"}]},{"id":676543,"name":"IQ Allhaming","location":{"address":"Poststrasse 3","postalCode":"4511","city":"Allhaming","latitude":48.153132,"longitude":14.158255},"contact":{"mail":"office@stiglechner.co.at"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"00:00","to":"24:00"},{"day":"DI","label":"Dienstag","order":2,"from":"00:00","to":"24:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"00:00","to":"24:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"00:00","to":"24:00"},{"day":"FR","label":"Freitag","order":5,"from":"00:00","to":"24:00"},{"day":"SA","label":"Samstag","order":6,"from":"00:00","to":"24:00"},{"day":"SO","label":"Sonntag","order":7,"from":"00:00","to":"24:00"},{"day":"FE","label":"Feiertag","order":8,"from":"00:00","to":"24:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":true},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true,"others":"IQ Card, Euroshell, DKV, UTA, Hoyer"},"paymentArrangements":{"cooperative":false,"clubCard":false},"position":5,"open":true,"distance":5.48313957459672,"prices":[{"fuelType":"DIE","amount":1.194,"label":"Diesel"}]},{"id":4111,"name":"LAGERHAUS Genol","location":{"address":"STEYRERSTRASSE 28","postalCode":"4501","city":"NEUHOFEN","latitude":48.1379881,"longitude":14.2393913},"contact":{"telephone":"43820988144","mail":"energie@lagerhaus-traunviertel.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":"05:00","to":"22:00"},{"day":"SO","label":"Sonntag","order":7,"from":"05:00","to":"22:00"},{"day":"FE","label":"Feiertag","order":8,"from":"05:00","to":"22:00"}],"offerInformation":{"service":false,"selfService":false,"unattended":true},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true,"others":"Lagerhaus Traunviertel Tankkarte"},"paymentArrangements":{"cooperative":false,"clubCard":false},"position":6,"open":true,"distance":0.8096145670288883,"prices":[]},{"id":6671,"name":"Turmöl Schmidberger","location":{"address":"Linzerstr. 54","postalCode":"4531","city":"Kematen/Krems","latitude":48.105947781697,"longitude":14.189147600194},"contact":{"telephone":"4372287245","fax":"437228724533","mail":"office@ernst-schmidberger.at","website":"http://www.ernst-schmidberger.at"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"00:00","to":"24:00"},{"day":"DI","label":"Dienstag","order":2,"from":"00:00","to":"24:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"00:00","to":"24:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"00:00","to":"24:00"},{"day":"FR","label":"Freitag","order":5,"from":"00:00","to":"24:00"},{"day":"SA","label":"Samstag","order":6,"from":"00:00","to":"24:00"},{"day":"SO","label":"Sonntag","order":7,"from":"00:00","to":"24:00"},{"day":"FE","label":"Feiertag","order":8,"from":"00:00","to":"24:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":true},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true,"others":"BP-Routex, UTA, DKV, Austorcard, AP-Card"},"paymentArrangements":{"cooperative":false,"clubCard":false},"otherServiceOffers":"Kfz-Werkstätte, Abschleppdienst, Landmaschinen, Gartengeräte, Zweiradhandel","position":7,"open":true,"distance":4.610077744425186,"prices":[]},{"id":247991,"name":"eni","location":{"address":"Kremstalstrasse 117","postalCode":"4053","city":"Ritzlhof","latitude":48.187343,"longitude":14.249556},"contact":{"telephone":"0722988351","fax":"0722982134"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"06:00","to":"22:00"},{"day":"DI","label":"Dienstag","order":2,"from":"06:00","to":"22:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"06:00","to":"22:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"06:00","to":"22:00"},{"day":"FR","label":"Freitag","order":5,"from":"06:00","to":"22:00"},{"day":"SA","label":"Samstag","order":6,"from":"06:00","to":"22:00"},{"day":"SO","label":"Sonntag","order":7,"from":"06:00","to":"22:00"},{"day":"FE","label":"Feiertag","order":8,"from":"06:00","to":"22:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":false},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true,"others":"AMEX,Maestro,Diners Club,DKV,GUTS,MasterCard,Routex,UTA,VISA"},"paymentArrangements":{"cooperative":false,"clubCard":false},"position":8,"open":true,"distance":5.713226774009689,"prices":[]},{"id":325,"name":"OMV - Haid Kremstalstraße 30","location":{"address":"Kremstalstrasse 30","postalCode":"4053","city":"Haid","latitude":48.20365,"longitude":14.24699},"contact":{"telephone":"722988344","fax":"72298834413","mail":"retail.at.3557@omv.com","website":"www.omv.com"},"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":true,"selfService":true,"unattended":false},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true,"others":"UTA, ENI Routex Card, OMV ROUTEX, STATOIL card, BP card, MASTERCARD, MAESTRO, DINERS, VISA, AMEX, OMV STATIONSKARTE"},"paymentArrangements":{"cooperative":false,"clubCard":false},"position":9,"open":true,"distance":7.43782801378163,"prices":[]},{"id":33347,"name":"Shell Tankstelle","location":{"address":"Linzer Strasse 41","postalCode":"4501","city":"Neuhofen","latitude":48.143876,"longitude":14.228437},"contact":{"telephone":"72275055","fax":"722750554","mail":"office@stiglechner.co.at"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"06:00","to":"22:00"},{"day":"DI","label":"Dienstag","order":2,"from":"06:00","to":"22:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"06:00","to":"22:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"06:00","to":"22:00"},{"day":"FR","label":"Freitag","order":5,"from":"06:00","to":"22:00"},{"day":"SA","label":"Samstag","order":6,"from":"07:00","to":"22:00"},{"day":"SO","label":"Sonntag","order":7,"from":"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":"IQ Card, Euroshell, UTA"},"paymentArrangements":{"cooperative":false,"clubCard":false},"otherServiceOffers":"Shop, Bistro, Portalwaschanlage, SB Staubsauger, Diesel HL Zapfsule","position":10,"open":true,"distance":0.6571283670169982,"prices":[]}]
-
@sigi234
Warum trägst du keine RegEx ein?
ohne die ergibt ein Parser keinen SinnPreis (DIEsel:
IE"[^\d]+(\d\.\d+)
Name:
me":"(\D+)","