Skip to content
  • Home
  • Aktuell
  • Tags
  • 0 Ungelesen 0
  • Kategorien
  • Unreplied
  • Beliebt
  • 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

  • Standard: (Kein Skin)
  • Kein Skin
Einklappen
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. JavaScript
  5. JSON Tabelle FuelPriceMonitor [Austria]

NEWS

  • UPDATE 31.10.: Amazon Alexa - ioBroker Skill läuft aus ?
    apollon77A
    apollon77
    48
    3
    8.7k

  • Monatsrückblick – September 2025
    BluefoxB
    Bluefox
    13
    1
    2.2k

  • Neues Video "KI im Smart Home" - ioBroker plus n8n
    BluefoxB
    Bluefox
    16
    1
    3.0k

JSON Tabelle FuelPriceMonitor [Austria]

Geplant Angeheftet Gesperrt Verschoben JavaScript
77 Beiträge 6 Kommentatoren 7.2k Aufrufe 7 Watching
  • Älteste zuerst
  • Neuste zuerst
  • Meiste Stimmen
Antworten
  • In einem neuen Thema antworten
Anmelden zum Antworten
Dieses Thema wurde gelöscht. Nur Nutzer mit entsprechenden Rechten können es sehen.
  • liv-in-skyL liv-in-sky

    @sigi234

    bedeutet ? geht jetzt ?

    ich muss aber noch eine andere änderung am script machen - da wurde wieder mal was nicht gespeichert, nach einer änderung - ich gebe bescheid, wenn das script oben upgedatet wurde

    sigi234S Online
    sigi234S Online
    sigi234
    Forum Testing Most Active
    schrieb am zuletzt editiert von sigi234
    #13

    @liv-in-sky sagte in JSON Tabelle FuelPriceMonitor [Austria]:

    bedeutet ? geht jetzt ?

    Ja

    Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat.
    Immer Daten sichern!

    1 Antwort Letzte Antwort
    0
    • liv-in-skyL liv-in-sky

      hier ein script um den Fuelpricemonitor adapter in die vis zu bekommen (und telegram)

      @mrfloppy
      @Chaot
      @Negalein

      • show cheapest overall stations muss in instanz aktiviert sein
      • ich nutze das inventwo widget und das map widget - muss dann auch installiert sein (inventwo funktioniert nicht mit vis app)
      • pro sprit typ entsteht eine tabelle - dp unter:0_userdata.0.FUELPRICEMONITOR
      • es gibt einen dp mit den telegram-text und im setting kann aktiviert werden dass es autom. eine nachricht an teleg. sendet (nachricht wird upgedatet und nicht neu geschrieben)
      • im oberen bereich des scriptes das setting beachten und einstellen
      • Die Bilder müssen unter /vis.0/Tankstellen mit dem vis dateimanager hochgeladen werden

      sieht dann so aus (beispiel: super und diesel):

      Image 186.png

      Image 180.png

      Image 182.png

      bilder.7z

      [{"tpl":"tplOsm","data":{"g_fixed":false,"g_visibility":false,"g_css_font_text":false,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","mCount":"6","maxZoom":"0","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"hideControls":true,"markersSwap1":true,"markersLon-oid1":"javascript.0.FUELPRICEMONITOR.Targets.SUP0er","markersLat-oid1":"","markersWidth1":"13","markersHeight1":"13","markersOffsetX1":"","markersOffsetY1":"","markersImage1":"/vis.0/armin/img/zahl/1-green.png","markersLon-oid2":"javascript.0.FUELPRICEMONITOR.Targets.SUP1er","markersSwap2":true,"markersLon-oid3":"javascript.0.FUELPRICEMONITOR.Targets.SUP2er","markersSwap3":true,"markersLon-oid4":"javascript.0.FUELPRICEMONITOR.Targets.SUP3er","markersSwap4":true,"markersImage4":"/vis.0/armin/img/zahl/4-green.png","markersImage3":"/vis.0/armin/img/zahl/3-green.png","markersImage2":"/vis.0/armin/img/zahl/2-green.png","markersLon-oid6":"javascript.0.FUELPRICEMONITOR.Targets.home","markersSwap6":true,"markersImage6":"/vis.0/armin/img/haus2.png","g_markers_§4":true,"markersWidth2":"13","markersHeight2":"13","markersWidth3":"13","markersHeight3":"13","markersWidth4":"13","markersHeight4":"13","markersWidth6":"17","markersHeight6":"17","markersLon-oid5":"javascript.0.FUELPRICEMONITOR.Targets.SUP4er","markersSwap5":true,"markersImage5":"/vis.0/armin/img/zahl/5-green.png","markersWidth5":"13","markersHeight5":"13"},"style":{"left":"699px","top":"54px","width":"341px","height":"220px","z-index":"600"},"widgetSet":"map"},{"tpl":"tplOsm","data":{"g_fixed":false,"g_visibility":false,"g_css_font_text":false,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","mCount":"6","maxZoom":"0","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"hideControls":true,"markersSwap1":true,"markersLon-oid1":"javascript.0.FUELPRICEMONITOR.Targets.DIE0er","markersLat-oid1":"","markersWidth1":"13","markersHeight1":"13","markersOffsetX1":"","markersOffsetY1":"","markersImage1":"/vis.0/armin/img/zahl/1-green.png","markersLon-oid2":"javascript.0.FUELPRICEMONITOR.Targets.DIE1er","markersSwap2":true,"markersLon-oid3":"javascript.0.FUELPRICEMONITOR.Targets.DIE2er","markersSwap3":true,"markersLon-oid4":"javascript.0.FUELPRICEMONITOR.Targets.DIE3er","markersSwap4":true,"markersImage4":"/vis.0/armin/img/zahl/4-green.png","markersImage3":"/vis.0/armin/img/zahl/3-green.png","markersImage2":"/vis.0/armin/img/zahl/2-green.png","markersLon-oid6":"javascript.0.FUELPRICEMONITOR.Targets.home","markersSwap6":true,"markersImage6":"/vis.0/armin/img/haus2.png","g_markers_§4":true,"markersWidth2":"13","markersHeight2":"13","markersWidth3":"13","markersHeight3":"13","markersWidth4":"13","markersHeight4":"13","markersWidth6":"17","markersHeight6":"17","markersLon-oid5":"javascript.0.FUELPRICEMONITOR.Targets.DIE4er","markersSwap5":true,"markersImage5":"/vis.0/armin/img/zahl/5-green.png","markersWidth5":"13","markersHeight5":"13"},"style":{"left":"698px","top":"310px","width":"341px","height":"220px"},"widgetSet":"map"},{"tpl":"i-vis-jsontable","data":{"g_fixed":true,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","iTblRowLimit":"20","iTableRefreshRate":"0","iTblSortOrder":"asc","iColCount":"8","iColShow1":false,"iTblHeadTextAlign1":"center","iTblTextAlign1":"center","iTblCellFormat1":"normal","iTblCellImageSize1":"200","iTblCellBooleanCheckbox1":"false","iTblCellBooleanColorFalse1":"#ff0000","iTblCellBooleanColorTrue1":"#00ff00","iTblCellNumberDecimals1":"2","iTblCellNumberDecimalSeperator1":".","iTblCellNumberThousandSeperator1":",","iTblCellThresholdsDp1":"","iTblCellThresholdsText1":"","iOpacityAll":"1","iTblRowEvenColor":"#060d14","iTblRowUnevenColor":"#1d1f20","iTblHeaderColor":"#fff","iRowSpacing":"3.4","iTblRowEvenTextColor":"#ffffff","iTblRowUnevenTextColor":"#ffffff","iTblHeaderTextColor":"#000","iBorderSize":"0","iBorderStyleLeft":"none","iBorderStyleRight":"none","iBorderStyleUp":"none","iBorderStyleDown":"none","iBorderColor":"#ffffff","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"oid":"0_userdata.0.FUELPRICEMONITOR.DIEJsonAnzeige","iTblShowHead":true,"iColShow2":"true","iTblHeadTextAlign2":"left","iTblTextAlign2":"left","iTblCellFormat2":"image","iTblCellImageSize2":"30","iTblCellBooleanCheckbox2":"false","iTblCellBooleanColorFalse2":"#ff0000","iTblCellBooleanColorTrue2":"#00ff00","iTblCellNumberDecimals2":"2","iTblCellNumberDecimalSeperator2":".","iTblCellNumberThousandSeperator2":",","iTblCellThresholdsDp2":"","iTblCellThresholdsText2":"","iColShow3":"true","iTblHeadTextAlign3":"left","iTblTextAlign3":"left","iTblCellFormat3":"normal","iTblCellImageSize3":"200","iTblCellBooleanCheckbox3":false,"iTblCellBooleanColorFalse3":"#ff0000","iTblCellBooleanColorTrue3":"#00ff00","iTblCellNumberDecimals3":"2","iTblCellNumberDecimalSeperator3":".","iTblCellNumberThousandSeperator3":",","iTblCellThresholdsDp3":"","iTblCellThresholdsText3":"","iColShow4":"true","iTblHeadTextAlign4":"left","iTblTextAlign4":"left","iTblCellFormat4":"normal","iTblCellImageSize4":"200","iTblCellBooleanCheckbox4":"false","iTblCellBooleanColorFalse4":"#ff0000","iTblCellBooleanColorTrue4":"#00ff00","iTblCellNumberDecimals4":"2","iTblCellNumberDecimalSeperator4":".","iTblCellNumberThousandSeperator4":",","iTblCellThresholdsDp4":"","iTblCellThresholdsText4":"","iColShow5":true,"iTblHeadTextAlign5":"center","iTblTextAlign5":"center","iTblCellFormat5":"normal","iTblCellImageSize5":"200","iTblCellBooleanCheckbox5":"false","iTblCellBooleanColorFalse5":"#ff0000","iTblCellBooleanColorTrue5":"#00ff00","iTblCellNumberDecimals5":"2","iTblCellNumberDecimalSeperator5":".","iTblCellNumberThousandSeperator5":",","iTblCellThresholdsDp5":"","iTblCellThresholdsText5":"","iColShow6":false,"iTblHeadTextAlign6":"center","iTblTextAlign6":"center","iTblCellFormat6":"normal","iTblCellImageSize6":"200","iTblCellBooleanCheckbox6":"false","iTblCellBooleanColorFalse6":"#ff0000","iTblCellBooleanColorTrue6":"#00ff00","iTblCellNumberDecimals6":"2","iTblCellNumberDecimalSeperator6":".","iTblCellNumberThousandSeperator6":",","iTblCellThresholdsDp6":"","iTblCellThresholdsText6":"","iColShow7":false,"iTblHeadTextAlign7":"center","iTblTextAlign7":"center","iTblCellFormat7":"normal","iTblCellImageSize7":"200","iTblCellBooleanCheckbox7":"false","iTblCellBooleanColorFalse7":"#ff0000","iTblCellBooleanColorTrue7":"#00ff00","iTblCellNumberDecimals7":"2","iTblCellNumberDecimalSeperator7":".","iTblCellNumberThousandSeperator7":",","iTblCellThresholdsDp7":"","iTblCellThresholdsText7":"","iColShow8":"true","iTblHeadTextAlign8":"center","iTblTextAlign8":"center","iTblCellFormat8":"normal","iTblCellImageSize8":"200","iTblCellBooleanCheckbox8":"false","iTblCellBooleanColorFalse8":"#ff0000","iTblCellBooleanColorTrue8":"#00ff00","iTblCellNumberDecimals8":"2","iTblCellNumberDecimalSeperator8":".","iTblCellNumberThousandSeperator8":",","iTblCellThresholdsDp8":"","iTblCellThresholdsText8":"","iColShow9":"true","iTblHeadTextAlign9":"center","iTblTextAlign9":"center","iTblCellFormat9":"normal","iTblCellImageSize9":"200","iTblCellBooleanCheckbox9":"false","iTblCellBooleanColorFalse9":"#ff0000","iTblCellBooleanColorTrue9":"#00ff00","iTblCellNumberDecimals9":"2","iTblCellNumberDecimalSeperator9":".","iTblCellNumberThousandSeperator9":",","iTblCellThresholdsDp9":"","iTblCellThresholdsText9":"","iTblFixedHead":true,"iTblSortAttr":"","iColName1":"","iColName2":"","iColWidth2":"","iVertScroll":true,"iColPreText1":"","iColPreText2":"","iColPreText4":"","iTblDummyRow":"keine Daten","class":"runde_bilder_inventwo"},"style":{"left":"18px","top":"311px","width":"641px","height":"293px","font-size":"15px","overflow-y":"scroll","z-index":"100"},"widgetSet":"vis-inventwo"},{"tpl":"i-vis-jsontable","data":{"g_fixed":true,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","iTblRowLimit":"20","iTableRefreshRate":"0","iTblSortOrder":"asc","iColCount":"8","iColShow1":false,"iTblHeadTextAlign1":"center","iTblTextAlign1":"center","iTblCellFormat1":"normal","iTblCellImageSize1":"200","iTblCellBooleanCheckbox1":"false","iTblCellBooleanColorFalse1":"#ff0000","iTblCellBooleanColorTrue1":"#00ff00","iTblCellNumberDecimals1":"2","iTblCellNumberDecimalSeperator1":".","iTblCellNumberThousandSeperator1":",","iTblCellThresholdsDp1":"","iTblCellThresholdsText1":"","iOpacityAll":"1","iTblRowEvenColor":"#060d14","iTblRowUnevenColor":"#1d1f20","iTblHeaderColor":"#fff","iRowSpacing":"3.4","iTblRowEvenTextColor":"#ffffff","iTblRowUnevenTextColor":"#ffffff","iTblHeaderTextColor":"#000","iBorderSize":"0","iBorderStyleLeft":"none","iBorderStyleRight":"none","iBorderStyleUp":"none","iBorderStyleDown":"none","iBorderColor":"#ffffff","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"oid":"0_userdata.0.FUELPRICEMONITOR.SUPJsonAnzeige","iTblShowHead":true,"iColShow2":"true","iTblHeadTextAlign2":"left","iTblTextAlign2":"left","iTblCellFormat2":"image","iTblCellImageSize2":"30","iTblCellBooleanCheckbox2":"false","iTblCellBooleanColorFalse2":"#ff0000","iTblCellBooleanColorTrue2":"#00ff00","iTblCellNumberDecimals2":"2","iTblCellNumberDecimalSeperator2":".","iTblCellNumberThousandSeperator2":",","iTblCellThresholdsDp2":"","iTblCellThresholdsText2":"","iColShow3":"true","iTblHeadTextAlign3":"left","iTblTextAlign3":"left","iTblCellFormat3":"normal","iTblCellImageSize3":"200","iTblCellBooleanCheckbox3":false,"iTblCellBooleanColorFalse3":"#ff0000","iTblCellBooleanColorTrue3":"#00ff00","iTblCellNumberDecimals3":"2","iTblCellNumberDecimalSeperator3":".","iTblCellNumberThousandSeperator3":",","iTblCellThresholdsDp3":"","iTblCellThresholdsText3":"","iColShow4":"true","iTblHeadTextAlign4":"left","iTblTextAlign4":"left","iTblCellFormat4":"normal","iTblCellImageSize4":"200","iTblCellBooleanCheckbox4":"false","iTblCellBooleanColorFalse4":"#ff0000","iTblCellBooleanColorTrue4":"#00ff00","iTblCellNumberDecimals4":"2","iTblCellNumberDecimalSeperator4":".","iTblCellNumberThousandSeperator4":",","iTblCellThresholdsDp4":"","iTblCellThresholdsText4":"","iColShow5":true,"iTblHeadTextAlign5":"center","iTblTextAlign5":"center","iTblCellFormat5":"normal","iTblCellImageSize5":"200","iTblCellBooleanCheckbox5":"false","iTblCellBooleanColorFalse5":"#ff0000","iTblCellBooleanColorTrue5":"#00ff00","iTblCellNumberDecimals5":"2","iTblCellNumberDecimalSeperator5":".","iTblCellNumberThousandSeperator5":",","iTblCellThresholdsDp5":"","iTblCellThresholdsText5":"","iColShow6":false,"iTblHeadTextAlign6":"center","iTblTextAlign6":"center","iTblCellFormat6":"normal","iTblCellImageSize6":"200","iTblCellBooleanCheckbox6":"false","iTblCellBooleanColorFalse6":"#ff0000","iTblCellBooleanColorTrue6":"#00ff00","iTblCellNumberDecimals6":"2","iTblCellNumberDecimalSeperator6":".","iTblCellNumberThousandSeperator6":",","iTblCellThresholdsDp6":"","iTblCellThresholdsText6":"","iColShow7":false,"iTblHeadTextAlign7":"center","iTblTextAlign7":"center","iTblCellFormat7":"normal","iTblCellImageSize7":"200","iTblCellBooleanCheckbox7":"false","iTblCellBooleanColorFalse7":"#ff0000","iTblCellBooleanColorTrue7":"#00ff00","iTblCellNumberDecimals7":"2","iTblCellNumberDecimalSeperator7":".","iTblCellNumberThousandSeperator7":",","iTblCellThresholdsDp7":"","iTblCellThresholdsText7":"","iColShow8":"true","iTblHeadTextAlign8":"center","iTblTextAlign8":"center","iTblCellFormat8":"normal","iTblCellImageSize8":"200","iTblCellBooleanCheckbox8":"false","iTblCellBooleanColorFalse8":"#ff0000","iTblCellBooleanColorTrue8":"#00ff00","iTblCellNumberDecimals8":"2","iTblCellNumberDecimalSeperator8":".","iTblCellNumberThousandSeperator8":",","iTblCellThresholdsDp8":"","iTblCellThresholdsText8":"","iColShow9":"true","iTblHeadTextAlign9":"center","iTblTextAlign9":"center","iTblCellFormat9":"normal","iTblCellImageSize9":"200","iTblCellBooleanCheckbox9":"false","iTblCellBooleanColorFalse9":"#ff0000","iTblCellBooleanColorTrue9":"#00ff00","iTblCellNumberDecimals9":"2","iTblCellNumberDecimalSeperator9":".","iTblCellNumberThousandSeperator9":",","iTblCellThresholdsDp9":"","iTblCellThresholdsText9":"","iTblFixedHead":true,"iTblSortAttr":"","iColName1":"","iColName2":"","iColWidth2":"","iVertScroll":true,"iColPreText1":"","iColPreText2":"","iColPreText4":"","iTblDummyRow":"keine Daten","iColAfterText2":"","iColAttr2":"","class":"runde_bilder_inventwo"},"style":{"left":"22px","top":"51px","width":"641px","height":"293px","font-size":"15px","overflow-y":"scroll","z-index":"100"},"widgetSet":"vis-inventwo"}]
      

      // @liv-in-sky 13.02.23 15:12
      let anzahlAnzeige=5;
      let mySprit=["SUP","DIE"]; //oder ["GAS","DIE","SUP"] je nachdem, was man braucht
      let telegramInstanz="telegram.0"  // wenn nicht genutzt:   let telegramInstanz="";
      let emailInstanz=""; //  hier email instanz eintragen z.B. "email.0" - bei "" wird keine mail gesendet
      let emailUser="xx@yyyy.at"
      // Die Bilder müssen unter /vis.0/Tankstellen liegen   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      
      const config = getObject('system.config');
      const mylat =  config.common.latitude  //.replace(/(.*\..+?.+?.+?.+?.+?.+?).+/,"$1"); //*/"48." //l
      const mylong = config.common.longitude  //.replace(/(.*\..+?.+?.+?.+?.+?.+?).+/,"$1"); log(mylat)
      
      const defaultPic="/vis.0/Tankstellen/default.png"
      const pictures=[{"firma":"BP","pic":"/vis.0/Tankstellen/bp.png"},
                     {"firma":"Genol","pic":"/vis.0/Tankstellen/genol.png"},
                     {"firma":"eni","pic":"/vis.0/Tankstellen/eni.png"},
                     {"firma":"Diskont","pic":"/vis.0/Tankstellen/diskont.png"},
                     {"firma":"Turmöl","pic":"/vis.0/Tankstellen/turmoel.png"},
                     {"firma":"paradies","pic":"/vis.0/Tankstellen/treibstoffparadies.png"},
                     {"firma":"Lohberger","pic":"/vis.0/Tankstellen/lohberger.png"},
                     {"firma":"SB-Tankstelle","pic":"/vis.0/Tankstellen/sb.jpg"},
                     {"firma":"Hofer","pic":"/vis.0/Tankstellen/hofer.png"},
                     {"firma":"AVIA","pic":"/vis.0/Tankstellen/avia.png"},
                     {"firma":"avanti","pic":"/vis.0/Tankstellen/avanti.png"},
                     {"firma":"Shell","pic":"/vis.0/Tankstellen/shell.png"},
                     {"firma":"Aral","pic":"/vis.0/Tankstellen/Aral.png"},
                     {"firma":"JET","pic":"/vis.0/Tankstellen/jet.png"},
                     {"firma":"Ultsch","pic":"/vis.0/Tankstellen/ultsch.png"},
                     {"firma":"IQ","pic":"/vis.0/Tankstellen/iq.jpg"},
                     {"firma":"bft","pic":"/vis.0/Tankstellen/bft.png"}
                    ]
      
      //let myTelegramTextOld=["","",""];   
      let telegramIsSent=[false,false,false];           
      
      for (let i=0;i<mySprit.length;i++){
      if(!existsState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[i]+'JsonAnzeige')) createState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[i]+'JsonAnzeige', "", { name: "JsonAnzeige"+mySprit[i], type:'string' });
      if(!existsState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[i]+'telegram_messageid')) createState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[i]+'telegram_messageid', "", { name: "telegram_messageid"+mySprit[i], type:'string' });
      if(!existsState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[i]+'telegram_chatid')) createState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[i]+'telegram_chatid', "", { name: "telegram_chatid"+mySprit[i], type:'string' }); 
      if(!existsState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[i]+'TelegramNachricht')) createState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[i]+'TelegramNachricht', "", { name: "TelegramNachricht"+mySprit[i], type:'string' });
      if(!existsState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[i]+'EmailNachricht')) createState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[i]+'EmailNachricht', "", { name: "EmailNachricht"+mySprit[i], type:'string' });
      if ( existsState("javascript." + instance + ".FUELPRICEMONITOR.Targets.home"))  setState("javascript." + instance + ".FUELPRICEMONITOR.Targets.home",mylat+','+mylong);
            else  createState("javascript." + instance + ".FUELPRICEMONITOR.Targets.home", mylat+','+mylong, {type: "string", name: "Koordinaten FPM HOME", role: "value", read: true, write: true, } ); 
      }
      
      
      
      
      async function delTel(){
         if(telegramInstanz!=""){
         for (let b=0;b<mySprit.length;b++){await wait(2000);
            if(getState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[b]+'telegram_chatid').val!="") deletetext(mySprit[b]) // telegram reset !!
      }}}
      
      delTel(); //delete old telegram
      
      let triggerArr=[];
      
      for (let b=0;b<mySprit.length;b++){
      
        for(let bb=0;bb<anzahlAnzeige;bb++){
         triggerArr.push('fuelpricemonitor.0.cheapestOverAll_'+mySprit[b]+'.'+bb+'.amount');
         triggerArr.push('fuelpricemonitor.0.cheapestOverAll_'+mySprit[b]+'.'+bb+'.address')
                         
      }}
      
      
      //log(triggerArr.toString())
      let myPause=true;
      on({id: triggerArr, change: "ne"}, async function (obj) {
         var value = obj.state.val;
         var oldValue = obj.oldState.val;
         if (myPause) {setTimeout(async function () { mainFunc();}, 5000); /*log("Wert: "+value+" ID: "+obj.id+" AlterWert: "+oldValue);*/ myPause=false; setTimeout(async function () { myPause=true;}, 10000);}
       });
      
      
      
      
      async function mainFunc() {  
      for (let a=0;a<mySprit.length;a++){
      
      let myTelegramText="";
      let myEmailText="";
      
      let unserJsonArray=[];
      $('fuelpricemonitor.*.cheapestOverAll_'+mySprit[a]+'.*.address').each(function(id, i) {   
              let indexArr=id.split('.');
              let index=Number(indexArr[3]);
              let val0=getState(id).val; if(val0==null) val0="nicht angegeben"
              let val1=getState(id.replace("address","amount")).val;
              let val2;
              if(getState(id.replace("address","name")).val==null) {val2="nicht angegeben"} else {val2=getState(id.replace("address","name")).val.replace(" Tankstelle","").replace(" TANKSTELLE","")}
              let val3=getState(id.replace("address","id")).val;               
              let val4=searchLoc(val3);
              let val5=getDistanceFromLatLonInKm(mylat, mylong, val4.split(',')[0], val4.split(',')[1])
              let theAddressDate="Adresse (Last Update: "+formatDate(getDateObject((new Date().getTime())), "SS:mm - TT.MM.")+")";
      
      if(val1!=null && index<anzahlAnzeige){
      unserJsonArray.push({ "Index":    index,
                           [mySprit[a]]:     getPic(val2),
                           [theAddressDate]:  val0,
                           "Preis":    val1,
                           "Name":     val2,
                           "ID":       val3,
                           "Koordinaten": val4,
                           "Dis(km)":  val5,
                           "Adresse": val0 })
      
      
      if (  existsState("javascript." + instance + ".FUELPRICEMONITOR.Targets."+mySprit[a]+index+"er"))   setState("javascript." + instance + ".FUELPRICEMONITOR.Targets."+mySprit[a]+index+"er",val4.toString());
            else     createState("javascript." + instance + ".FUELPRICEMONITOR.Targets."+mySprit[a]+index+"er", val4.toString(), {type: "string", name: "Koordinaten FPM "+mySprit[a]+ index, role: "value", read: true, write: true, } ); }
      
      
      
      })
      
      //log(JSON.stringify(unserJsonArray));
      
      // in eigenen dp speichern - type zeichenkette
      setState("0_userdata.0.FUELPRICEMONITOR."+mySprit[a]+"JsonAnzeige",JSON.stringify(unserJsonArray));
      
         myTelegramText="<b><u>Letztes Update:  </u></b>"+formatDate(getDateObject((new Date().getTime())), "SS:mm -- TT.MM.")+"\n"+mySprit[a]+"\n\n";
         myEmailText=myTelegramText+"<br><br>";
      for(let i=0;i<unserJsonArray.length;i++){
         myTelegramText=myTelegramText+unserJsonArray[i].Adresse+"\n"+unserJsonArray[i].Name+" - Preis: "+unserJsonArray[i].Preis+"  -  Distanz: "+unserJsonArray[i]["Dis(km)"]+" km\n\n";
         myEmailText=myEmailText+unserJsonArray[i].Adresse+"<br>"+unserJsonArray[i].Name+" - Preis: "+unserJsonArray[i].Preis+"  -  Distanz: "+unserJsonArray[i]["Dis(km)"]+" km<br><br>";
      }
      if(telegramInstanz!=""){await wait(3000);
      if(/*myTelegramTextOld[a]!=myTelegramText&&*/!telegramIsSent[a])  {sendtext(myTelegramText,mySprit[a]);telegramIsSent[a]=true;
                                                             } else{ updatetext(myTelegramText,mySprit[a]);
                                                                                                          }
      //myTelegramTextOld[a]=myTelegramText;
      } 
      
      
      if(emailInstanz!="") sendMail(emailInstanz,myEmailText,emailUser,mySprit[a])
      setState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[a]+'TelegramNachricht',JSON.stringify(myTelegramText));
      setState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[a]+'EmailNachricht',JSON.stringify(myEmailText));
      }}
      
      
      
      function searchLoc(theId){
      let  ergebnis="";
      $('fuelpricemonitor.0.*.*.location.latitude').each(function(id, i) {
         let indexArr=id.split('.');
         let indexId=indexArr[3];
         
        // log(theId +"  "+indexId )
         if(indexId==theId ){
                                                          //log(getState(id).val+","+getState(id.replace("latitude","longitude")).val)
                                                          if(getState(id).val!=null){
                                                          ergebnis= (getState(id).val+","+getState(id.replace("latitude","longitude")).val).toString()}
                                                          else {if (ergebnis=="") ergebnis=mylat+','+mylong}
                                                          //if(theId=="6051") log(ergebnis)
                                                          } 
                                                          
      })
      //log (ergebnis)
      return ergebnis;
      
      }
      
      function getPic(nameTanke){
      let defaultTanke=defaultPic
      
      for(let i=0;i<pictures.length;i++){//log(nameTanke+"   -  "+pictures[i].firma+"  -  "+nameTanke.indexOf(pictures[i].firma))
       // if(pictures[i].firma.includes(nameTanke)) {defaultTanke=pictures[i].pic }
        if(nameTanke.indexOf(pictures[i].firma)>-1) {defaultTanke=pictures[i].pic; break }
      }
      //log(defaultTanke)
      return defaultTanke
      
      }
      /*
      function getDistanceFromLatLonInKm(lat1, lon1, lat2, lon2) {
       var R = 6371; // Radius of the earth in km
       var dLat = deg2rad(lat2-lat1);  // deg2rad below
       var dLon = deg2rad(lon2-lon1); 
       var a = 
         Math.sin(dLat/2) * Math.sin(dLat/2) +
         Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * 
         Math.sin(dLon/2) * Math.sin(dLon/2)
         ; 
       var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); 
       var d = R * c; // Distance in km
       return Math.round(d);
      }
      */
      
      function getDistanceFromLatLonInKm(lat1, lon1, lat2, lon2) {
       var p = 0.017453292519943295;    // Math.PI / 180
       var c = Math.cos;
       var a = 0.5 - c((lat2 - lat1) * p)/2 + 
               c(lat1 * p) * c(lat2 * p) * 
               (1 - c((lon2 - lon1) * p))/2;
      
       return Math.round(12742 * Math.asin(Math.sqrt(a))); // 2 * R; R = 6371 km
      }
      
      function deg2rad(deg) {
       return deg * (Math.PI/180)
      }
      
      async function sendtext(myText,theSprit) {
      
         sendTo(telegramInstanz, {
      
             text: myText,
             parse_mode:"HTML",
             disable_notification:   true
      
             });
         await wait(1000);
         var messageid=getState(telegramInstanz+".communicate.botSendMessageId").val;
         var chatid=getState(telegramInstanz+".communicate.botSendChatId").val;
         await wait(2000);//log("sendtext")
         setState('0_userdata.0.FUELPRICEMONITOR.'+theSprit+'telegram_messageid', String(messageid));
         setState('0_userdata.0.FUELPRICEMONITOR.'+theSprit+'telegram_chatid', String(chatid));
      
      }
      
      async function updatetext(myText,theSprit) {
      
         let mid=getState('0_userdata.0.FUELPRICEMONITOR.'+theSprit+'telegram_messageid').val
         let mch=getState('0_userdata.0.FUELPRICEMONITOR.'+theSprit+'telegram_chatid').val
         //log(mid+'  -  '+mch+"  -  update")
         
      
         sendTo(telegramInstanz, {
            text: myText,
            parse_mode:"HTML",
             editMessageText: {
                 options: {
                     disable_notification:   true,
                     parse_mode:"HTML",
                     chat_id: mch,
                     message_id: mid,
                           }
             }
         });
      
      }
      
      async function deletetext(theSpritDel) {
           // await wait(2000);
           // log(theSpritDel);
            sendTo(telegramInstanz, {
              deleteMessage: {
                 options: {
                     disable_notification:   true,
                     chat_id: getState('0_userdata.0.FUELPRICEMONITOR.'+theSpritDel+'telegram_chatid').val,
                     message_id: getState('0_userdata.0.FUELPRICEMONITOR.'+theSpritDel+'telegram_messageid').val
                 }
             }
      });
      }
      
      async function sendMail(inst,htmlText,toUser,type){
      sendTo(inst, "send", {
                          html: htmlText,
                          to: toUser,
                          subject: 'FuelPriceMonitor - Update - '+type
      });
      }
      
      
      let timeout = setTimeout(async function () { mainFunc();
      }, 3000);
      
      
      
      
      

      um die runden bilder zu bekommen, das folgende in den css tab im vis editor einfügen

      .runde_bilder_inventwo img{
         border-radius: 50px;
      }
      

      sigi234S Online
      sigi234S Online
      sigi234
      Forum Testing Most Active
      schrieb am zuletzt editiert von
      #14

      @liv-in-sky sagte in JSON Tabelle FuelPriceMonitor [Austria]:

      es gibt einen dp mit den telegram-text und im setting kann aktiviert werden dass es autom. eine nachricht an teleg. sendet (nachricht wird upgedatet und nicht neu geschrieben)

      Auch per Mail möglich?

      Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat.
      Immer Daten sichern!

      1 Antwort Letzte Antwort
      0
      • liv-in-skyL liv-in-sky

        hier ein script um den Fuelpricemonitor adapter in die vis zu bekommen (und telegram)

        @mrfloppy
        @Chaot
        @Negalein

        • show cheapest overall stations muss in instanz aktiviert sein
        • ich nutze das inventwo widget und das map widget - muss dann auch installiert sein (inventwo funktioniert nicht mit vis app)
        • pro sprit typ entsteht eine tabelle - dp unter:0_userdata.0.FUELPRICEMONITOR
        • es gibt einen dp mit den telegram-text und im setting kann aktiviert werden dass es autom. eine nachricht an teleg. sendet (nachricht wird upgedatet und nicht neu geschrieben)
        • im oberen bereich des scriptes das setting beachten und einstellen
        • Die Bilder müssen unter /vis.0/Tankstellen mit dem vis dateimanager hochgeladen werden

        sieht dann so aus (beispiel: super und diesel):

        Image 186.png

        Image 180.png

        Image 182.png

        bilder.7z

        [{"tpl":"tplOsm","data":{"g_fixed":false,"g_visibility":false,"g_css_font_text":false,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","mCount":"6","maxZoom":"0","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"hideControls":true,"markersSwap1":true,"markersLon-oid1":"javascript.0.FUELPRICEMONITOR.Targets.SUP0er","markersLat-oid1":"","markersWidth1":"13","markersHeight1":"13","markersOffsetX1":"","markersOffsetY1":"","markersImage1":"/vis.0/armin/img/zahl/1-green.png","markersLon-oid2":"javascript.0.FUELPRICEMONITOR.Targets.SUP1er","markersSwap2":true,"markersLon-oid3":"javascript.0.FUELPRICEMONITOR.Targets.SUP2er","markersSwap3":true,"markersLon-oid4":"javascript.0.FUELPRICEMONITOR.Targets.SUP3er","markersSwap4":true,"markersImage4":"/vis.0/armin/img/zahl/4-green.png","markersImage3":"/vis.0/armin/img/zahl/3-green.png","markersImage2":"/vis.0/armin/img/zahl/2-green.png","markersLon-oid6":"javascript.0.FUELPRICEMONITOR.Targets.home","markersSwap6":true,"markersImage6":"/vis.0/armin/img/haus2.png","g_markers_§4":true,"markersWidth2":"13","markersHeight2":"13","markersWidth3":"13","markersHeight3":"13","markersWidth4":"13","markersHeight4":"13","markersWidth6":"17","markersHeight6":"17","markersLon-oid5":"javascript.0.FUELPRICEMONITOR.Targets.SUP4er","markersSwap5":true,"markersImage5":"/vis.0/armin/img/zahl/5-green.png","markersWidth5":"13","markersHeight5":"13"},"style":{"left":"699px","top":"54px","width":"341px","height":"220px","z-index":"600"},"widgetSet":"map"},{"tpl":"tplOsm","data":{"g_fixed":false,"g_visibility":false,"g_css_font_text":false,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","mCount":"6","maxZoom":"0","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"hideControls":true,"markersSwap1":true,"markersLon-oid1":"javascript.0.FUELPRICEMONITOR.Targets.DIE0er","markersLat-oid1":"","markersWidth1":"13","markersHeight1":"13","markersOffsetX1":"","markersOffsetY1":"","markersImage1":"/vis.0/armin/img/zahl/1-green.png","markersLon-oid2":"javascript.0.FUELPRICEMONITOR.Targets.DIE1er","markersSwap2":true,"markersLon-oid3":"javascript.0.FUELPRICEMONITOR.Targets.DIE2er","markersSwap3":true,"markersLon-oid4":"javascript.0.FUELPRICEMONITOR.Targets.DIE3er","markersSwap4":true,"markersImage4":"/vis.0/armin/img/zahl/4-green.png","markersImage3":"/vis.0/armin/img/zahl/3-green.png","markersImage2":"/vis.0/armin/img/zahl/2-green.png","markersLon-oid6":"javascript.0.FUELPRICEMONITOR.Targets.home","markersSwap6":true,"markersImage6":"/vis.0/armin/img/haus2.png","g_markers_§4":true,"markersWidth2":"13","markersHeight2":"13","markersWidth3":"13","markersHeight3":"13","markersWidth4":"13","markersHeight4":"13","markersWidth6":"17","markersHeight6":"17","markersLon-oid5":"javascript.0.FUELPRICEMONITOR.Targets.DIE4er","markersSwap5":true,"markersImage5":"/vis.0/armin/img/zahl/5-green.png","markersWidth5":"13","markersHeight5":"13"},"style":{"left":"698px","top":"310px","width":"341px","height":"220px"},"widgetSet":"map"},{"tpl":"i-vis-jsontable","data":{"g_fixed":true,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","iTblRowLimit":"20","iTableRefreshRate":"0","iTblSortOrder":"asc","iColCount":"8","iColShow1":false,"iTblHeadTextAlign1":"center","iTblTextAlign1":"center","iTblCellFormat1":"normal","iTblCellImageSize1":"200","iTblCellBooleanCheckbox1":"false","iTblCellBooleanColorFalse1":"#ff0000","iTblCellBooleanColorTrue1":"#00ff00","iTblCellNumberDecimals1":"2","iTblCellNumberDecimalSeperator1":".","iTblCellNumberThousandSeperator1":",","iTblCellThresholdsDp1":"","iTblCellThresholdsText1":"","iOpacityAll":"1","iTblRowEvenColor":"#060d14","iTblRowUnevenColor":"#1d1f20","iTblHeaderColor":"#fff","iRowSpacing":"3.4","iTblRowEvenTextColor":"#ffffff","iTblRowUnevenTextColor":"#ffffff","iTblHeaderTextColor":"#000","iBorderSize":"0","iBorderStyleLeft":"none","iBorderStyleRight":"none","iBorderStyleUp":"none","iBorderStyleDown":"none","iBorderColor":"#ffffff","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"oid":"0_userdata.0.FUELPRICEMONITOR.DIEJsonAnzeige","iTblShowHead":true,"iColShow2":"true","iTblHeadTextAlign2":"left","iTblTextAlign2":"left","iTblCellFormat2":"image","iTblCellImageSize2":"30","iTblCellBooleanCheckbox2":"false","iTblCellBooleanColorFalse2":"#ff0000","iTblCellBooleanColorTrue2":"#00ff00","iTblCellNumberDecimals2":"2","iTblCellNumberDecimalSeperator2":".","iTblCellNumberThousandSeperator2":",","iTblCellThresholdsDp2":"","iTblCellThresholdsText2":"","iColShow3":"true","iTblHeadTextAlign3":"left","iTblTextAlign3":"left","iTblCellFormat3":"normal","iTblCellImageSize3":"200","iTblCellBooleanCheckbox3":false,"iTblCellBooleanColorFalse3":"#ff0000","iTblCellBooleanColorTrue3":"#00ff00","iTblCellNumberDecimals3":"2","iTblCellNumberDecimalSeperator3":".","iTblCellNumberThousandSeperator3":",","iTblCellThresholdsDp3":"","iTblCellThresholdsText3":"","iColShow4":"true","iTblHeadTextAlign4":"left","iTblTextAlign4":"left","iTblCellFormat4":"normal","iTblCellImageSize4":"200","iTblCellBooleanCheckbox4":"false","iTblCellBooleanColorFalse4":"#ff0000","iTblCellBooleanColorTrue4":"#00ff00","iTblCellNumberDecimals4":"2","iTblCellNumberDecimalSeperator4":".","iTblCellNumberThousandSeperator4":",","iTblCellThresholdsDp4":"","iTblCellThresholdsText4":"","iColShow5":true,"iTblHeadTextAlign5":"center","iTblTextAlign5":"center","iTblCellFormat5":"normal","iTblCellImageSize5":"200","iTblCellBooleanCheckbox5":"false","iTblCellBooleanColorFalse5":"#ff0000","iTblCellBooleanColorTrue5":"#00ff00","iTblCellNumberDecimals5":"2","iTblCellNumberDecimalSeperator5":".","iTblCellNumberThousandSeperator5":",","iTblCellThresholdsDp5":"","iTblCellThresholdsText5":"","iColShow6":false,"iTblHeadTextAlign6":"center","iTblTextAlign6":"center","iTblCellFormat6":"normal","iTblCellImageSize6":"200","iTblCellBooleanCheckbox6":"false","iTblCellBooleanColorFalse6":"#ff0000","iTblCellBooleanColorTrue6":"#00ff00","iTblCellNumberDecimals6":"2","iTblCellNumberDecimalSeperator6":".","iTblCellNumberThousandSeperator6":",","iTblCellThresholdsDp6":"","iTblCellThresholdsText6":"","iColShow7":false,"iTblHeadTextAlign7":"center","iTblTextAlign7":"center","iTblCellFormat7":"normal","iTblCellImageSize7":"200","iTblCellBooleanCheckbox7":"false","iTblCellBooleanColorFalse7":"#ff0000","iTblCellBooleanColorTrue7":"#00ff00","iTblCellNumberDecimals7":"2","iTblCellNumberDecimalSeperator7":".","iTblCellNumberThousandSeperator7":",","iTblCellThresholdsDp7":"","iTblCellThresholdsText7":"","iColShow8":"true","iTblHeadTextAlign8":"center","iTblTextAlign8":"center","iTblCellFormat8":"normal","iTblCellImageSize8":"200","iTblCellBooleanCheckbox8":"false","iTblCellBooleanColorFalse8":"#ff0000","iTblCellBooleanColorTrue8":"#00ff00","iTblCellNumberDecimals8":"2","iTblCellNumberDecimalSeperator8":".","iTblCellNumberThousandSeperator8":",","iTblCellThresholdsDp8":"","iTblCellThresholdsText8":"","iColShow9":"true","iTblHeadTextAlign9":"center","iTblTextAlign9":"center","iTblCellFormat9":"normal","iTblCellImageSize9":"200","iTblCellBooleanCheckbox9":"false","iTblCellBooleanColorFalse9":"#ff0000","iTblCellBooleanColorTrue9":"#00ff00","iTblCellNumberDecimals9":"2","iTblCellNumberDecimalSeperator9":".","iTblCellNumberThousandSeperator9":",","iTblCellThresholdsDp9":"","iTblCellThresholdsText9":"","iTblFixedHead":true,"iTblSortAttr":"","iColName1":"","iColName2":"","iColWidth2":"","iVertScroll":true,"iColPreText1":"","iColPreText2":"","iColPreText4":"","iTblDummyRow":"keine Daten","class":"runde_bilder_inventwo"},"style":{"left":"18px","top":"311px","width":"641px","height":"293px","font-size":"15px","overflow-y":"scroll","z-index":"100"},"widgetSet":"vis-inventwo"},{"tpl":"i-vis-jsontable","data":{"g_fixed":true,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","iTblRowLimit":"20","iTableRefreshRate":"0","iTblSortOrder":"asc","iColCount":"8","iColShow1":false,"iTblHeadTextAlign1":"center","iTblTextAlign1":"center","iTblCellFormat1":"normal","iTblCellImageSize1":"200","iTblCellBooleanCheckbox1":"false","iTblCellBooleanColorFalse1":"#ff0000","iTblCellBooleanColorTrue1":"#00ff00","iTblCellNumberDecimals1":"2","iTblCellNumberDecimalSeperator1":".","iTblCellNumberThousandSeperator1":",","iTblCellThresholdsDp1":"","iTblCellThresholdsText1":"","iOpacityAll":"1","iTblRowEvenColor":"#060d14","iTblRowUnevenColor":"#1d1f20","iTblHeaderColor":"#fff","iRowSpacing":"3.4","iTblRowEvenTextColor":"#ffffff","iTblRowUnevenTextColor":"#ffffff","iTblHeaderTextColor":"#000","iBorderSize":"0","iBorderStyleLeft":"none","iBorderStyleRight":"none","iBorderStyleUp":"none","iBorderStyleDown":"none","iBorderColor":"#ffffff","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"oid":"0_userdata.0.FUELPRICEMONITOR.SUPJsonAnzeige","iTblShowHead":true,"iColShow2":"true","iTblHeadTextAlign2":"left","iTblTextAlign2":"left","iTblCellFormat2":"image","iTblCellImageSize2":"30","iTblCellBooleanCheckbox2":"false","iTblCellBooleanColorFalse2":"#ff0000","iTblCellBooleanColorTrue2":"#00ff00","iTblCellNumberDecimals2":"2","iTblCellNumberDecimalSeperator2":".","iTblCellNumberThousandSeperator2":",","iTblCellThresholdsDp2":"","iTblCellThresholdsText2":"","iColShow3":"true","iTblHeadTextAlign3":"left","iTblTextAlign3":"left","iTblCellFormat3":"normal","iTblCellImageSize3":"200","iTblCellBooleanCheckbox3":false,"iTblCellBooleanColorFalse3":"#ff0000","iTblCellBooleanColorTrue3":"#00ff00","iTblCellNumberDecimals3":"2","iTblCellNumberDecimalSeperator3":".","iTblCellNumberThousandSeperator3":",","iTblCellThresholdsDp3":"","iTblCellThresholdsText3":"","iColShow4":"true","iTblHeadTextAlign4":"left","iTblTextAlign4":"left","iTblCellFormat4":"normal","iTblCellImageSize4":"200","iTblCellBooleanCheckbox4":"false","iTblCellBooleanColorFalse4":"#ff0000","iTblCellBooleanColorTrue4":"#00ff00","iTblCellNumberDecimals4":"2","iTblCellNumberDecimalSeperator4":".","iTblCellNumberThousandSeperator4":",","iTblCellThresholdsDp4":"","iTblCellThresholdsText4":"","iColShow5":true,"iTblHeadTextAlign5":"center","iTblTextAlign5":"center","iTblCellFormat5":"normal","iTblCellImageSize5":"200","iTblCellBooleanCheckbox5":"false","iTblCellBooleanColorFalse5":"#ff0000","iTblCellBooleanColorTrue5":"#00ff00","iTblCellNumberDecimals5":"2","iTblCellNumberDecimalSeperator5":".","iTblCellNumberThousandSeperator5":",","iTblCellThresholdsDp5":"","iTblCellThresholdsText5":"","iColShow6":false,"iTblHeadTextAlign6":"center","iTblTextAlign6":"center","iTblCellFormat6":"normal","iTblCellImageSize6":"200","iTblCellBooleanCheckbox6":"false","iTblCellBooleanColorFalse6":"#ff0000","iTblCellBooleanColorTrue6":"#00ff00","iTblCellNumberDecimals6":"2","iTblCellNumberDecimalSeperator6":".","iTblCellNumberThousandSeperator6":",","iTblCellThresholdsDp6":"","iTblCellThresholdsText6":"","iColShow7":false,"iTblHeadTextAlign7":"center","iTblTextAlign7":"center","iTblCellFormat7":"normal","iTblCellImageSize7":"200","iTblCellBooleanCheckbox7":"false","iTblCellBooleanColorFalse7":"#ff0000","iTblCellBooleanColorTrue7":"#00ff00","iTblCellNumberDecimals7":"2","iTblCellNumberDecimalSeperator7":".","iTblCellNumberThousandSeperator7":",","iTblCellThresholdsDp7":"","iTblCellThresholdsText7":"","iColShow8":"true","iTblHeadTextAlign8":"center","iTblTextAlign8":"center","iTblCellFormat8":"normal","iTblCellImageSize8":"200","iTblCellBooleanCheckbox8":"false","iTblCellBooleanColorFalse8":"#ff0000","iTblCellBooleanColorTrue8":"#00ff00","iTblCellNumberDecimals8":"2","iTblCellNumberDecimalSeperator8":".","iTblCellNumberThousandSeperator8":",","iTblCellThresholdsDp8":"","iTblCellThresholdsText8":"","iColShow9":"true","iTblHeadTextAlign9":"center","iTblTextAlign9":"center","iTblCellFormat9":"normal","iTblCellImageSize9":"200","iTblCellBooleanCheckbox9":"false","iTblCellBooleanColorFalse9":"#ff0000","iTblCellBooleanColorTrue9":"#00ff00","iTblCellNumberDecimals9":"2","iTblCellNumberDecimalSeperator9":".","iTblCellNumberThousandSeperator9":",","iTblCellThresholdsDp9":"","iTblCellThresholdsText9":"","iTblFixedHead":true,"iTblSortAttr":"","iColName1":"","iColName2":"","iColWidth2":"","iVertScroll":true,"iColPreText1":"","iColPreText2":"","iColPreText4":"","iTblDummyRow":"keine Daten","iColAfterText2":"","iColAttr2":"","class":"runde_bilder_inventwo"},"style":{"left":"22px","top":"51px","width":"641px","height":"293px","font-size":"15px","overflow-y":"scroll","z-index":"100"},"widgetSet":"vis-inventwo"}]
        

        // @liv-in-sky 13.02.23 15:12
        let anzahlAnzeige=5;
        let mySprit=["SUP","DIE"]; //oder ["GAS","DIE","SUP"] je nachdem, was man braucht
        let telegramInstanz="telegram.0"  // wenn nicht genutzt:   let telegramInstanz="";
        let emailInstanz=""; //  hier email instanz eintragen z.B. "email.0" - bei "" wird keine mail gesendet
        let emailUser="xx@yyyy.at"
        // Die Bilder müssen unter /vis.0/Tankstellen liegen   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        
        const config = getObject('system.config');
        const mylat =  config.common.latitude  //.replace(/(.*\..+?.+?.+?.+?.+?.+?).+/,"$1"); //*/"48." //l
        const mylong = config.common.longitude  //.replace(/(.*\..+?.+?.+?.+?.+?.+?).+/,"$1"); log(mylat)
        
        const defaultPic="/vis.0/Tankstellen/default.png"
        const pictures=[{"firma":"BP","pic":"/vis.0/Tankstellen/bp.png"},
                       {"firma":"Genol","pic":"/vis.0/Tankstellen/genol.png"},
                       {"firma":"eni","pic":"/vis.0/Tankstellen/eni.png"},
                       {"firma":"Diskont","pic":"/vis.0/Tankstellen/diskont.png"},
                       {"firma":"Turmöl","pic":"/vis.0/Tankstellen/turmoel.png"},
                       {"firma":"paradies","pic":"/vis.0/Tankstellen/treibstoffparadies.png"},
                       {"firma":"Lohberger","pic":"/vis.0/Tankstellen/lohberger.png"},
                       {"firma":"SB-Tankstelle","pic":"/vis.0/Tankstellen/sb.jpg"},
                       {"firma":"Hofer","pic":"/vis.0/Tankstellen/hofer.png"},
                       {"firma":"AVIA","pic":"/vis.0/Tankstellen/avia.png"},
                       {"firma":"avanti","pic":"/vis.0/Tankstellen/avanti.png"},
                       {"firma":"Shell","pic":"/vis.0/Tankstellen/shell.png"},
                       {"firma":"Aral","pic":"/vis.0/Tankstellen/Aral.png"},
                       {"firma":"JET","pic":"/vis.0/Tankstellen/jet.png"},
                       {"firma":"Ultsch","pic":"/vis.0/Tankstellen/ultsch.png"},
                       {"firma":"IQ","pic":"/vis.0/Tankstellen/iq.jpg"},
                       {"firma":"bft","pic":"/vis.0/Tankstellen/bft.png"}
                      ]
        
        //let myTelegramTextOld=["","",""];   
        let telegramIsSent=[false,false,false];           
        
        for (let i=0;i<mySprit.length;i++){
        if(!existsState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[i]+'JsonAnzeige')) createState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[i]+'JsonAnzeige', "", { name: "JsonAnzeige"+mySprit[i], type:'string' });
        if(!existsState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[i]+'telegram_messageid')) createState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[i]+'telegram_messageid', "", { name: "telegram_messageid"+mySprit[i], type:'string' });
        if(!existsState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[i]+'telegram_chatid')) createState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[i]+'telegram_chatid', "", { name: "telegram_chatid"+mySprit[i], type:'string' }); 
        if(!existsState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[i]+'TelegramNachricht')) createState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[i]+'TelegramNachricht', "", { name: "TelegramNachricht"+mySprit[i], type:'string' });
        if(!existsState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[i]+'EmailNachricht')) createState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[i]+'EmailNachricht', "", { name: "EmailNachricht"+mySprit[i], type:'string' });
        if ( existsState("javascript." + instance + ".FUELPRICEMONITOR.Targets.home"))  setState("javascript." + instance + ".FUELPRICEMONITOR.Targets.home",mylat+','+mylong);
              else  createState("javascript." + instance + ".FUELPRICEMONITOR.Targets.home", mylat+','+mylong, {type: "string", name: "Koordinaten FPM HOME", role: "value", read: true, write: true, } ); 
        }
        
        
        
        
        async function delTel(){
           if(telegramInstanz!=""){
           for (let b=0;b<mySprit.length;b++){await wait(2000);
              if(getState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[b]+'telegram_chatid').val!="") deletetext(mySprit[b]) // telegram reset !!
        }}}
        
        delTel(); //delete old telegram
        
        let triggerArr=[];
        
        for (let b=0;b<mySprit.length;b++){
        
          for(let bb=0;bb<anzahlAnzeige;bb++){
           triggerArr.push('fuelpricemonitor.0.cheapestOverAll_'+mySprit[b]+'.'+bb+'.amount');
           triggerArr.push('fuelpricemonitor.0.cheapestOverAll_'+mySprit[b]+'.'+bb+'.address')
                           
        }}
        
        
        //log(triggerArr.toString())
        let myPause=true;
        on({id: triggerArr, change: "ne"}, async function (obj) {
           var value = obj.state.val;
           var oldValue = obj.oldState.val;
           if (myPause) {setTimeout(async function () { mainFunc();}, 5000); /*log("Wert: "+value+" ID: "+obj.id+" AlterWert: "+oldValue);*/ myPause=false; setTimeout(async function () { myPause=true;}, 10000);}
         });
        
        
        
        
        async function mainFunc() {  
        for (let a=0;a<mySprit.length;a++){
        
        let myTelegramText="";
        let myEmailText="";
        
        let unserJsonArray=[];
        $('fuelpricemonitor.*.cheapestOverAll_'+mySprit[a]+'.*.address').each(function(id, i) {   
                let indexArr=id.split('.');
                let index=Number(indexArr[3]);
                let val0=getState(id).val; if(val0==null) val0="nicht angegeben"
                let val1=getState(id.replace("address","amount")).val;
                let val2;
                if(getState(id.replace("address","name")).val==null) {val2="nicht angegeben"} else {val2=getState(id.replace("address","name")).val.replace(" Tankstelle","").replace(" TANKSTELLE","")}
                let val3=getState(id.replace("address","id")).val;               
                let val4=searchLoc(val3);
                let val5=getDistanceFromLatLonInKm(mylat, mylong, val4.split(',')[0], val4.split(',')[1])
                let theAddressDate="Adresse (Last Update: "+formatDate(getDateObject((new Date().getTime())), "SS:mm - TT.MM.")+")";
        
        if(val1!=null && index<anzahlAnzeige){
        unserJsonArray.push({ "Index":    index,
                             [mySprit[a]]:     getPic(val2),
                             [theAddressDate]:  val0,
                             "Preis":    val1,
                             "Name":     val2,
                             "ID":       val3,
                             "Koordinaten": val4,
                             "Dis(km)":  val5,
                             "Adresse": val0 })
        
        
        if (  existsState("javascript." + instance + ".FUELPRICEMONITOR.Targets."+mySprit[a]+index+"er"))   setState("javascript." + instance + ".FUELPRICEMONITOR.Targets."+mySprit[a]+index+"er",val4.toString());
              else     createState("javascript." + instance + ".FUELPRICEMONITOR.Targets."+mySprit[a]+index+"er", val4.toString(), {type: "string", name: "Koordinaten FPM "+mySprit[a]+ index, role: "value", read: true, write: true, } ); }
        
        
        
        })
        
        //log(JSON.stringify(unserJsonArray));
        
        // in eigenen dp speichern - type zeichenkette
        setState("0_userdata.0.FUELPRICEMONITOR."+mySprit[a]+"JsonAnzeige",JSON.stringify(unserJsonArray));
        
           myTelegramText="<b><u>Letztes Update:  </u></b>"+formatDate(getDateObject((new Date().getTime())), "SS:mm -- TT.MM.")+"\n"+mySprit[a]+"\n\n";
           myEmailText=myTelegramText+"<br><br>";
        for(let i=0;i<unserJsonArray.length;i++){
           myTelegramText=myTelegramText+unserJsonArray[i].Adresse+"\n"+unserJsonArray[i].Name+" - Preis: "+unserJsonArray[i].Preis+"  -  Distanz: "+unserJsonArray[i]["Dis(km)"]+" km\n\n";
           myEmailText=myEmailText+unserJsonArray[i].Adresse+"<br>"+unserJsonArray[i].Name+" - Preis: "+unserJsonArray[i].Preis+"  -  Distanz: "+unserJsonArray[i]["Dis(km)"]+" km<br><br>";
        }
        if(telegramInstanz!=""){await wait(3000);
        if(/*myTelegramTextOld[a]!=myTelegramText&&*/!telegramIsSent[a])  {sendtext(myTelegramText,mySprit[a]);telegramIsSent[a]=true;
                                                               } else{ updatetext(myTelegramText,mySprit[a]);
                                                                                                            }
        //myTelegramTextOld[a]=myTelegramText;
        } 
        
        
        if(emailInstanz!="") sendMail(emailInstanz,myEmailText,emailUser,mySprit[a])
        setState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[a]+'TelegramNachricht',JSON.stringify(myTelegramText));
        setState('0_userdata.0.FUELPRICEMONITOR.'+mySprit[a]+'EmailNachricht',JSON.stringify(myEmailText));
        }}
        
        
        
        function searchLoc(theId){
        let  ergebnis="";
        $('fuelpricemonitor.0.*.*.location.latitude').each(function(id, i) {
           let indexArr=id.split('.');
           let indexId=indexArr[3];
           
          // log(theId +"  "+indexId )
           if(indexId==theId ){
                                                            //log(getState(id).val+","+getState(id.replace("latitude","longitude")).val)
                                                            if(getState(id).val!=null){
                                                            ergebnis= (getState(id).val+","+getState(id.replace("latitude","longitude")).val).toString()}
                                                            else {if (ergebnis=="") ergebnis=mylat+','+mylong}
                                                            //if(theId=="6051") log(ergebnis)
                                                            } 
                                                            
        })
        //log (ergebnis)
        return ergebnis;
        
        }
        
        function getPic(nameTanke){
        let defaultTanke=defaultPic
        
        for(let i=0;i<pictures.length;i++){//log(nameTanke+"   -  "+pictures[i].firma+"  -  "+nameTanke.indexOf(pictures[i].firma))
         // if(pictures[i].firma.includes(nameTanke)) {defaultTanke=pictures[i].pic }
          if(nameTanke.indexOf(pictures[i].firma)>-1) {defaultTanke=pictures[i].pic; break }
        }
        //log(defaultTanke)
        return defaultTanke
        
        }
        /*
        function getDistanceFromLatLonInKm(lat1, lon1, lat2, lon2) {
         var R = 6371; // Radius of the earth in km
         var dLat = deg2rad(lat2-lat1);  // deg2rad below
         var dLon = deg2rad(lon2-lon1); 
         var a = 
           Math.sin(dLat/2) * Math.sin(dLat/2) +
           Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * 
           Math.sin(dLon/2) * Math.sin(dLon/2)
           ; 
         var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); 
         var d = R * c; // Distance in km
         return Math.round(d);
        }
        */
        
        function getDistanceFromLatLonInKm(lat1, lon1, lat2, lon2) {
         var p = 0.017453292519943295;    // Math.PI / 180
         var c = Math.cos;
         var a = 0.5 - c((lat2 - lat1) * p)/2 + 
                 c(lat1 * p) * c(lat2 * p) * 
                 (1 - c((lon2 - lon1) * p))/2;
        
         return Math.round(12742 * Math.asin(Math.sqrt(a))); // 2 * R; R = 6371 km
        }
        
        function deg2rad(deg) {
         return deg * (Math.PI/180)
        }
        
        async function sendtext(myText,theSprit) {
        
           sendTo(telegramInstanz, {
        
               text: myText,
               parse_mode:"HTML",
               disable_notification:   true
        
               });
           await wait(1000);
           var messageid=getState(telegramInstanz+".communicate.botSendMessageId").val;
           var chatid=getState(telegramInstanz+".communicate.botSendChatId").val;
           await wait(2000);//log("sendtext")
           setState('0_userdata.0.FUELPRICEMONITOR.'+theSprit+'telegram_messageid', String(messageid));
           setState('0_userdata.0.FUELPRICEMONITOR.'+theSprit+'telegram_chatid', String(chatid));
        
        }
        
        async function updatetext(myText,theSprit) {
        
           let mid=getState('0_userdata.0.FUELPRICEMONITOR.'+theSprit+'telegram_messageid').val
           let mch=getState('0_userdata.0.FUELPRICEMONITOR.'+theSprit+'telegram_chatid').val
           //log(mid+'  -  '+mch+"  -  update")
           
        
           sendTo(telegramInstanz, {
              text: myText,
              parse_mode:"HTML",
               editMessageText: {
                   options: {
                       disable_notification:   true,
                       parse_mode:"HTML",
                       chat_id: mch,
                       message_id: mid,
                             }
               }
           });
        
        }
        
        async function deletetext(theSpritDel) {
             // await wait(2000);
             // log(theSpritDel);
              sendTo(telegramInstanz, {
                deleteMessage: {
                   options: {
                       disable_notification:   true,
                       chat_id: getState('0_userdata.0.FUELPRICEMONITOR.'+theSpritDel+'telegram_chatid').val,
                       message_id: getState('0_userdata.0.FUELPRICEMONITOR.'+theSpritDel+'telegram_messageid').val
                   }
               }
        });
        }
        
        async function sendMail(inst,htmlText,toUser,type){
        sendTo(inst, "send", {
                            html: htmlText,
                            to: toUser,
                            subject: 'FuelPriceMonitor - Update - '+type
        });
        }
        
        
        let timeout = setTimeout(async function () { mainFunc();
        }, 3000);
        
        
        
        
        

        um die runden bilder zu bekommen, das folgende in den css tab im vis editor einfügen

        .runde_bilder_inventwo img{
           border-radius: 50px;
        }
        

        M Offline
        M Offline
        mrfloppy
        schrieb am zuletzt editiert von
        #15

        @liv-in-sky
        Hallo
        Kann es sein das beim Update des FUELPRICEMONITORS die Liste nicht upgedatet wird?
        Zumindest bei mir hattei ch vorher noch den alten Preis von gestgern, und erst nach neustart des Scripts kam die aktualisierung.
        Möglich das im Telegram der Name der Tanke dabei steht?

        liv-in-skyL 4 Antworten Letzte Antwort
        0
        • M mrfloppy

          @liv-in-sky
          Hallo
          Kann es sein das beim Update des FUELPRICEMONITORS die Liste nicht upgedatet wird?
          Zumindest bei mir hattei ch vorher noch den alten Preis von gestgern, und erst nach neustart des Scripts kam die aktualisierung.
          Möglich das im Telegram der Name der Tanke dabei steht?

          liv-in-skyL Offline
          liv-in-skyL Offline
          liv-in-sky
          schrieb am zuletzt editiert von
          #16

          @mrfloppy ja - leider hast du recht - bin gerade am updaten des scriptes- siehe meinen post darüber - dauert nicht lange

          nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

          1 Antwort Letzte Antwort
          0
          • M mrfloppy

            @liv-in-sky
            Hallo
            Kann es sein das beim Update des FUELPRICEMONITORS die Liste nicht upgedatet wird?
            Zumindest bei mir hattei ch vorher noch den alten Preis von gestgern, und erst nach neustart des Scripts kam die aktualisierung.
            Möglich das im Telegram der Name der Tanke dabei steht?

            liv-in-skyL Offline
            liv-in-skyL Offline
            liv-in-sky
            schrieb am zuletzt editiert von
            #17

            @mrfloppy sagte in JSON Tabelle FuelPriceMonitor [Austria]:

            Möglich das im Telegram der Name der Tanke dabei steht?

            ja - ist möglich - mach ich auch gleich mit

            nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

            1 Antwort Letzte Antwort
            0
            • M mrfloppy

              @liv-in-sky
              Hallo
              Kann es sein das beim Update des FUELPRICEMONITORS die Liste nicht upgedatet wird?
              Zumindest bei mir hattei ch vorher noch den alten Preis von gestgern, und erst nach neustart des Scripts kam die aktualisierung.
              Möglich das im Telegram der Name der Tanke dabei steht?

              liv-in-skyL Offline
              liv-in-skyL Offline
              liv-in-sky
              schrieb am zuletzt editiert von
              #18

              @mrfloppy
              @sigi234

              script ist im ersten post upgedatet - email möglich - trigger sollte funktionieren - name dabei

              nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

              sigi234S 1 Antwort Letzte Antwort
              0
              • M mrfloppy

                @liv-in-sky
                Hallo
                Kann es sein das beim Update des FUELPRICEMONITORS die Liste nicht upgedatet wird?
                Zumindest bei mir hattei ch vorher noch den alten Preis von gestgern, und erst nach neustart des Scripts kam die aktualisierung.
                Möglich das im Telegram der Name der Tanke dabei steht?

                liv-in-skyL Offline
                liv-in-skyL Offline
                liv-in-sky
                schrieb am zuletzt editiert von liv-in-sky
                #19

                @mrfloppy

                hast du das gesehen https://forum.iobroker.net/post/251463

                hier wird das menu gezeigt, welches du in telegram brauchst - klicks du dann den diesel preis button (den du erstellen musst), sendest du den inhalt unseres scriptes (datenpunkt für telegram) zurück ..

                oder hier: https://www.youtube.com/watch?v=f8ctnGvOjy4

                nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

                1 Antwort Letzte Antwort
                0
                • liv-in-skyL liv-in-sky

                  @mrfloppy
                  @sigi234

                  script ist im ersten post upgedatet - email möglich - trigger sollte funktionieren - name dabei

                  sigi234S Online
                  sigi234S Online
                  sigi234
                  Forum Testing Most Active
                  schrieb am zuletzt editiert von
                  #20

                  @liv-in-sky sagte in JSON Tabelle FuelPriceMonitor [Austria]:

                  @mrfloppy
                  @sigi234

                  script ist im ersten post upgedatet - email möglich - trigger sollte funktionieren - name dabei

                  Ok, Danke. km werden nicht angezeigt?

                  Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat.
                  Immer Daten sichern!

                  liv-in-skyL 1 Antwort Letzte Antwort
                  0
                  • sigi234S sigi234

                    @liv-in-sky sagte in JSON Tabelle FuelPriceMonitor [Austria]:

                    @mrfloppy
                    @sigi234

                    script ist im ersten post upgedatet - email möglich - trigger sollte funktionieren - name dabei

                    Ok, Danke. km werden nicht angezeigt?

                    liv-in-skyL Offline
                    liv-in-skyL Offline
                    liv-in-sky
                    schrieb am zuletzt editiert von liv-in-sky
                    #21

                    @sigi234

                    überhaupt nicht (tabelle)- oder im mail ? - was steht anstatt ? null oder nichts

                    zeig doch mal deine tabelle

                    nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

                    sigi234S 1 Antwort Letzte Antwort
                    0
                    • liv-in-skyL liv-in-sky

                      @sigi234

                      überhaupt nicht (tabelle)- oder im mail ? - was steht anstatt ? null oder nichts

                      zeig doch mal deine tabelle

                      sigi234S Online
                      sigi234S Online
                      sigi234
                      Forum Testing Most Active
                      schrieb am zuletzt editiert von sigi234
                      #22

                      @liv-in-sky sagte in JSON Tabelle FuelPriceMonitor [Austria]:

                      @sigi234

                      überhaupt nicht (tabelle)- oder im mail ? - was steht anstatt ? null oder nichts

                      beides

                      Turmöl - Preis: 1.667 - Distanz: NaN km

                      zeig doch mal deine tabelle

                      Screenshot (5319).jpg

                      Ev. liegt es am Komma?

                      Screenshot (5321).jpg

                      Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat.
                      Immer Daten sichern!

                      liv-in-skyL 1 Antwort Letzte Antwort
                      0
                      • sigi234S sigi234

                        @liv-in-sky sagte in JSON Tabelle FuelPriceMonitor [Austria]:

                        @sigi234

                        überhaupt nicht (tabelle)- oder im mail ? - was steht anstatt ? null oder nichts

                        beides

                        Turmöl - Preis: 1.667 - Distanz: NaN km

                        zeig doch mal deine tabelle

                        Screenshot (5319).jpg

                        Ev. liegt es am Komma?

                        Screenshot (5321).jpg

                        liv-in-skyL Offline
                        liv-in-skyL Offline
                        liv-in-sky
                        schrieb am zuletzt editiert von
                        #23

                        @sigi234 denke da hast du recht - könnte das komma sein - aber warum hast du da ein komma drin ? hast du die kommas auch im setting des adapters drin ?

                        nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

                        sigi234S 1 Antwort Letzte Antwort
                        0
                        • liv-in-skyL liv-in-sky

                          @sigi234 denke da hast du recht - könnte das komma sein - aber warum hast du da ein komma drin ? hast du die kommas auch im setting des adapters drin ?

                          sigi234S Online
                          sigi234S Online
                          sigi234
                          Forum Testing Most Active
                          schrieb am zuletzt editiert von
                          #24

                          @liv-in-sky sagte in JSON Tabelle FuelPriceMonitor [Austria]:

                          @sigi234 denke da hast du recht - könnte das komma sein - aber warum hast du da ein komma drin ? hast du die kommas auch im setting des adapters drin ?

                          Hab es mal umgestellt, jetzt ist ein Punkt drinnen, aber keine km

                          Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat.
                          Immer Daten sichern!

                          liv-in-skyL 1 Antwort Letzte Antwort
                          0
                          • sigi234S sigi234

                            @liv-in-sky sagte in JSON Tabelle FuelPriceMonitor [Austria]:

                            @sigi234 denke da hast du recht - könnte das komma sein - aber warum hast du da ein komma drin ? hast du die kommas auch im setting des adapters drin ?

                            Hab es mal umgestellt, jetzt ist ein Punkt drinnen, aber keine km

                            liv-in-skyL Offline
                            liv-in-skyL Offline
                            liv-in-sky
                            schrieb am zuletzt editiert von
                            #25

                            @sigi234

                            was steht in diesen datenpunkten ? javascript.0.FUELPRICEMONITOR

                            richtige, mit punkt koordinaten oder überall das selbe oder nix ?

                            nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

                            sigi234S 1 Antwort Letzte Antwort
                            0
                            • liv-in-skyL liv-in-sky

                              @sigi234

                              was steht in diesen datenpunkten ? javascript.0.FUELPRICEMONITOR

                              richtige, mit punkt koordinaten oder überall das selbe oder nix ?

                              sigi234S Online
                              sigi234S Online
                              sigi234
                              Forum Testing Most Active
                              schrieb am zuletzt editiert von
                              #26

                              @liv-in-sky sagte in JSON Tabelle FuelPriceMonitor [Austria]:

                              @sigi234

                              was steht in diesen datenpunkten ? javascript.0.FUELPRICEMONITOR

                              richtige, mit punkt koordinaten oder überall das selbe oder nix ?

                              Screenshot (5324).jpg

                              Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat.
                              Immer Daten sichern!

                              liv-in-skyL 2 Antworten Letzte Antwort
                              0
                              • sigi234S sigi234

                                @liv-in-sky sagte in JSON Tabelle FuelPriceMonitor [Austria]:

                                @sigi234

                                was steht in diesen datenpunkten ? javascript.0.FUELPRICEMONITOR

                                richtige, mit punkt koordinaten oder überall das selbe oder nix ?

                                Screenshot (5324).jpg

                                liv-in-skyL Offline
                                liv-in-skyL Offline
                                liv-in-sky
                                schrieb am zuletzt editiert von liv-in-sky
                                #27

                                @sigi234 nicht gut

                                hast du in der instanz alles unten angeklickt ? bei additional settings - wenn nein, probier mal

                                Image 192.png

                                nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

                                1 Antwort Letzte Antwort
                                0
                                • sigi234S sigi234

                                  @liv-in-sky sagte in JSON Tabelle FuelPriceMonitor [Austria]:

                                  @sigi234

                                  was steht in diesen datenpunkten ? javascript.0.FUELPRICEMONITOR

                                  richtige, mit punkt koordinaten oder überall das selbe oder nix ?

                                  Screenshot (5324).jpg

                                  liv-in-skyL Offline
                                  liv-in-skyL Offline
                                  liv-in-sky
                                  schrieb am zuletzt editiert von
                                  #28

                                  @sigi234

                                  hast du solche ordner ? da hole ich die koordinaten

                                  Image 193.png

                                  nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

                                  sigi234S 1 Antwort Letzte Antwort
                                  0
                                  • liv-in-skyL liv-in-sky

                                    @sigi234

                                    hast du solche ordner ? da hole ich die koordinaten

                                    Image 193.png

                                    sigi234S Online
                                    sigi234S Online
                                    sigi234
                                    Forum Testing Most Active
                                    schrieb am zuletzt editiert von
                                    #29

                                    @liv-in-sky sagte in JSON Tabelle FuelPriceMonitor [Austria]:

                                    hast du solche ordner ? da hole ich die koordinaten

                                    Jetzt sind sie da. :+1:

                                    Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat.
                                    Immer Daten sichern!

                                    liv-in-skyL 1 Antwort Letzte Antwort
                                    0
                                    • sigi234S sigi234

                                      @liv-in-sky sagte in JSON Tabelle FuelPriceMonitor [Austria]:

                                      hast du solche ordner ? da hole ich die koordinaten

                                      Jetzt sind sie da. :+1:

                                      liv-in-skyL Offline
                                      liv-in-skyL Offline
                                      liv-in-sky
                                      schrieb am zuletzt editiert von
                                      #30

                                      @sigi234 waren das die settings - dann muss ich das in der beschreibung noch reinsetzen

                                      nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

                                      sigi234S 1 Antwort Letzte Antwort
                                      0
                                      • liv-in-skyL liv-in-sky

                                        @sigi234 waren das die settings - dann muss ich das in der beschreibung noch reinsetzen

                                        sigi234S Online
                                        sigi234S Online
                                        sigi234
                                        Forum Testing Most Active
                                        schrieb am zuletzt editiert von sigi234
                                        #31

                                        @liv-in-sky sagte in JSON Tabelle FuelPriceMonitor [Austria]:

                                        @sigi234 waren das die settings - dann muss ich das in der beschreibung noch reinsetzen

                                        Glaube nicht, hatte keine Tankstelle im Adapter nur die Home, dachte die holt er sowieso.

                                        Wie oft wird die Mail abgerufen? Kann man das wo einstellen?

                                        Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat.
                                        Immer Daten sichern!

                                        liv-in-skyL 1 Antwort Letzte Antwort
                                        0
                                        • sigi234S sigi234

                                          @liv-in-sky sagte in JSON Tabelle FuelPriceMonitor [Austria]:

                                          @sigi234 waren das die settings - dann muss ich das in der beschreibung noch reinsetzen

                                          Glaube nicht, hatte keine Tankstelle im Adapter nur die Home, dachte die holt er sowieso.

                                          Wie oft wird die Mail abgerufen? Kann man das wo einstellen?

                                          liv-in-skyL Offline
                                          liv-in-skyL Offline
                                          liv-in-sky
                                          schrieb am zuletzt editiert von
                                          #32

                                          @sigi234

                                          eigentlich kommt die, wenn es in den anzuzeigenden stellen eine änderung gibt - das kann bei jedem update der daten sein - standard ist 20 minuten im adapter

                                          ich weiß, dass ist oft - also die instanz einstellen auf jede stunde - oder wir machen auch einen dp, mit dem inhalt der mail und du rufst das von hand auf und sendest dir dann eine mail bei bedarf

                                          nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

                                          sigi234S 1 Antwort Letzte Antwort
                                          0
                                          Antworten
                                          • In einem neuen Thema antworten
                                          Anmelden zum Antworten
                                          • Älteste zuerst
                                          • Neuste zuerst
                                          • Meiste Stimmen


                                          Support us

                                          ioBroker
                                          Community Adapters
                                          Donate

                                          389

                                          Online

                                          32.4k

                                          Benutzer

                                          81.5k

                                          Themen

                                          1.3m

                                          Beiträge
                                          Community
                                          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                                          ioBroker Community 2014-2025
                                          logo
                                          • Anmelden

                                          • Du hast noch kein Konto? Registrieren

                                          • Anmelden oder registrieren, um zu suchen
                                          • Erster Beitrag
                                            Letzter Beitrag
                                          0
                                          • Home
                                          • Aktuell
                                          • Tags
                                          • Ungelesen 0
                                          • Kategorien
                                          • Unreplied
                                          • Beliebt
                                          • GitHub
                                          • Docu
                                          • Hilfe