NEWS
Skripten des E-Control Spritpreisrechners
-
@metaxa sagte in Skripten des E-Control Spritpreisrechners:
Wenn du in deinem Datenpunkt einen sehr langen String stehen hast, dann machen wir mit
Hab ich
-
ok, perfekt (Ich der große ioBroker Klugscheisser, hahahaha)
"Mein" Script beschreibt die von mir händisch - in meiner Struktur - angelegten Datenpunkte. Wenn ihr noch keine eigene Struktur habt oder wollt, dann müsst ihr bitte diese Zeilen
setState("a_andreas.0.eigene_dp.Spritpreisrechner.Preistreffer_01"/*Aktueller Spritpreis*/, pricehit_01); setState("a_andreas.0.eigene_dp.Spritpreisrechner.Preistreffer_02"/*Aktueller Spritpreis*/, pricehit_02); setState("a_andreas.0.eigene_dp.Spritpreisrechner.Preistreffer_03"/*Aktueller Spritpreis*/, pricehit_03); setState("a_andreas.0.eigene_dp.Spritpreisrechner.Preistreffer_04"/*Aktueller Spritpreis*/, pricehit_04); setState("a_andreas.0.eigene_dp.Spritpreisrechner.Preistreffer_05"/*Aktueller Spritpreis*/, pricehit_05);
abändern. Jeweils der Logik folgend in
setState("javascript.0.Aktueller_Spritpreis_01"/*Aktueller Spritpreis*/, pricehit_01); setState("javascript.0.Aktueller_Spritpreis_02"/*Aktueller Spritpreis*/, pricehit_02); usw.......
Was ich jeztz nicht weiß, ob JS die Datenpunkte automatisch auch anlegt. Unter JS kann man Datenpunkte auto nur nur in der JS Struktur anlegen, nicht wo anders.
Versucht es mal!
LG, mxa -
@metaxa sagte in Skripten des E-Control Spritpreisrechners:
Was ich jeztz nicht weiß, ob JS die Datenpunkte automatisch auch anlegt. Unter JS kann man Datenpunkte auto nur nur in der JS Struktur anlegen, nicht wo anders.
Hat leider nicht funktioniert.
Habs geändert in
setState("javascript.0.Aktueller_Spritpreis_01"/*Aktueller Spritpreis*/, pricehit_01); setState("javascript.0.Aktueller_Spritpreis_02"/*Aktueller Spritpreis*/, pricehit_02); setState("javascript.0.Aktueller_Spritpreis_03"/*Aktueller Spritpreis*/, pricehit_03); setState("javascript.0.Aktueller_Spritpreis_04"/*Aktueller Spritpreis*/, pricehit_04); setState("javascript.0.Aktueller_Spritpreis_05"/*Aktueller Spritpreis*/, pricehit_05);
doch unter javascript.0 scheint es nicht auf
wie könnte ich händisch die DP anlegen?
-
läuft bei mir auch nicht
irgendwas machen wir falsch! -
@SmarthomeMF sagte in Skripten des E-Control Spritpreisrechners:
läuft bei mir auch nicht
hast du die DP unter javascript.0 händisch angelegt?
Geht das über den Expertenmodus und dann auf das "+"?
Wenn ja, was gehört bei Datenpunkttyp ausgewählt?
-
-
@metaxa sagte in Skripten des E-Control Spritpreisrechners:
Danke
Was gehört bei Datenpunkttyp ausgewählt?
-
@SmarthomeMF sagte in Skripten des E-Control Spritpreisrechners:
irgendwas machen wir falsch!
Glaube ich nicht, ich denke der ParserDP hat sich nicht geändert. Ihr müßt eine Änderung erzwingen!
-
@metaxa sagte in Skripten des E-Control Spritpreisrechners:
ich denke der ParserDP hat sich nicht geändert. Ihr müßt eine Änderung erzwingen!
wie
-
@Negalein sagte in Skripten des E-Control Spritpreisrechners:
Was gehört bei Datenpunkttyp ausgewählt?
-
@SmarthomeMF sagte in Skripten des E-Control Spritpreisrechners:
@metaxa sagte in Skripten des E-Control Spritpreisrechners:
ich denke der ParserDP hat sich nicht geändert. Ihr müßt eine Änderung erzwingen!
wie
Die Profis werden mich erschlagen ..... ich habe immer den Datentyp auf boolen umgeändert (so wie du es urspünglich falsch hattest) speichern, dann wurde der DP geändert, der String wieder weg. Dann wieder richtig auf JSON geändert und gespeichert, dann aktualisert er wieder. Darauf sollte dein Script reagieren.
Hm?
LG -
@metaxa sagte in Skripten des E-Control Spritpreisrechners:
Die Profis werden mich erschlagen ..... ich habe immer den Datentyp auf boolen umgeändert (so wie du es urspünglich falsch hattest) speichern, dann wurde der DP geändert, der String wieder weg. Dann wieder richtig auf JSON geändert und gespeichert, dann aktualisert er wieder. Darauf sollte dein Script reagieren.
DANKE, es funktioniert
-
@metaxa sagte in Skripten des E-Control Spritpreisrechners:
Darauf sollte dein Script reagieren.
PS: bitte melde dich, wenn du es geschafft hast, die Adresse anzeigen zu lassen.
Leider gibt es bei mir zB 2 Tankstellen, die gleich heißen, aber doch 30km auseinander sind.
Da wäre die Adresse (zumindest der Ort) sehr vorteilhaft. -
@Negalein fein!
Dann tue noch dem Kollegen "steinejo_io" ein positives Voting geben, er hat den Megaanteil daran!
LG, mxa -
@metaxa sagte in Skripten des E-Control Spritpreisrechners:
Dann tue noch dem Kollegen "steinejo_io" ein positives Voting geben, er hat den Megaanteil daran!
Logo
-
@Negalein wegen Adresse ...
hock dich mal hin und probier herum, eventuell bist schneller als ich
Hab auch nur herumgedoktert bis jetzt und mich durchgebissen
Schönen Abend von Wien nach OÖ!
LG, mxa -
@metaxa sagte in Skripten des E-Control Spritpreisrechners:
@Negalein wegen Adresse ...
hock dich mal hin und probier herumwenn ich https://api.e-control.at/sprit/1.0/search/gas-stations/by-address?latitude=XX.XXXXXX&longitude=XX.XXXXXX&fuelType=DIE&includeClosed=false im Browser öffne, bekomm ich eine Liste mit Adresse usw.!
Aber wie ich die auch in ioBroker bekomme?[{"id":1172639,"name":"SB-Tankstelle Zauner","location":{"address":"Jagern 18","postalCode":"4761","city":"Enzenkirchen","latitude":48.37648,"longitude":13.63102},"contact":{"mail":"office@auto-zauner.at","website":"http://www.auto-zauner.at"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"06:30","to":"24:00"},{"day":"DI","label":"Dienstag","order":2,"from":"06:30","to":"24:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"06:30","to":"24:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"06:30","to":"24:00"},{"day":"FR","label":"Freitag","order":5,"from":"06:30","to":"24:00"},{"day":"SA","label":"Samstag","order":6,"from":"06:30","to":"24:00"},{"day":"SO","label":"Sonntag","order":7,"from":"07:00","to":"24:00"},{"day":"FE","label":"Feiertag","order":8,"from":"07:00","to":"24:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":true},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":false},"paymentArrangements":{"cooperative":false,"clubCard":false},"position":1,"open":true,"distance":19.410600073755752,"prices":[{"fuelType":"DIE","amount":1.147,"label":"Diesel"}]},{"id":237857,"name":"freie Tankstelle","location":{"address":"Gschaid 8","postalCode":"4723","city":"Natternbach","latitude":48.4039189,"longitude":13.6922177},"contact":{"telephone":"4972788226","mail":"office@edtmaier.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":false,"selfService":true,"unattended":true},"paymentMethods":{"cash":true,"debitCard":false,"creditCard":false},"paymentArrangements":{"cooperative":false,"clubCard":false},"position":2,"open":true,"distance":20.493637541852294,"prices":[{"fuelType":"DIE","amount":1.168,"label":"Diesel"}]},{"id":1446426,"name":"Turmöl Quick","location":{"address":"Hauptstraße 86","postalCode":"4092","city":"Esternberg","latitude":48.542477,"longitude":13.5834969},"contact":{"mail":"Steinkellner@doppler.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":true,"debitCard":true,"creditCard":true},"paymentArrangements":{"cooperative":false,"clubCard":false},"position":3,"open":true,"distance":8.922574842048649,"prices":[{"fuelType":"DIE","amount":1.179,"label":"Diesel"}]},{"id":43946,"name":"SB-Tankstelle Zauner","location":{"address":"Ludwig-Paglstr. 1","postalCode":"4780","city":"Schärding","latitude":48.447209,"longitude":13.439305},"contact":{"website":"http://www.auto-zauner.at"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"00:00","to":"24:00"},{"day":"DI","label":"Dienstag","order":2,"from":"00:00","to":"24:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"00:00","to":"24:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"00:00","to":"24:00"},{"day":"FR","label":"Freitag","order":5,"from":"00:00","to":"24:00"},{"day":"SA","label":"Samstag","order":6,"from":"00:00","to":"24:00"},{"day":"SO","label":"Sonntag","order":7,"from":"00:00","to":"24:00"},{"day":"FE","label":"Feiertag","order":8,"from":"00:00","to":"24:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":true},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":false},"paymentArrangements":{"cooperative":false,"clubCard":false},"position":4,"open":true,"distance":7.816478583286358,"prices":[{"fuelType":"DIE","amount":1.187,"label":"Diesel"}]},{"id":227,"name":"avanti - Sankt Florian/Inn Bundesstraße 129","location":{"address":"Bundesstrasse 129","postalCode":"4780","city":"Sankt Florian/Inn","latitude":48.43865,"longitude":13.44392},"contact":{"telephone":"800202055","fax":"800","website":"www.omv.com"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"00:00","to":"24:00"},{"day":"DI","label":"Dienstag","order":2,"from":"00:00","to":"24:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"00:00","to":"24:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"00:00","to":"24:00"},{"day":"FR","label":"Freitag","order":5,"from":"00:00","to":"24:00"},{"day":"SA","label":"Samstag","order":6,"from":"00:00","to":"24:00"},{"day":"SO","label":"Sonntag","order":7,"from":"00:00","to":"24:00"},{"day":"FE","label":"Feiertag","order":8,"from":"00:00","to":"24:00"}],"offerInformation":{"service":false,"selfService":true,"unattended":true},"paymentMethods":{"cash":false,"debitCard":true,"creditCard":true,"others":"OMV STATIONSKARTE, MASTERCARD, MAESTRO, VISA"},"paymentArrangements":{"cooperative":false,"clubCard":false},"position":5,"open":true,"distance":8.64983543713606,"prices":[{"fuelType":"DIE","amount":1.187,"label":"Diesel"}]},{"id":34459,"name":"Lagerhaus Genol","location":{"address":"Otterbacherstrasse 2","postalCode":"4786","city":"Brunnenthal","latitude":48.4584665,"longitude":13.4449326},"contact":{"telephone":"4377123135","mail":"rlh_schaerding@schaerding.rlh.at"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"00:00","to":"24:00"},{"day":"DI","label":"Dienstag","order":2,"from":"00:00","to":"24:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"00:00","to":"24:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"00:00","to":"24:00"},{"day":"FR","label":"Freitag","order":5,"from":"00:00","to":"24:00"},{"day":"SA","label":"Samstag","order":6,"from":"00:00","to":"24:00"},{"day":"SO","label":"Sonntag","order":7,"from":"00:00","to":"24:00"},{"day":"FE","label":"Feiertag","order":8,"from":"00:00","to":"24:00"}],"offerInformation":{"service":false,"selfService":false,"unattended":true},"paymentMethods":{"cash":false,"debitCard":false,"creditCard":false},"paymentArrangements":{"cooperative":false,"clubCard":false},"position":6,"open":true,"distance":6.496922872446322,"prices":[]},{"id":43069,"name":"IQ Tankstelle","location":{"address":"Rannariedlerstrasse 10","postalCode":"4143","city":"Neustift","latitude":48.503373,"longitude":13.755291},"contact":{"telephone":"72848116","fax":"728481164"},"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"},"paymentArrangements":{"cooperative":false,"clubCard":false},"otherServiceOffers":"Diesel HL Zapfsule","position":7,"open":true,"distance":21.066170364638694,"prices":[]},{"id":247993,"name":"eni","location":{"address":"Andiesen 15","postalCode":"4774","city":"St. Marienkirchen / Schärding","latitude":48.394378,"longitude":13.427743},"contact":{"telephone":"0771133045","fax":"07711330454"},"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":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":13.719939198994112,"prices":[]},{"id":448798,"name":"Shell Austria","location":{"address":"ANDIESEN 8","postalCode":"4774","city":"ST. MARIENKIRCHEN","latitude":48.39134,"longitude":13.42525},"contact":{"telephone":"077112811"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"00:00","to":"24:00"},{"day":"DI","label":"Dienstag","order":2,"from":"00:00","to":"24:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"00:00","to":"24:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"00:00","to":"24:00"},{"day":"FR","label":"Freitag","order":5,"from":"00:00","to":"24:00"},{"day":"SA","label":"Samstag","order":6,"from":"00:00","to":"24:00"},{"day":"SO","label":"Sonntag","order":7,"from":"00:00","to":"24:00"},{"day":"FE","label":"Feiertag","order":8,"from":"00:00","to":"24:00"}],"offerInformation":{"service":false,"selfService":false,"unattended":false},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true},"paymentArrangements":{"cooperative":false,"clubCard":false},"position":9,"open":true,"distance":14.091531761182328,"prices":[]},{"id":448796,"name":"Shell Austria","location":{"address":"ETZELSHOFEN 125","postalCode":"4975","city":"SUBEN","latitude":48.40061,"longitude":13.42603},"contact":{"telephone":"0771131620"},"openingHours":[{"day":"MO","label":"Montag","order":1,"from":"00:00","to":"24:00"},{"day":"DI","label":"Dienstag","order":2,"from":"00:00","to":"24:00"},{"day":"MI","label":"Mittwoch","order":3,"from":"00:00","to":"24:00"},{"day":"DO","label":"Donnerstag","order":4,"from":"00:00","to":"24:00"},{"day":"FR","label":"Freitag","order":5,"from":"00:00","to":"24:00"},{"day":"SA","label":"Samstag","order":6,"from":"00:00","to":"24:00"},{"day":"SO","label":"Sonntag","order":7,"from":"00:00","to":"24:00"},{"day":"FE","label":"Feiertag","order":8,"from":"00:00","to":"24:00"}],"offerInformation":{"service":false,"selfService":false,"unattended":false},"paymentMethods":{"cash":true,"debitCard":true,"creditCard":true},"paymentArrangements":{"cooperative":false,"clubCard":false},"position":10,"open":true,"distance":13.076430377020321,"prices":[]}]
Oder meinst du was anderes?
-
@Negalein ???
Dein Parser holt die Ausgabe deiner API-URL in den ioBroker.
Das Script vom Kollegen - wurde von mir nur angepaßt - holt aus dem DP des Parsers die Namen und Preise.
Jetzt muss man das Script nur noch um die Adresse erweitern.
Glaube es mir, wenn der Erfolg mal kommt, dann machts auch Spass. Ich habe jetzt 14 Tage immer wieder daran herumgebastelt, eben weil keine Ahnung von JS. Hab die HTML Ausgabe in XLS und mit Notpade++ zerlegt um hinter die Überlegungen von "steinejo_io" zu kommen.Also, die Adresse kommt über das Script
LG, mxa
-
Schau dir das mal an was der paser auswirft.
Da steht ja alles drin!!
Das brauchst du ja nur einmal auswerten und das ändert sich nicht.
Von Adresse bis Email Telefonnummer steht da alles drin.
Mittlerweile sind bei mir nun auch die Daten der einzelnen Tankstellen da.
Perfekt Danke -
@SmarthomeMF
Gerne!
Hier gehts zum Voting für den Kollegen "steinejo_io"!
LG, mxa