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.1k

  • 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

    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

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

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

    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

    :+1:

    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;
      }
      

      P Offline
      P Offline
      papaechokilo
      schrieb am zuletzt editiert von
      #34

      @liv-in-sky Hallo, danke für die tolle Arbeit. Im Script ist die Tankstelle ENI dem Bild von BP zugeordnet, obwohl ein Bild ENI existiert.

      liv-in-skyL 1 Antwort Letzte Antwort
      0
      • P papaechokilo

        @liv-in-sky Hallo, danke für die tolle Arbeit. Im Script ist die Tankstelle ENI dem Bild von BP zugeordnet, obwohl ein Bild ENI existiert.

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

        @papaechokilo danke - habe es ausgebessert
        @sigi234 es werden jetzt die emails auch in einen datenpunkt geschrieben - somit kannst du es anfordern, wenn du es brauchst

        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 P 2 Antworten Letzte Antwort
        1
        • liv-in-skyL liv-in-sky

          @papaechokilo danke - habe es ausgebessert
          @sigi234 es werden jetzt die emails auch in einen datenpunkt geschrieben - somit kannst du es anfordern, wenn du es brauchst

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

          @liv-in-sky

          Hallo, bitte iQ Tankstelle einbinden.

          IQ.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

            Hallo, bitte iQ Tankstelle einbinden.

            IQ.jpg

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

            @sigi234

            diese zeile -

            {"firma":"IQ","pic":"/vis.0/Tankstellen/iq.jpg"},
            

            einfügen

            Image 196.png
            und bild hohladen - - ich mach das dann im ersten post noch

            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

              diese zeile -

              {"firma":"IQ","pic":"/vis.0/Tankstellen/iq.jpg"},
              

              einfügen

              Image 196.png
              und bild hohladen - - ich mach das dann im ersten post noch

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

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

              und bild hohladen - - ich mach das dann im ersten post noch

              Erledigt.

              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
                #39

                @liv-in-sky
                Ich weis du bastelst noch daran, aber ich wollt bissl spiele/testen.
                Habe mal alle DP aus dem FUELPRICE gelöscht und die Instanz neu gestartet.
                Jetzt habe ich eigentlich überall auch Koordinaten.
                Jedoch ein Phänomen habe ich , das bei der ersten Tankstelle diese nicht in der Karte angezeigt wird, obwohl Koordinaten und Km Entfernung vorhanden.
                Egal ob SUP oder DIE.
                Eine Idee wieso?

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

                  @liv-in-sky
                  Ich weis du bastelst noch daran, aber ich wollt bissl spiele/testen.
                  Habe mal alle DP aus dem FUELPRICE gelöscht und die Instanz neu gestartet.
                  Jetzt habe ich eigentlich überall auch Koordinaten.
                  Jedoch ein Phänomen habe ich , das bei der ersten Tankstelle diese nicht in der Karte angezeigt wird, obwohl Koordinaten und Km Entfernung vorhanden.
                  Egal ob SUP oder DIE.
                  Eine Idee wieso?

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

                  @mrfloppy wenn in den orginal daten die location fehlt, werden deine home koordinaten eingetragen - damit versteckt sich evtl die erste tankstelle hinter dem home-icon inder karte - das home icon ist im widget ls letztes eingetragen und liegt drüber

                  du mußt prüfen, ob die erste tankstelle richtige koordinaten hat in den instanz datenpunkten

                  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
                    Ich weis du bastelst noch daran, aber ich wollt bissl spiele/testen.
                    Habe mal alle DP aus dem FUELPRICE gelöscht und die Instanz neu gestartet.
                    Jetzt habe ich eigentlich überall auch Koordinaten.
                    Jedoch ein Phänomen habe ich , das bei der ersten Tankstelle diese nicht in der Karte angezeigt wird, obwohl Koordinaten und Km Entfernung vorhanden.
                    Egal ob SUP oder DIE.
                    Eine Idee wieso?

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

                    @mrfloppy du kannst auch im vis Editor mal das erste Icon großer machen und sehen ob es irgendwo dahinter ist

                    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

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

                      @mrfloppy du kannst auch im vis Editor mal das erste Icon großer machen und sehen ob es irgendwo dahinter ist

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

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

                      @mrfloppy du kannst auch im vis Editor mal das erste Icon großer machen und sehen ob es irgendwo dahinter ist

                      thx für den Tip. da waren zwei punkte so knapp nebeneinander das man erst weit reinzoomen musste.

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

                        @papaechokilo danke - habe es ausgebessert
                        @sigi234 es werden jetzt die emails auch in einen datenpunkt geschrieben - somit kannst du es anfordern, wenn du es brauchst

                        P Offline
                        P Offline
                        papaechokilo
                        schrieb am zuletzt editiert von papaechokilo
                        #43

                        [gelöst] @liv-in-sky Danke!
                        Hallo, ich möchte kein Telegram verwenden, da mir die Darstellung in der VIS ausreicht. Wenn ich wie angegeben, in Zeile 4 "let telegramInstanz=""; " eintrage, erhalte ich eine Fehlermeldung.
                        10:34:57.814 error javascript.0 (1918593) script.js.common.Datenimport.Treibstoff_NEU: Error: No instanceName provided or not a string
                        10:34:57.815 error javascript.0 (1918593) at deletetext (script.js.common.Datenimport.Treibstoff_NEU:236:7)
                        10:34:57.815 error javascript.0 (1918593) at delTel (script.js.common.Datenimport.Treibstoff_NEU:55:91)

                        sigi234S 1 Antwort Letzte Antwort
                        0
                        • P papaechokilo

                          [gelöst] @liv-in-sky Danke!
                          Hallo, ich möchte kein Telegram verwenden, da mir die Darstellung in der VIS ausreicht. Wenn ich wie angegeben, in Zeile 4 "let telegramInstanz=""; " eintrage, erhalte ich eine Fehlermeldung.
                          10:34:57.814 error javascript.0 (1918593) script.js.common.Datenimport.Treibstoff_NEU: Error: No instanceName provided or not a string
                          10:34:57.815 error javascript.0 (1918593) at deletetext (script.js.common.Datenimport.Treibstoff_NEU:236:7)
                          10:34:57.815 error javascript.0 (1918593) at delTel (script.js.common.Datenimport.Treibstoff_NEU:55:91)

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

                          @papaechokilo

                          let telegramInstanz="";
                          
                          

                          @papaechokilo sagte in JSON Tabelle FuelPriceMonitor [Austria]:

                          in Zeile 4 "let telegramInstanz=""; "

                          " zu viel

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

                          P 1 Antwort Letzte Antwort
                          0
                          • sigi234S sigi234

                            @papaechokilo

                            let telegramInstanz="";
                            
                            

                            @papaechokilo sagte in JSON Tabelle FuelPriceMonitor [Austria]:

                            in Zeile 4 "let telegramInstanz=""; "

                            " zu viel

                            P Offline
                            P Offline
                            papaechokilo
                            schrieb am zuletzt editiert von papaechokilo
                            #45

                            [gelöst]@sigi234 ja, stimmt. aber auch wenn ich es so eintrage let telgramInstanz=""; kommt derselbe Fehler. Weil in Zeile 236 sendTo(telegramInstanz, { steht und das kann nicht ausgeführt werden.

                            sigi234S liv-in-skyL 2 Antworten Letzte Antwort
                            0
                            • P papaechokilo

                              [gelöst]@sigi234 ja, stimmt. aber auch wenn ich es so eintrage let telgramInstanz=""; kommt derselbe Fehler. Weil in Zeile 236 sendTo(telegramInstanz, { steht und das kann nicht ausgeführt werden.

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

                              @papaechokilo sagte in JSON Tabelle FuelPriceMonitor [Austria]:

                              @sigi234 ja, stimmt. aber auch wenn ich es so eintrage let telgramInstanz=""; kommt derselbe Fehler. Weil in Zeile 236 sendTo(telegramInstanz, { steht und das kann nicht ausgeführt werden.

                              Zeig mal das Skript bis Zeile 35

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

                              P 1 Antwort Letzte Antwort
                              0
                              • sigi234S sigi234

                                @papaechokilo sagte in JSON Tabelle FuelPriceMonitor [Austria]:

                                @sigi234 ja, stimmt. aber auch wenn ich es so eintrage let telgramInstanz=""; kommt derselbe Fehler. Weil in Zeile 236 sendTo(telegramInstanz, { steht und das kann nicht ausgeführt werden.

                                Zeig mal das Skript bis Zeile 35

                                P Offline
                                P Offline
                                papaechokilo
                                schrieb am zuletzt editiert von papaechokilo
                                #47

                                [gelöst]@sigi234

                                let anzahlAnzeige=30;
                                let mySprit=["DIE"]; //oder ["GAS","DIE","SUP"] je nachdem, was man braucht
                                let telegramInstanz="";  // 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.427656" //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":"bft","pic":"/vis.0/Tankstellen/bft.png"},
                                               {"firma":"Spritkönig","pic":"/vis.0/Tankstellen/Spritkönig.png"},
                                               {"firma":"Oil","pic":"/vis.0/Tankstellen/Oil.png"},
                                               {"firma":"Lagerhaus","pic":"/vis.0/Tankstellen/Lagerhaus.png"},
                                               {"firma":"Gelbmann","pic":"/vis.0/Tankstellen/Gelbmann.png"},
                                               {"firma":"IQ","pic":"/vis.0/Tankstellen/IQ.jpg"}
                                              ]
                                
                                code_text
                                
                                sigi234S 1 Antwort Letzte Antwort
                                0
                                • P papaechokilo

                                  [gelöst]@sigi234 ja, stimmt. aber auch wenn ich es so eintrage let telgramInstanz=""; kommt derselbe Fehler. Weil in Zeile 236 sendTo(telegramInstanz, { steht und das kann nicht ausgeführt werden.

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

                                  @papaechokilo

                                  du hast recht - habe ich nachträglich eingefügt und die abfrage vergessen - das einfügen:

                                  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 !!
                                  }}}
                                  

                                  der teil gehört hier hin/ausgetauscht:

                                  Image 197.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
                                  • P papaechokilo

                                    [gelöst]@sigi234

                                    let anzahlAnzeige=30;
                                    let mySprit=["DIE"]; //oder ["GAS","DIE","SUP"] je nachdem, was man braucht
                                    let telegramInstanz="";  // 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.427656" //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":"bft","pic":"/vis.0/Tankstellen/bft.png"},
                                                   {"firma":"Spritkönig","pic":"/vis.0/Tankstellen/Spritkönig.png"},
                                                   {"firma":"Oil","pic":"/vis.0/Tankstellen/Oil.png"},
                                                   {"firma":"Lagerhaus","pic":"/vis.0/Tankstellen/Lagerhaus.png"},
                                                   {"firma":"Gelbmann","pic":"/vis.0/Tankstellen/Gelbmann.png"},
                                                   {"firma":"IQ","pic":"/vis.0/Tankstellen/IQ.jpg"}
                                                  ]
                                    
                                    code_text
                                    
                                    sigi234S Online
                                    sigi234S Online
                                    sigi234
                                    Forum Testing Most Active
                                    schrieb am zuletzt editiert von sigi234
                                    #49

                                    @papaechokilo

                                    Zeile 3 Falsch

                                    let telegramInstanz="";  // wenn nicht genutzt:   let telegramInstanz="";
                                    

                                    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
                                      #50

                                      @liv-in-sky
                                      Ichhabe noch immer ein paar tanken die tageweise keine KM anzeigen.
                                      Gestern hatte sie aber noch eine Km anzeige.
                                      Und in den Objecten unter der ID ist auch eine locatin drinnen.
                                      Eine Idee was das sein könnte?

                                      LG

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

                                        @liv-in-sky
                                        Ichhabe noch immer ein paar tanken die tageweise keine KM anzeigen.
                                        Gestern hatte sie aber noch eine Km anzeige.
                                        Und in den Objecten unter der ID ist auch eine locatin drinnen.
                                        Eine Idee was das sein könnte?

                                        LG

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

                                        @mrfloppy kannst du mir mal ein bild deiner datenpunkte (ganzen tree) zeigen, mit den tanken, die keine km anzeige haben ?

                                        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
                                          Ichhabe noch immer ein paar tanken die tageweise keine KM anzeigen.
                                          Gestern hatte sie aber noch eine Km anzeige.
                                          Und in den Objecten unter der ID ist auch eine locatin drinnen.
                                          Eine Idee was das sein könnte?

                                          LG

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

                                          @mrfloppy ich meine die dp mit den location der tankstelle unter der instanz

                                          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

                                          M 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

                                          436

                                          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