NEWS
Skripten des E-Control Spritpreisrechners
-
@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 -
Hallo
Weil das ganze so gut geklappt habe wollte ich gleich mal weiter machen.
Da mir nur 4 Tankstellen zu wenig sind habe ich das ganze erweitert.
Im Parser String habe ich 10 Tankstellen drin stehen.
Also wollte ich sie nützen.
Im Skript erweiterton({id:'parser.0.Sprit'/*Sprit*/, change: 'any'}, function(obj) { var pricehit_01 = "undefiniert"; var pricehit_02 = "undefiniert"; var pricehit_03 = "undefiniert"; var pricehit_04 = "undefiniert"; var pricehit_05 = "undefiniert"; var pricehit_06 = "undefiniert"; var pricehit_07 = "undefiniert"; var pricehit_08 = "undefiniert"; var pricehit_09 = "undefiniert"; var pricehit_10 = "undefiniert"; var pricehit_11 = "undefiniert"; var pricehit_12 = "undefiniert"; var pricehit_13 = "undefiniert"; var pricehit_14 = "undefiniert"; var index = 0; var gasStation = JSON.parse(obj.state.val); if (gasStation.length === 0) return; for (index = 0; index < gasStation.length; ++index) { pricehit_01 = gasStation[0].name + " " + (gasStation[0].prices[0].amount).toString().replace(".",",") + " €"; pricehit_02 = gasStation[1].name + " " + (gasStation[1].prices[0].amount).toString().replace(".",",") + " €"; pricehit_03 = gasStation[2].name + " " + (gasStation[2].prices[0].amount).toString().replace(".",",") + " €"; pricehit_04 = gasStation[3].name + " " + (gasStation[3].prices[0].amount).toString().replace(".",",") + " €"; pricehit_05 = gasStation[4].name + " " + (gasStation[4].prices[0].amount).toString().replace(".",",") + " €"; pricehit_06 = gasStation[4].name + " " + (gasStation[4].prices[0].amount).toString().replace(".",",") + " €"; pricehit_07 = gasStation[4].name + " " + (gasStation[4].prices[0].amount).toString().replace(".",",") + " €"; pricehit_08 = gasStation[4].name + " " + (gasStation[4].prices[0].amount).toString().replace(".",",") + " €"; pricehit_09 = gasStation[4].name + " " + (gasStation[4].prices[0].amount).toString().replace(".",",") + " €"; pricehit_10 = gasStation[4].name + " " + (gasStation[4].prices[0].amount).toString().replace(".",",") + " €"; pricehit_11 = gasStation[4].name + " " + (gasStation[4].prices[0].amount).toString().replace(".",",") + " €"; pricehit_12 = gasStation[4].name + " " + (gasStation[4].prices[0].amount).toString().replace(".",",") + " €"; pricehit_13 = gasStation[4].name + " " + (gasStation[4].prices[0].amount).toString().replace(".",",") + " €"; pricehit_14 = gasStation[4].name + " " + (gasStation[4].prices[0].amount).toString().replace(".",",") + " €"; } setState('javascript.0.Sprit.Tankstelle_1'/*Tankstelle 1*/, pricehit_01); setState('javascript.0.Sprit.Tankstelle_2'/*Tankstelle 2*/, pricehit_02); setState('javascript.0.Sprit.Tankstelle_3'/*Tankstelle 3*/, pricehit_03); setState('javascript.0.Sprit.Tankstelle_4'/*Tankstelle 4*/, pricehit_04); setState('javascript.0.Sprit.Tankstelle_5'/*Tankstelle 5*/, pricehit_05); setState('javascript.0.Sprit.Tankstelle_6'/*Tankstelle 6*/, pricehit_06); setState('javascript.0.Sprit.Tankstelle_7'/*Tankstelle 7*/, pricehit_07); setState('javascript.0.Sprit.Tankstelle_8'/*Tankstelle 8*/, pricehit_08); setState('javascript.0.Sprit.Tankstelle_9'/*Tankstelle 9*/, pricehit_09); setState('javascript.0.Sprit.Tankstelle_10'/*Tankstelle 10*/, pricehit_10); setState('javascript.0.Sprit.Tankstelle_11'/*Tankstelle 11*/, pricehit_11); setState('javascript.0.Sprit.Tankstelle_12'/*Tankstelle 12*/, pricehit_12); setState('javascript.0.Sprit.Tankstelle_13'/*Tankstelle 13*/, pricehit_13); setState('javascript.0.Sprit.Tankstelle_14'/*Tankstelle 14*/, pricehit_14); });
Datenpunkte angelegt
Es werden aber nur die Angezeigt was schon waren!
und im Log eine menge warnjavascript.0 2019-03-31 09:29:42.153 warn at TCP.onread (net.js:601:20) javascript.0 2019-03-31 09:29:42.153 warn at Socket.Readable.push (_stream_readable.js:208:10) javascript.0 2019-03-31 09:29:42.153 warn at readableAddChunk (_stream_readable.js:250:11) javascript.0 2019-03-31 09:29:42.153 warn at addChunk (_stream_readable.js:263:12) javascript.0 2019-03-31 09:29:42.153 warn at Socket.emit (events.js:211:7) javascript.0 2019-03-31 09:29:42.153 warn at emitOne (events.js:116:13) javascript.0 2019-03-31 09:29:42.153 warn at Socket.realHandler (/opt/iobroker/node_modules/ws/lib/WebSocket.js:825:20) javascript.0 2019-03-31 09:29:42.153 warn at Receiver.add (/opt/iobroker/node_modules/ws/lib/Receiver.js:103:24) javascript.0 2019-03-31 09:29:42.153 warn at Receiver.expectHandler (/opt/iobroker/node_modules/ws/lib/Receiver.js:499:31) javascript.0 2019-03-31 09:29:42.153 warn at Receiver.finish (/opt/iobroker/node_modules/ws/lib/Receiver.js:541:12) javascript.0 2019-03-31 09:29:42.153 warn at Receiver.flush (/opt/iobroker/node_modules/ws/lib/Receiver.js:347:3) javascript.0 2019-03-31 09:29:42.153 warn at /opt/iobroker/node_modules/ws/lib/Receiver.js:508:14 javascript.0 2019-03-31 09:29:42.153 warn at Receiver.applyExtensions (/opt/iobroker/node_modules/ws/lib/Receiver.js:371:5) javascript.0 2019-03-31 09:29:42.153 warn at /opt/iobroker/node_modules/ws/lib/Receiver.js:536:18 javascript.0 2019-03-31 09:29:42.153 warn at Receiver.ontext (/opt/iobroker/node_modules/ws/lib/WebSocket.js:841:10) javascript.0 2019-03-31 09:29:42.153 warn at WebSocket.emit (events.js:214:7) javascript.0 2019-03-31 09:29:42.153 warn at emitTwo (events.js:126:13) javascript.0 2019-03-31 09:29:42.153 warn at WebSocket.onMessage (/opt/iobroker/node_modules/ws/lib/WebSocket.js:442:14) javascript.0 2019-03-31 09:29:42.153 warn at WebSocket.ws.onmessage (/opt/iobroker/node_modules/engine.io-client/lib/transports/websocket.js:146:10) javascript.0 2019-03-31 09:29:42.153 warn at WS.Transport.onData (/opt/iobroker/node_modules/engine.io-client/lib/transport.js:137:8) javascript.0 2019-03-31 09:29:42.153 warn at WS.Transport.onPacket (/opt/iobroker/node_modules/engine.io-client/lib/transport.js:145:8) javascript.0 2019-03-31 09:29:42.153 warn at WS.Emitter.emit (/opt/iobroker/node_modules/engine.io-client/node_modules/component-emitter/index.js:133:20) javascript.0 2019-03-31 09:29:42.153 warn at WS.<anonymous> (/opt/iobroker/node_modules/engine.io-client/lib/socket.js:268:10) javascript.0 2019-03-31 09:29:42.153 warn at Socket.onPacket (/opt/iobroker/node_modules/engine.io-client/lib/socket.js:451:14) javascript.0 2019-03-31 09:29:42.153 warn at Socket.Emitter.emit (/opt/iobroker/node_modules/engine.io-client/node_modules/component-emitter/index.js:133:20) javascript.0 2019-03-31 09:29:42.153 warn at Socket.<anonymous> (/opt/iobroker/node_modules/component-bind/index.js:21:15) javascript.0 2019-03-31 09:29:42.153 warn at Manager.ondata (/opt/iobroker/node_modules/socket.io-client/lib/manager.js:322:16) javascript.0 2019-03-31 09:29:42.153 warn at Decoder.add (/opt/iobroker/node_modules/socket.io-parser/index.js:246:12) javascript.0 2019-03-31 09:29:42.153 warn at Decoder.Emitter.emit (/opt/iobroker/node_modules/component-emitter/index.js:134:20) javascript.0 2019-03-31 09:29:42.153 warn at Decoder.<anonymous> (/opt/iobroker/node_modules/component-bind/index.js:21:15) javascript.0 2019-03-31 09:29:42.153 warn at Manager.ondecoded (/opt/iobroker/node_modules/socket.io-client/lib/manager.js:332:8) javascript.0 2019-03-31 09:29:42.153 warn at Manager.Emitter.emit (/opt/iobroker/node_modules/socket.io-client/node_modules/component-emitter/index.js:133:20) javascript.0 2019-03-31 09:29:42.153 warn at Manager.<anonymous> (/opt/iobroker/node_modules/component-bind/index.js:21:15) javascript.0 2019-03-31 09:29:42.152 warn at Socket.onpacket (/opt/iobroker/node_modules/socket.io-client/lib/socket.js:228:12) javascript.0 2019-03-31 09:29:42.152 warn at Socket.onevent (/opt/iobroker/node_modules/socket.io-client/lib/socket.js:270:10) javascript.0 2019-03-31 09:29:42.152 warn at Socket.Emitter.emit (/opt/iobroker/node_modules/socket.io-client/node_modules/component-emitter/index.js:133:20) javascript.0 2019-03-31 09:29:42.152 warn at Socket.<anonymous> (/opt/iobroker/node_modules/iobroker.js-controller/lib/states/statesInMemClient.js:52:30) javascript.0 2019-03-31 09:29:42.152 warn at Object.change (/opt/iobroker/node_modules/iobroker.js-controller/lib/adapter.js:3705:37) javascript.0 2019-03-31 09:29:42.152 warn at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:364:25) javascript.0 2019-03-31 09:29:42.152 warn at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:963:38) javascript.0 2019-03-31 09:29:42.152 warn at Object.<anonymous> (script.js.common.003_Stromverbrauch.PV_Überschuss_vers_2_1:57:57) javascript.0 2019-03-31 09:29:42.152 warn getState "javascript.0.Datenpunkte.Pool.Pumpe AN / AUS" not found (3) javascript.0 2019-03-31 09:29:42.152 warn at TCP.onread (net.js:601:20) javascript.0 2019-03-31 09:29:42.152 warn at Socket.Readable.push (_stream_readable.js:208:10) javascript.0 2019-03-31 09:29:42.152 warn at readableAddChunk (_stream_readable.js:250:11) javascript.0 2019-03-31 09:29:42.152 warn at addChunk (_stream_readable.js:263:12) javascript.0 2019-03-31 09:29:42.152 warn at Socket.emit (events.js:211:7) javascript.0 2019-03-31 09:29:42.152 warn at emitOne (events.js:116:13) javascript.0 2019-03-31 09:29:42.152 warn at Socket.realHandler (/opt/iobroker/node_modules/ws/lib/WebSocket.js:825:20) javascript.0 2019-03-31 09:29:42.152 warn at Receiver.add (/opt/iobroker/node_modules/ws/lib/Receiver.js:103:24) javascript.0 2019-03-31 09:29:42.152 warn at Receiver.expectHandler (/opt/iobroker/node_modules/ws/lib/Receiver.js:499:31) javascript.0 2019-03-31 09:29:42.152 warn at Receiver.finish (/opt/iobroker/node_modules/ws/lib/Receiver.js:541:12) javascript.0 2019-03-31 09:29:42.152 warn at Receiver.flush (/opt/iobroker/node_modules/ws/lib/Receiver.js:347:3) javascript.0 2019-03-31 09:29:42.152 warn at /opt/iobroker/node_modules/ws/lib/Receiver.js:508:14 javascript.0 2019-03-31 09:29:42.152 warn at Receiver.applyExtensions (/opt/iobroker/node_modules/ws/lib/Receiver.js:371:5) javascript.0 2019-03-31 09:29:42.152 warn at /opt/iobroker/node_modules/ws/lib/Receiver.js:536:18 javascript.0 2019-03-31 09:29:42.152 warn at Receiver.ontext (/opt/iobroker/node_modules/ws/lib/WebSocket.js:841:10) javascript.0 2019-03-31 09:29:42.152 warn at WebSocket.emit (events.js:214:7) javascript.0 2019-03-31 09:29:42.152 warn at emitTwo (events.js:126:13) javascript.0 2019-03-31 09:29:42.152 warn at WebSocket.onMessage (/opt/iobroker/node_modules/ws/lib/WebSocket.js:442:14) javascript.0 2019-03-31 09:29:42.152 warn at WebSocket.ws.onmessage (/opt/iobroker/node_modules/engine.io-client/lib/transports/websocket.js:146:10) javascript.0 2019-03-31 09:29:42.152 warn at WS.Transport.onData (/opt/iobroker/node_modules/engine.io-client/lib/transport.js:137:8) javascript.0 2019-03-31 09:29:42.152 warn at WS.Transport.onPacket (/opt/iobroker/node_modules/engine.io-client/lib/transport.js:145:8) javascript.0 2019-03-31 09:29:42.152 warn at WS.Emitter.emit (/opt/iobroker/node_modules/engine.io-client/node_modules/component-emitter/index.js:133:20) javascript.0 2019-03-31 09:29:42.152 warn at WS.<anonymous> (/opt/iobroker/node_modules/engine.io-client/lib/socket.js:268:10) javascript.0 2019-03-31 09:29:42.152 warn at Socket.onPacket (/opt/iobroker/node_modules/engine.io-client/lib/socket.js:451:14) javascript.0 2019-03-31 09:29:42.152 warn at Socket.Emitter.emit (/opt/iobroker/node_modules/engine.io-client/node_modules/component-emitter/index.js:133:20) javascript.0 2019-03-31 09:29:42.152 warn at Socket.<anonymous> (/opt/iobroker/node_modules/component-bind/index.js:21:15) javascript.0 2019-03-31 09:29:42.152 warn at Manager.ondata (/opt/iobroker/node_modules/socket.io-client/lib/manager.js:322:16) javascript.0 2019-03-31 09:29:42.152 warn at Decoder.add (/opt/iobroker/node_modules/socket.io-parser/index.js:246:12) javascript.0 2019-03-31 09:29:42.152 warn at Decoder.Emitter.emit (/opt/iobroker/node_modules/component-emitter/index.js:134:20) javascript.0 2019-03-31 09:29:42.152 warn at Decoder.<anonymous> (/opt/iobroker/node_modules/component-bind/index.js:21:15) javascript.0 2019-03-31 09:29:42.152 warn at Manager.ondecoded (/opt/iobroker/node_modules/socket.io-client/lib/manager.js:332:8) javascript.0 2019-03-31 09:29:42.152 warn at Manager.Emitter.emit (/opt/iobroker/node_modules/socket.io-client/node_modules/component-emitter/index.js:133:20) javascript.0 2019-03-31 09:29:42.152 warn at Manager.<anonymous> (/opt/iobroker/node_modules/component-bind/index.js:21:15) javascript.0 2019-03-31 09:29:42.152 warn at Socket.onpacket (/opt/iobroker/node_modules/socket.io-client/lib/socket.js:228:12) javascript.0 2019-03-31 09:29:42.152 warn at Socket.onevent (/opt/iobroker/node_modules/socket.io-client/lib/socket.js:270:10) javascript.0 2019-03-31 09:29:42.152 warn at Socket.Emitter.emit (/opt/iobroker/node_modules/socket.io-client/node_modules/component-emitter/index.js:133:20) javascript.0 2019-03-31 09:29:42.152 warn at Socket.<anonymous> (/opt/iobroker/node_modules/iobroker.js-controller/lib/states/statesInMemClient.js:52:30) javascript.0 2019-03-31 09:29:42.152 warn at Object.change (/opt/iobroker/node_modules/iobroker.js-controller/lib/adapter.js:3705:37) javascript.0 2019-03-31 09:29:42.152 warn at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:364:25) javascript.0 2019-03-31 09:29:42.152 warn at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:963:38) javascript.0 2019-03-31 09:29:42.152 warn at Object.<anonymous> (script.js.common.003_Stromverbrauch.PV_Überschuss_vers_2_1:11:580) javascript.0 2019-03-31 09:29:42.152 warn getState "javascript.0.Datenpunkte.Pool.Pumpe AN / AUS" not found (3) javascript.0 2019-03-31 09:29:42.152 warn at TCP.onread (net.js:601:20) javascript.0 2019-03-31 09:29:42.152 warn at Socket.Readable.push (_stream_readable.js:208:10) javascript.0 2019-03-31 09:29:42.152 warn at readableAddChunk (_stream_readable.js:250:11) javascript.0 2019-03-31 09:29:42.152 warn at addChunk (_stream_readable.js:263:12) javascript.0 2019-03-31 09:29:42.152 warn at Socket.emit (events.js:211:7) javascript.0 2019-03-31 09:29:42.152 warn at emitOne (events.js:116:13) javascript.0 2019-03-31 09:29:42.152 warn at Socket.realHandler (/opt/iobroker/node_modules/ws/lib/WebSocket.js:825:20) javascript.0 2019-03-31 09:29:42.152 warn at Receiver.add (/opt/iobroker/node_modules/ws/lib/Receiver.js:103:24) javascript.0 2019-03-31 09:29:42.152 warn at Receiver.expectHandler (/opt/iobroker/node_modules/ws/lib/Receiver.js:499:31) javascript.0 2019-03-31 09:29:42.152 warn at Receiver.finish (/opt/iobroker/node_modules/ws/lib/Receiver.js:541:12) javascript.0 2019-03-31 09:29:42.152 warn at Receiver.flush (/opt/iobroker/node_modules/ws/lib/Receiver.js:347:3) javascript.0 2019-03-31 09:29:42.152 warn at /opt/iobroker/node_modules/ws/lib/Receiver.js:508:14 javascript.0 2019-03-31 09:29:42.152 warn at Receiver.applyExtensions (/opt/iobroker/node_modules/ws/lib/Receiver.js:371:5) javascript.0 2019-03-31 09:29:42.152 warn at /opt/iobroker/node_modules/ws/lib/Receiver.js:536:18 javascript.0 2019-03-31 09:29:42.152 warn at Receiver.ontext (/opt/iobroker/node_modules/ws/lib/WebSocket.js:841:10) javascript.0 2019-03-31 09:29:42.152 warn at WebSocket.emit (events.js:214:7) javascript.0 2019-03-31 09:29:42.152 warn at emitTwo (events.js:126:13) javascript.0 2019-03-31 09:29:42.152 warn at WebSocket.onMessage (/opt/iobroker/node_modules/ws/lib/WebSocket.js:442:14) javascript.0 2019-03-31 09:29:42.151 warn at WebSocket.ws.onmessage (/opt/iobroker/node_modules/engine.io-client/lib/transports/websocket.js:146:10) javascript.0 2019-03-31 09:29:42.151 warn at WS.Transport.onData (/opt/iobroker/node_modules/engine.io-client/lib/transport.js:137:8) javascript.0 2019-03-31 09:29:42.151 warn at WS.Transport.onPacket (/opt/iobroker/node_modules/engine.io-client/lib/transport.js:145:8) javascript.0 2019-03-31 09:29:42.151 warn at WS.Emitter.emit (/opt/iobroker/node_modules/engine.io-client/node_modules/component-emitter/index.js:133:20) javascript.0 2019-03-31 09:29:42.151 warn at WS.<anonymous> (/opt/iobroker/node_modules/engine.io-client/lib/socket.js:268:10) javascript.0 2019-03-31 09:29:42.151 warn at Socket.onPacket (/opt/iobroker/node_modules/engine.io-client/lib/socket.js:451:14) javascript.0 2019-03-31 09:29:42.151 warn at Socket.Emitter.emit (/opt/iobroker/node_modules/engine.io-client/node_modules/component-emitter/index.js:133:20) javascript.0 2019-03-31 09:29:42.151 warn at Socket.<anonymous> (/opt/iobroker/node_modules/component-bind/index.js:21:15) javascript.0 2019-03-31 09:29:42.151 warn at Manager.ondata (/opt/iobroker/node_modules/socket.io-client/lib/manager.js:322:16) javascript.0 2019-03-31 09:29:42.151 warn at Decoder.add (/opt/iobroker/node_modules/socket.io-parser/index.js:246:12) javascript.0 2019-03-31 09:29:42.151 warn at Decoder.Emitter.emit (/opt/iobroker/node_modules/component-emitter/index.js:134:20) javascript.0 2019-03-31 09:29:42.151 warn at Decoder.<anonymous> (/opt/iobroker/node_modules/component-bind/index.js:21:15) javascript.0 2019-03-31 09:29:42.151 warn at Manager.ondecoded (/opt/iobroker/node_modules/socket.io-client/lib/manager.js:332:8) javascript.0 2019-03-31 09:29:42.151 warn at Manager.Emitter.emit (/opt/iobroker/node_modules/socket.io-client/node_modules/component-emitter/index.js:133:20) javascript.0 2019-03-31 09:29:42.151 warn at Manager.<anonymous> (/opt/iobroker/node_modules/component-bind/index.js:21:15) javascript.0 2019-03-31 09:29:42.151 warn at Socket.onpacket (/opt/iobroker/node_modules/socket.io-client/lib/socket.js:228:12) javascript.0 2019-03-31 09:29:42.151 warn at Socket.onevent (/opt/iobroker/node_modules/socket.io-client/lib/socket.js:270:10) javascript.0 2019-03-31 09:29:42.151 warn at Socket.Emitter.emit (/opt/iobroker/node_modules/socket.io-client/node_modules/component-emitter/index.js:133:20) javascript.0 2019-03-31 09:29:42.151 warn at Socket.<anonymous> (/opt/iobroker/node_modules/iobroker.js-controller/lib/states/statesInMemClient.js:52:30) javascript.0 2019-03-31 09:29:42.151 warn at Object.change (/opt/iobroker/node_modules/iobroker.js-controller/lib/adapter.js:3705:37) javascript.0 2019-03-31 09:29:42.151 warn at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:364:25) javascript.0 2019-03-31 09:29:42.151 warn at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:963:38) javascript.0 2019-03-31 09:29:42.150 warn at Object.<anonymous> (script.js.common.003_Stromverbrauch.PV_Überschuss_vers_2_1:11:317) javascript.0 2019-03-31 09:29:42.150 warn getState "javascript.0.Datenpunkte.Pool.Pumpe AN / AUS" not found (3) javascript.0 2019-03-31 09:29:42.150 warn at TCP.onread (net.js:601:20) javascript.0 2019-03-31 09:29:42.150 warn at Socket.Readable.push (_stream_readable.js:208:10) javascript.0 2019-03-31 09:29:42.150 warn at readableAddChunk (_stream_readable.js:250:11) javascript.0 2019-03-31 09:29:42.150 warn at addChunk (_stream_readable.js:263:12) javascript.0 2019-03-31 09:29:42.150 warn at Socket.emit (events.js:211:7) javascript.0 2019-03-31 09:29:42.150 warn at emitOne (events.js:116:13) javascript.0 2019-03-31 09:29:42.150 warn at Socket.realHandler (/opt/iobroker/node_modules/ws/lib/WebSocket.js:825:20) javascript.0 2019-03-31 09:29:42.150 warn at Receiver.add (/opt/iobroker/node_modules/ws/lib/Receiver.js:103:24) javascript.0 2019-03-31 09:29:42.150 warn at Receiver.expectHandler (/opt/iobroker/node_modules/ws/lib/Receiver.js:499:31) javascript.0 2019-03-31 09:29:42.150 warn at Receiver.finish (/opt/iobroker/node_modules/ws/lib/Receiver.js:541:12) javascript.0 2019-03-31 09:29:42.150 warn at Receiver.flush (/opt/iobroker/node_modules/ws/lib/Receiver.js:347:3) javascript.0 2019-03-31 09:29:42.150 warn at /opt/iobroker/node_modules/ws/lib/Receiver.js:508:14 javascript.0 2019-03-31 09:29:42.150 warn at Receiver.applyExtensions (/opt/iobroker/node_modules/ws/lib/Receiver.js:371:5) javascript.0 2019-03-31 09:29:42.150 warn at /opt/iobroker/node_modules/ws/lib/Receiver.js:536:18 javascript.0 2019-03-31 09:29:42.150 warn at Receiver.ontext (/opt/iobroker/node_modules/ws/lib/WebSocket.js:841:10) javascript.0 2019-03-31 09:29:42.150 warn at WebSocket.emit (events.js:214:7) javascript.0 2019-03-31 09:29:42.150 warn at emitTwo (events.js:126:13) javascript.0 2019-03-31 09:29:42.150 warn at WebSocket.onMessage (/opt/iobroker/node_modules/ws/lib/WebSocket.js:442:14) javascript.0 2019-03-31 09:29:42.150 warn at WebSocket.ws.onmessage (/opt/iobroker/node_modules/engine.io-client/lib/transports/websocket.js:146:10) javascript.0 2019-03-31 09:29:42.150 warn at WS.Transport.onData (/opt/iobroker/node_modules/engine.io-client/lib/transport.js:137:8) javascript.0 2019-03-31 09:29:42.150 warn at WS.Transport.onPacket (/opt/iobroker/node_modules/engine.io-client/lib/transport.js:145:8) javascript.0 2019-03-31 09:29:42.150 warn at WS.Emitter.emit (/opt/iobroker/node_modules/engine.io-client/node_modules/component-emitter/index.js:133:20) javascript.0 2019-03-31 09:29:42.150 warn at WS.<anonymous> (/opt/iobroker/node_modules/engine.io-client/lib/socket.js:268:10) javascript.0 2019-03-31 09:29:42.150 warn at Socket.onPacket (/opt/iobroker/node_modules/engine.io-client/lib/socket.js:451:14) javascript.0 2019-03-31 09:29:42.150 warn at Socket.Emitter.emit (/opt/iobroker/node_modules/engine.io-client/node_modules/component-emitter/index.js:133:20) javascript.0 2019-03-31 09:29:42.150 warn at Socket.<anonymous> (/opt/iobroker/node_modules/component-bind/index.js:21:15) javascript.0 2019-03-31 09:29:42.150 warn at Manager.ondata (/opt/iobroker/node_modules/socket.io-client/lib/manager.js:322:16) javascript.0 2019-03-31 09:29:42.150 warn at Decoder.add (/opt/iobroker/node_modules/socket.io-parser/index.js:246:12) javascript.0 2019-03-31 09:29:42.150 warn at Decoder.Emitter.emit (/opt/iobroker/node_modules/component-emitter/index.js:134:20) javascript.0 2019-03-31 09:29:42.150 warn at Decoder.<anonymous> (/opt/iobroker/node_modules/component-bind/index.js:21:15) javascript.0 2019-03-31 09:29:42.150 warn at Manager.ondecoded (/opt/iobroker/node_modules/socket.io-client/lib/manager.js:332:8) javascript.0 2019-03-31 09:29:42.150 warn at Manager.Emitter.emit (/opt/iobroker/node_modules/socket.io-client/node_modules/component-emitter/index.js:133:20) javascript.0 2019-03-31 09:29:42.150 warn at Manager.<anonymous> (/opt/iobroker/node_modules/component-bind/index.js:21:15) javascript.0 2019-03-31 09:29:42.150 warn at Socket.onpacket (/opt/iobroker/node_modules/socket.io-client/lib/socket.js:228:12) javascript.0 2019-03-31 09:29:42.150 warn at Socket.onevent (/opt/iobroker/node_modules/socket.io-client/lib/socket.js:270:10) javascript.0 2019-03-31 09:29:42.150 warn at Socket.Emitter.emit (/opt/iobroker/node_modules/socket.io-client/node_modules/component-emitter/index.js:133:20) javascript.0 2019-03-31 09:29:42.150 warn at Socket.<anonymous> (/opt/iobroker/node_modules/iobroker.js-controller/lib/states/statesInMemClient.js:52:30) javascript.0 2019-03-31 09:29:42.150 warn at Object.change (/opt/iobroker/node_modules/iobroker.js-controller/lib/adapter.js:3705:37) javascript.0 2019-03-31 09:29:42.150 warn at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:364:25) javascript.0 2019-03-31 09:29:42.150 warn at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:963:38) javascript.0 2019-03-31 09:29:42.150 warn at Object.<anonymous> (script.js.common.003_Stromverbrauch.PV_Überschuss_vers_2_1:11:52) javascript.0 2019-03-31 09:29:42.150 warn getState "javascript.0.Datenpunkte.Pool.Pumpe AN / AUS" not found (3)
Was heist das?
-
@SmarthomeMF sagte in Skripten des E-Control Spritpreisrechners:
Im Parser String habe ich 10 Tankstellen drin stehen.
Morgääähn!
Warum machst du dann 14 Felder, im Script und als Datenpunkte?
Vergleiche mal die Scriptzeilenlogik 23-27 mit deinen neuen Zeilen 28-36!
Sowie gestern Abend, Script dazu veranlaßt dass es neu ausliest?@SmarthomeMF sagte in Skripten des E-Control Spritpreisrechners:
Was heist das?
Keine Ahnung, aber da steht in der ältersten Zeile etwas von einer Pool.Pumpe.
LG, mxa
P.S.: Haben alle Tankstellen offen? Ich weiß nicht was passiert wenn die Tankstellen geschlossen haben und du in deiner URL die geschlossenen Stellen nicht angezeigt haben willst. Aber irgendwelche 10 Stk. werden wohl schon offen haben.
-
Sodala, hier nun mit jeweiliger Adresse, vielleicht kanns jemand brauchen:
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // START SETUP: // finaler Inhalt der Datenpunkte: // 1 = name_preis | 2 = name_preis_plz_ort_strasse | 3 = (id_Preis_xx) name_preis & (id_Adresse_xx) PLZ_Ort_Strasse var InhaltDP = 2; // Datenpunktadressen vollständig eintragen (z.B."javascript.0.Aktueller_Spritpreis_01"), müssen manuell erstellt werden var id_Preis_01 = ""; var id_Preis_02 = ""; var id_Preis_03 = ""; var id_Preis_04 = ""; var id_Preis_05 = ""; // Achtung, wurde oben bei "InhaltDP" 3 ausgewählt (Daten in 2 Felder gesplittet), dann müssen folgende Felder befüllt werden! // Datenpunktadressen vollständig eintragen (z.B."javascript.0.Aktueller_Spritpreis_Adresse_01"), müssen manuell erstellt werden var id_Adresse_01 = ""; var id_Adresse_02 = ""; var id_Adresse_03 = ""; var id_Adresse_04 = ""; var id_Adresse_05 = ""; // Ende Setup ////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////// // Eigentliches Script, ab hier nichts mehr ändern on({id: "parser.0.Spritpreisrechner"/*Spritpreisrechner*/, change: 'any'}, function(obj) { // Variablen werden mit "" als objekt(string) deklariert, ohne "" als number: var pricehit_01 = "undefiniert"; var pricehit_address_01 = "undefiniert"; var pricehit_02 = "undefiniert"; var pricehit_address_02 = "undefiniert"; var pricehit_03 = "undefiniert"; var pricehit_address_03 = "undefiniert"; var pricehit_04 = "undefiniert"; var pricehit_address_04 = "undefiniert"; var pricehit_05 = "undefiniert"; var pricehit_address_05 = "undefiniert"; var index = 0; var gasStation = JSON.parse(obj.state.val); if (gasStation.length === 0) return; for (index = 0; index < gasStation.length; ++index) { // Variablen werden befüllt: pricehit_01 = gasStation[0].name + " € " + (gasStation[0].prices[0].amount).toString().replace(".",","); pricehit_address_01 = (gasStation[0].location.postalCode) + " " + (gasStation[0].location.city) + ", " + (gasStation[0].location.address); pricehit_02 = gasStation[1].name + " € " + (gasStation[1].prices[0].amount).toString().replace(".",","); pricehit_address_02 = (gasStation[1].location.postalCode) + " " + (gasStation[1].location.city) + ", " + (gasStation[1].location.address); pricehit_03 = gasStation[2].name + " € " + (gasStation[2].prices[0].amount).toString().replace(".",","); pricehit_address_03 = (gasStation[2].location.postalCode) + " " + (gasStation[2].location.city) + ", " + (gasStation[2].location.address); pricehit_04 = gasStation[3].name + " € " + (gasStation[3].prices[0].amount).toString().replace(".",","); pricehit_address_04 = (gasStation[3].location.postalCode) + " " + (gasStation[3].location.city) + ", " + (gasStation[3].location.address); pricehit_05 = gasStation[4].name + " € " + (gasStation[4].prices[0].amount).toString().replace(".",","); pricehit_address_05 = (gasStation[4].location.postalCode) + " " + (gasStation[4].location.city) + ", " + (gasStation[4].location.address); } if (InhaltDP == 1) { //Name und Preis setState(id_Preis_01, pricehit_01); setState(id_Preis_02, pricehit_02); setState(id_Preis_03, pricehit_03); setState(id_Preis_04, pricehit_04); setState(id_Preis_05, pricehit_05); } if (InhaltDP == 2) { //Name, Preis und Adresse setState(id_Preis_01, pricehit_01 + " - " + pricehit_address_01); setState(id_Preis_02, pricehit_02 + " - " + pricehit_address_02); setState(id_Preis_03, pricehit_03 + " - " + pricehit_address_03); setState(id_Preis_04, pricehit_04 + " - " + pricehit_address_04); setState(id_Preis_05, pricehit_05 + " - " + pricehit_address_05); } if (InhaltDP == 3) { //1.Feld: Name, Preis 2.Feld: Adresse setState(id_Preis_01, pricehit_01); setState(id_Preis_02, pricehit_02); setState(id_Preis_03, pricehit_03); setState(id_Preis_04, pricehit_04); setState(id_Preis_05, pricehit_05); setState(id_Adresse_01, pricehit_address_01); setState(id_Adresse_02, pricehit_address_02); setState(id_Adresse_03, pricehit_address_03); setState(id_Adresse_04, pricehit_address_04); setState(id_Adresse_05, pricehit_address_05); } log('Ende Spritvergleich'); });
Schönen Restsonntag noch!
LG, mxaEdit_01: Optische Korrekturen durchgeführt
-
Ich bin einfach zu blöd für Java!!
Bekomme das nicht zum laufen.
Das erste Skript hat ein mal die Daten abgefragt und das wars dann.
Es läuft nicht mehr!!
Nun habe ich das neue ausprobiert!!
Es werden keine Daten übertragen.
Mein Skript//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // START SETUP: // finaler Inhalt der Datenpunkte: // 1 = name_preis | 2 = name_preis_plz_ort_strasse | 3 = (id_Preis_xx) name_preis & (id_Adresse_xx) PLZ_Ort_Strasse var InhaltDP = 3; // Datenpunktadressen vollständig eintragen (z.B."javascript.0.Aktueller_Spritpreis_01"), müssen manuell erstellt werden var id_Preis_01 = 'javascript.0.Treibstoffpreise.Benzin.Tankstelle1'/*Tankstelle1*/; var id_Preis_02 = 'javascript.0.Treibstoffpreise.Benzin.Tankstelle2'/*Tankstelle2*/; var id_Preis_03 = 'javascript.0.Treibstoffpreise.Benzin.Tankstelle3'/*Tankstelle3*/; var id_Preis_04 = 'javascript.0.Treibstoffpreise.Benzin.Tankstelle4'/*Tankstelle4*/; var id_Preis_05 = "'javascript.0.Treibstoffpreise.Benzin.Tankstelle5'/*Tankstelle5*/"; // Achtung, wurde oben bei "InhaltDP" 3 ausgewählt (Daten in 2 Felder gesplittet), dann müssen folgende Felder befüllt werden! // Datenpunktadressen vollständig eintragen (z.B."javascript.0.Aktueller_Spritpreis_Adresse_01"), müssen manuell erstellt werden var id_Adresse_01 = 'javascript.0.Treibstoffpreise.Benzin.Tankstelle_1_Adresse_1'/*Tankstelle 1 Adresse 1*/; var id_Adresse_02 = 'javascript.0.Treibstoffpreise.Benzin.Tankstelle_2_Adresse_2'/*Tankstelle 2 Adresse 2*/; var id_Adresse_03 = 'javascript.0.Treibstoffpreise.Benzin.Tankstelle_3_Adresse_3'/*Tankstelle 3 Adresse 3*/; var id_Adresse_04 = 'javascript.0.Treibstoffpreise.Benzin.Tankstelle_4_Adresse_4'/*Tankstelle 4 Adresse 4*/; var id_Adresse_05 = "'javascript.0.Treibstoffpreise.Benzin.Tankstelle_5_Adresse_5'/*Tankstelle 5 Adresse 5*/"; // Ende Setup ////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////// // Eigentliches Script, ab hier nichts mehr ändern on({id: 'parser.0.Sprit'/*Sprit*/, change: 'any'}, function(obj) { // Variablen werden mit "" als objekt(string) deklariert, ohne "" als number: var pricehit_01 = "undefiniert"; var pricehit_address_01 = "undefiniert"; var pricehit_02 = "undefiniert"; var pricehit_address_02 = "undefiniert"; var pricehit_03 = "undefiniert"; var pricehit_address_03 = "undefiniert"; var pricehit_04 = "undefiniert"; var pricehit_address_04 = "undefiniert"; var pricehit_05 = "undefiniert"; var pricehit_address_05 = "undefiniert"; var index = 0; var gasStation = JSON.parse(obj.state.val); if (gasStation.length === 0) return; for (index = 0; index < gasStation.length; ++index) { // Variablen werden befüllt: pricehit_01 = gasStation[0].name + " € " + (gasStation[0].prices[0].amount).toString().replace(".",","); pricehit_address_01 = (gasStation[0].location.postalCode) + " " + (gasStation[0].location.city) + ", " + (gasStation[0].location.address); pricehit_02 = gasStation[1].name + " € " + (gasStation[1].prices[0].amount).toString().replace(".",","); pricehit_address_02 = (gasStation[1].location.postalCode) + " " + (gasStation[1].location.city) + ", " + (gasStation[1].location.address); pricehit_03 = gasStation[2].name + " € " + (gasStation[2].prices[0].amount).toString().replace(".",","); pricehit_address_03 = (gasStation[2].location.postalCode) + " " + (gasStation[2].location.city) + ", " + (gasStation[2].location.address); pricehit_04 = gasStation[3].name + " € " + (gasStation[3].prices[0].amount).toString().replace(".",","); pricehit_address_04 = (gasStation[3].location.postalCode) + " " + (gasStation[3].location.city) + ", " + (gasStation[3].location.address); pricehit_05 = gasStation[4].name + " € " + (gasStation[4].prices[0].amount).toString().replace(".",","); pricehit_address_05 = (gasStation[4].location.postalCode) + " " + (gasStation[4].location.city) + ", " + (gasStation[4].location.address); } if (InhaltDP == 1) { //Name und Preis setState(id_Preis_01, pricehit_01); setState(id_Preis_02, pricehit_02); setState(id_Preis_03, pricehit_03); setState(id_Preis_04, pricehit_04); setState(id_Preis_05, pricehit_05); } if (InhaltDP == 2) { //Name, Preis und Adresse setState(id_Preis_01, pricehit_01 + " - " + pricehit_address_01); setState(id_Preis_02, pricehit_02 + " - " + pricehit_address_02); setState(id_Preis_03, pricehit_03 + " - " + pricehit_address_03); setState(id_Preis_04, pricehit_04 + " - " + pricehit_address_04); setState(id_Preis_05, pricehit_05 + " - " + pricehit_address_05); } if (InhaltDP == 3) { //1.Feld: Name, Preis 2.Feld: Adresse setState(id_Preis_01, pricehit_01); setState(id_Preis_02, pricehit_02); setState(id_Preis_03, pricehit_03); setState(id_Preis_04, pricehit_04); setState(id_Preis_05, pricehit_05); setState(id_Adresse_01, pricehit_address_01); setState(id_Adresse_02, pricehit_address_02); setState(id_Adresse_03, pricehit_address_03); setState(id_Adresse_04, pricehit_address_04); setState(id_Adresse_05, pricehit_address_05); } log('Ende Spritvergleich'); });
Die Datenpunkte sind da! aber bleiben leer
```
wo habe ich da einen murks gemacht. -
@SmarthomeMF sagte in Skripten des E-Control Spritpreisrechners:
wo habe ich da einen murks gemacht.
hast du im Parser wieder auf JSON retour gestellt?
Im Script hast du jeweils 5 Datenpunkte, aber angelegt hast du jeweils 9 Datenpunkte.
-
@Negalein sagte in Skripten des E-Control Spritpreisrechners:
hast du im Parser wieder auf JSON retour gestellt?
ja
@Negalein sagte in Skripten des E-Control Spritpreisrechners:
Im Script hast du jeweils 5 Datenpunkte, aber angelegt hast du jeweils 9 Datenpunkte.
ja ich möchte 9 Tankstellen angezeigt bekommen.
aber ich bin schon den halben tag am Probieren......Ich hatte das Skript schon fertig für 9 Tankstellen.
nun habe ich das Skript gelöscht und noch mal mit von vorne begonnen.
Dafür habe ich im Skript nur 4 Werte eingetragen.......
Aber während dem ganzen probieren haben sich die 4 Werte nun doch eingetragen.....
also dachte ich perfekt dann kann ich weiter machen und habe noch zwei Datenpunkte im Skript ergänzt.
Wie schon vorhin werden die Daten nun wieder nicht mehr aktualisiert!!
Was mach ich FALSCH?
nochmal mein Skript//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // START SETUP: // finaler Inhalt der Datenpunkte: // 1 = name_preis | 2 = name_preis_plz_ort_strasse | 3 = (id_Preis_xx) name_preis & (id_Adresse_xx) PLZ_Ort_Strasse var InhaltDP = 3; // Datenpunktadressen vollständig eintragen (z.B."javascript.0.Aktueller_Spritpreis_01"), müssen manuell erstellt werden var id_Preis_01 = 'javascript.0.Treibstoffpreise.Benzin.Tankstelle1'/*Tankstelle1*/; var id_Preis_02 = 'javascript.0.Treibstoffpreise.Benzin.Tankstelle2'/*Tankstelle2*/; var id_Preis_03 = 'javascript.0.Treibstoffpreise.Benzin.Tankstelle3'/*Tankstelle3*/; var id_Preis_04 = 'javascript.0.Treibstoffpreise.Benzin.Tankstelle4'/*Tankstelle4*/; var id_Preis_05 = 'javascript.0.Treibstoffpreise.Benzin.Tankstelle5'/*Tankstelle5*/; var id_Preis_06 = 'javascript.0.Treibstoffpreise.Benzin.Tankstelle6'/*Tankstelle6*/; // Achtung, wurde oben bei "InhaltDP" 3 ausgewählt (Daten in 2 Felder gesplittet), dann müssen folgende Felder befüllt werden! // Datenpunktadressen vollständig eintragen (z.B."javascript.0.Aktueller_Spritpreis_Adresse_01"), müssen manuell erstellt werden var id_Adresse_01 = 'javascript.0.Treibstoffpreise.Benzin.Tankstelle_1_Adresse_1'/*Tankstelle 1 Adresse 1*/; var id_Adresse_02 = 'javascript.0.Treibstoffpreise.Benzin.Tankstelle_2_Adresse_2'/*Tankstelle 2 Adresse 2*/; var id_Adresse_03 = 'javascript.0.Treibstoffpreise.Benzin.Tankstelle_3_Adresse_3'/*Tankstelle 3 Adresse 3*/; var id_Adresse_04 = 'javascript.0.Treibstoffpreise.Benzin.Tankstelle_4_Adresse_4'/*Tankstelle 4 Adresse 4*/; var id_Adresse_05 = 'javascript.0.Treibstoffpreise.Benzin.Tankstelle_5_Adresse_5'/*Tankstelle 5 Adresse 5*/; var id_Adresse_06 = 'javascript.0.Treibstoffpreise.Benzin.Tankstelle_6_Adresse_6'/*Tankstelle 6 Adresse 6*/; // Ende Setup ////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////// // Eigentliches Script, ab hier nichts mehr ändern on({id: 'parser.0.Sprit'/*Sprit*/, change: 'any'}, function(obj) { // Variablen werden mit "" als objekt(string) deklariert, ohne "" als number: var pricehit_01 = "undefiniert"; var pricehit_address_01 = "undefiniert"; var pricehit_02 = "undefiniert"; var pricehit_address_02 = "undefiniert"; var pricehit_03 = "undefiniert"; var pricehit_address_03 = "undefiniert"; var pricehit_04 = "undefiniert"; var pricehit_address_04 = "undefiniert"; var pricehit_05 = "undefiniert"; var pricehit_address_05 = "undefiniert"; var pricehit_06 = "undefiniert"; var pricehit_address_06 = "undefiniert"; var index = 0; var gasStation = JSON.parse(obj.state.val); if (gasStation.length === 0) return; for (index = 0; index < gasStation.length; ++index) { // Variablen werden befüllt: pricehit_01 = gasStation[0].name + " € " + (gasStation[0].prices[0].amount).toString().replace(".",","); pricehit_address_01 = (gasStation[0].location.postalCode) + " " + (gasStation[0].location.city) + ", " + (gasStation[0].location.address); pricehit_02 = gasStation[1].name + " € " + (gasStation[1].prices[0].amount).toString().replace(".",","); pricehit_address_02 = (gasStation[1].location.postalCode) + " " + (gasStation[1].location.city) + ", " + (gasStation[1].location.address); pricehit_03 = gasStation[2].name + " € " + (gasStation[2].prices[0].amount).toString().replace(".",","); pricehit_address_03 = (gasStation[2].location.postalCode) + " " + (gasStation[2].location.city) + ", " + (gasStation[2].location.address); pricehit_04 = gasStation[3].name + " € " + (gasStation[3].prices[0].amount).toString().replace(".",","); pricehit_address_04 = (gasStation[3].location.postalCode) + " " + (gasStation[3].location.city) + ", " + (gasStation[3].location.address); pricehit_05 = gasStation[4].name + " € " + (gasStation[4].prices[0].amount).toString().replace(".",","); pricehit_address_05 = (gasStation[4].location.postalCode) + " " + (gasStation[4].location.city) + ", " + (gasStation[4].location.address); pricehit_06 = gasStation[5].name + " € " + (gasStation[5].prices[0].amount).toString().replace(".",","); pricehit_address_06 = (gasStation[5].location.postalCode) + " " + (gasStation[5].location.city) + ", " + (gasStation[5].location.address); } if (InhaltDP == 1) { //Name und Preis setState(id_Preis_01, pricehit_01); setState(id_Preis_02, pricehit_02); setState(id_Preis_03, pricehit_03); setState(id_Preis_04, pricehit_04); setState(id_Preis_05, pricehit_05); setState(id_Preis_06, pricehit_06); } if (InhaltDP == 2) { //Name, Preis und Adresse setState(id_Preis_01, pricehit_01 + " - " + pricehit_address_01); setState(id_Preis_02, pricehit_02 + " - " + pricehit_address_02); setState(id_Preis_03, pricehit_03 + " - " + pricehit_address_03); setState(id_Preis_04, pricehit_04 + " - " + pricehit_address_04); setState(id_Preis_05, pricehit_05 + " - " + pricehit_address_05); setState(id_Preis_06, pricehit_06 + " - " + pricehit_address_06); } if (InhaltDP == 3) { //1.Feld: Name, Preis 2.Feld: Adresse setState(id_Preis_01, pricehit_01); setState(id_Preis_02, pricehit_02); setState(id_Preis_03, pricehit_03); setState(id_Preis_04, pricehit_04); setState(id_Preis_05, pricehit_05); setState(id_Preis_06, pricehit_06); setState(id_Adresse_01, pricehit_address_01); setState(id_Adresse_02, pricehit_address_02); setState(id_Adresse_03, pricehit_address_03); setState(id_Adresse_04, pricehit_address_04); setState(id_Adresse_05, pricehit_address_05); setState(id_Adresse_06, pricehit_address_06); } log('Ende Spritvergleich'); });
und im Log auch alles OK
javascript.0 2019-04-01 18:49:58.542 info script.js.common.Treibstoffpreise_1: registered 1 subscription and 0 schedules javascript.0 2019-04-01 18:49:58.537 info Start javascript script.js.common.Treibstoffpreise_1 javascript.0 2019-04-01 18:49:54.686 info Stop script script.js.common.Treibstoffpreise_1 javascript.0 2019-04-01 18:49:39.926 info Stop script script.js.common.Treibstoffpreise_1
-
@SmarthomeMF Zeig mal die Einstellungen im Parseradapter
-
@SmarthomeMF sagte in Skripten des E-Control Spritpreisrechners:
Was mach ich FALSCH?
hat es beim 1. Versuch mit 9 Tankstellen funktioniert?
Eventuell liegt es an der API?
Auf spritpreisrechner.at werden auch nur die ersten 5 mit Preisen angezeigt.PS:
Eventuell liegt es an den Anführungszeichen.Bei mir sieht es so aus
var id_Preis_01 = "javascript.0.Sprit.Aktueller_Spritpreis_01";
bei dir so
var id_Preis_01 = 'javascript.0.Treibstoffpreise.Benzin.Tankstelle1'
Ich hab " und du hast '
-
@Negalein sagte in Skripten des E-Control Spritpreisrechners:
hat es beim 1. Versuch mit 9 Tankstellen funktioniert?
nur beim ersten versuch mit 4...
dann haben sich die Werte nicht Aktualisiert! habe ich erst Später gemerkt
Danach habe ich auf 9 Tankstellen erweitert.....
ging nicht.die "" Zeichen habe ich auch schon geändert aber bringt nix....
werde aber noch mal probieren@Georgius sagte in Skripten des E-Control Spritpreisrechners:
Zeig mal die Einstellungen im Parseradapter
-
@SmarthomeMF
Ihr lieben,
ich habe diesen Thread nur eben quergelesen.
Wenn ich alles richtig verstanden habe sollte da doch vereinfachungspotential drin sein.Stimmt folgendes:
- Ihr holt euch bei der API einen URL
- wenn man diesen URL aufruft bekommt man "etwas" zurück
- dieses Etwas ist Info von 10 Tankstellen
und ihr wollt die Daten dazu in Datenpunkten haben?
Was genau ?Wenn das alles so stimmt:
kann mit jemand mal einen solchen URL geben -
@Homoran sagte in Skripten des E-Control Spritpreisrechners:
kann mit jemand mal einen solchen URL geben
Ich schicks dir beim Chat
PS: bei mir funktioniert es mit Parser und Javascript.
Ich bekomme mit obigen Script 5 Tankstellen inkl. Adressen und Preisen. -
@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?