Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. Müllkalender Reihenfolge ändern + Farbe

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    Müllkalender Reihenfolge ändern + Farbe

    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      tempestas @Nashra last edited by

      @Nashra

      Ich Frage mich, wieso man ein Skript nutzen will, um einen Kalender dargestellt zu bekommen?

      Nashra 1 Reply Last reply Reply Quote 0
      • Nashra
        Nashra Most Active Forum Testing @tempestas last edited by

        @tempestas sagte in Müllkalender Reihenfolge ändern + Farbe:

        @Nashra

        Ich Frage mich, wieso man ein Skript nutzen will, um einen Kalender dargestellt zu bekommen?

        Weil derGooglekalender/ical mir den Wochentag nicht mitliefert, sondern nur das Datum
        muelltonnen.PNG
        und mir kam nun mal die Idee mit dem vorangestellten Wochentag 😉

        sigi234 1 Reply Last reply Reply Quote 0
        • sigi234
          sigi234 Forum Testing Most Active @Nashra last edited by

          @Nashra

          Ich mache es so:

          Screenshot (2695)_LI.jpg

          Nashra 1 Reply Last reply Reply Quote 0
          • Nashra
            Nashra Most Active Forum Testing @sigi234 last edited by

            @sigi234 sagte in Müllkalender Reihenfolge ändern + Farbe:

            @Nashra

            Ich mache es so:

            Hatte ich zuerst auch, aber mir gefiel das nicht 😉

            1 Reply Last reply Reply Quote 0
            • J
              jwerlsdf @Torsten_MG last edited by

              Hallo,
              bei mir geht leider das Skript nicht. Es gibt immer einen Fehlercode

              javascript.0 (2704) script.js.muell compile failed: at script.js.muell:79
              --> das wäre dieser Code: inhaltStringReplace=inhaltStringReplace.replace(/

              // TESTSKRIPT FÜR NOXX
              
              // Annahme ist, dass jede Müllart mindestens einmal im Monat abgeholt wird. Nicht getestet und eventuell problematisch ist es, wenn Müll seltener abgeholt wird.
              
              // Ursprung: tempestas
              
              // Erweiterung: PicNic
              
              //debug in Log ausgeben
              
              debug = true;
              
              // "Heute" und "Morgen" statt wochentag ausgeben
              
              todaytomorrow = true;
              
              // Anlegen JS State für VIS 
              
              createState('javascript.0.muell.json', 0);
              
              // Array für Suchvariablen und Farbe des Müll-Icons
              
              var obj = { "Schwarze Tonne": "black", "Blaue Tonne": "lightblue", "Gelbe Tonne": "yellow", "Braune Tonne": "brown"};
              
              function muell(){  
              
              // Kalender auslesen (HTML Format)
              
                  // **************************************************************************************            
              
                  // Termine auswerten aus html. Bereinigung der HTML Tags und Konvertierung in Plain Text
              
                  // **************************************************************************************
              
                      var inhalt = getState("ical.0.data.html"/*HTML iCal table*/);           // an deinen eigenen Kalender anpassen
              
                      var inhaltString = inhalt.val.toString();
              
                      var inhaltStringReplace = inhaltString;
              
                      var inhaltStringText;
              
                      var i_search;
              
              {1}
              
                      // remove all inside SCRIPT and STYLE tags
              
                      inhaltStringReplace=inhaltStringReplace.replace(/<script.*>[\w\W]{1,}(.*?)[\w\W]{1,}<\/script>/gi, "");
              
                      inhaltStringReplace=inhaltStringReplace.replace(/<style.*>[\w\W]{1,}(.*?)[\w\W]{1,}<\/style>/gi, "");
              
              {1}
              
                      // remove BR tags
              
                      inhaltStringReplace=inhaltStringReplace.replace(/
              
              /gi, "");
              
                      inhaltStringReplace=inhaltStringReplace.replace(/<br\s\>/gi, "");
              
                      inhaltStringReplace=inhaltStringReplace.replace(/<br\>/gi, "");
              
               
              
                      // remove all else
              
                      inhaltStringReplace=inhaltStringReplace.replace(/<(?:.|\s)*?>/g, "");
              
               
              
                      // get rid of html-encoded characters:
              
                      inhaltStringReplace=inhaltStringReplace.replace(/ /gi," ");
              
                      inhaltStringReplace=inhaltStringReplace.replace(/&/gi,"&");
              
                      inhaltStringReplace=inhaltStringReplace.replace(/"/gi,'"');
              
                      inhaltStringReplace=inhaltStringReplace.replace(//gi,'>');
              
                      //inhaltStringReplace=inhaltStringReplace.replace(/→/gi,'');
              
                      if(debug) log(inhaltStringReplace);
              
              // n-ten Treffer finden 
              
                      function nthIndex(str, pat, n){
              
                      var L= str.length, i= -1;
              
                      while(n-- && i++ <l){ i="str.indexOf(pat," i);/if/(i/</0)/break;/}/i_search="i;" funktion/zum/tage/im/monat/zählen/function/daysinmonth(month,/year)/{/return/new/date(year,/month,/0).getdate();/wochentage/auf/deutsch/var/wochentag="['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'" ];/json/starten/muelljason="[" ;/schleife/zur/abarbeitung/des/arrays/object.keys(obj).foreach/(function/(val,/key)/","/trennung/der/daten/json./sollte/nur/eine/müllart/angegeben/sein,/dann/die/nächsten/drei/zewilen/auskommentieren/today="new" date();/(key="">0) {
              
              	muellJason += ",";  
              }
              
              var result = inhaltStringReplace.search (/→/gi);
              
              if(debug) log("Suchergebnis ist: "+result);
              
              var inhaltStringReplaceNeu
              
              if (result >= 0) {
              
              	inhaltStringReplaceNeu=inhaltStringReplace.replace(/→/gi,''); 
              
              	var muelltoday = 1;
              }
              
              else inhaltStringReplaceNeu=inhaltStringReplace;
              
              if(debug) log("Müll heute?: "+muelltoday);
              
              // Zuweisung der Farbe für das MüllIcon
              
              var iconColor = obj[val];
              
              var muellIcon = " <svg class="icon dustbin &quot;+iconColor+&quot;" data-txt="dustbin@&quot;+iconColor+&quot;" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.0" width="25" height="25" viewBox="0 0 468 468" id="svg2996"><metadata id="metadata2998"> Created by potrace 1.8, written by Peter Selinger 2001-2007 <rdf:rdf>   <cc:work rdf:about="">     <dc:format>image/svg+xml</dc:format>             </cc:work> </rdf:rdf> </metadata></svg> ";
              
              // Position bestimmen
              
              var pos = inhaltStringReplaceNeu.indexOf( val, 1);                    
              
              if(debug) log("pos ist: "+pos);
              
              var inhaltStringText = inhaltStringReplaceNeu.substring((pos-13),pos-1); 
              
              if(debug) log("Datum ist: "+inhaltStringText);
              
              nthIndex(inhaltStringText, ".", 1);
              
              var t_m = inhaltStringText.slice(0, i_search);
              
              var pos1 = i_search+1;
              
              if(debug) log("pos1: " +pos1 );
              
              if ((muelltoday == 1) && (pos < 25)) {
              
                  t_m = t_m-1;
              }
              
              nthIndex(inhaltStringText, ".", 2);
              
              var m_m = inhaltStringText.slice(pos1, i_search);
              
              var pos2 = i_search+1;
              
              if(debug) log("pos2: " +pos2 );
              
              var j_m = inhaltStringText.slice(pos2, inhaltStringText.len );
              
              // Datum des Abholtages setzen um den Wochentag zu ermitteln
              
              var muelldate = new Date(j_m,m_m-1,t_m)
              
              // Hier kommt der Wochentag :-)
              
              var d = muelldate.getDay();
              
              var muelldaydate = t_m +"." +m_m +"." +j_m;
              
              if(debug) log("Mülldate ist: "+wochentag[d]+", "+muelldate );
              
              if(debug) log("Mülltag ist: "+t_m +" , " +m_m +" , " +j_m);
              
              // Datum heute ermitteln
              
              if(debug) log(today);
              
                  //Tag ermitteln
              
                      var t = today.getDate();
              
                  // Wochentag ermitteln zum testen
              
                      var dd = today.getDay();
              
                   //Monat ermitteln
              
                      var m = today.getMonth()+1;
              
                  //Jahr ermitteln
              
                      var j = today.getFullYear();
              
                      if(debug) log("Datum heute ist: "+wochentag[dd]+", "+t+m+j);
              
              var muelltagout = wochentag[d];
              if (todaytomorrow) {
                  if (t==t_m) {
                      muelltagout = "Heute";
                  }
                  if (t==t_m-1) {
                      muelltagout = "Morgen";
                  }
              }
              // Berechnung Tagesdifferenzen
              
              var diff = 0;
              var dim = DaysInMonth(m, j);  // Tage des aktuellen Monats
              if(debug) log("Tage aktueller Monat: "+dim);
                  if(j_m > j || m_m > m) {            // Prüfung: Jahr_Müll größer als aktuelles Jahr? Relevant bei Jahreswechsel ODEr Monat Müll größer aktueller Monat?
                          diff = parseInt(dim) - parseInt(t) + parseInt(t_m);
                      }
                      else diff = parseInt(t_m) - parseInt(t);
                        if(debug) log("Tage bis zum nächsten Müll: "+diff);
              muellJason += "{\"Tag\":\""+muelltagout+"\",\"Datum\":\""+muelldaydate+"\",\"Ereignis\":\""+muellIcon+" "+val+"\",\"Tage\":\""+diff+"\"}";          
               });
              
              // json schließen
              
              muellJason += "]";
              
              // und hier nun die Werte eintragen
              
              setState('javascript.0.muell.json', muellJason); 
              
              log("Müllkalender aktualisiert!");
              }
              schedule("5 0 * * *", function(){ muell()});
              
              // bei Start
              
              muell();</l){></br\></br\s\></style.*></script.*>
              
              
              
              sigi234 Glasfaser 2 Replies Last reply Reply Quote 0
              • sigi234
                sigi234 Forum Testing Most Active @jwerlsdf last edited by

                @jwerlsdf

                Kennst du das?

                https://forum.iobroker.net/topic/27050/test-adapter-trashschedule-v0-0-x

                J 1 Reply Last reply Reply Quote 1
                • Glasfaser
                  Glasfaser @jwerlsdf last edited by

                  @jwerlsdf

                  Da sind ein haufen Fehler drin , ich denke mal durch das kopieren entstanden:

                  Nimm das :

                  // TESTSKRIPT FÜR NOXX
                  // Annahme ist, dass jede Müllart mindestens einmal im Monat abgeholt wird. Nicht getestet und eventuell problematisch ist es, wenn Müll seltener abgeholt wird. 
                  // Ursprung: tempestas
                  // Erweiterung: PicNic
                  
                  
                  
                  //debug in Log ausgeben
                  
                  
                  
                  debug = true;
                  
                  
                  
                  // "Heute" und "Morgen" statt wochentag ausgeben
                  
                  
                  
                  todaytomorrow = true;
                  
                  
                  
                  // Anlegen JS State für VIS 
                  
                  
                  
                  createState('javascript.0.muell.json', 0);
                  
                  
                  
                  // Array für Suchvariablen und Farbe des Müll-Icons
                  
                  
                  
                  var obj = { "Schwarze Tonne": "black", "Blaue Tonne": "lightblue", "Gelbe Tonne": "yellow", "Braune Tonne": "brown"};
                  
                  
                  
                  function muell(){  
                  
                  
                  
                  // Kalender auslesen (HTML Format)
                  
                     // **************************************************************************************            
                     // Termine auswerten aus html. Bereinigung der HTML Tags und Konvertierung in Plain Text
                     // **************************************************************************************
                     
                         var inhalt = getState("ical.0.data.html"/*HTML iCal table*/);           // an deinen eigenen Kalender anpassen
                         var inhaltString = inhalt.val.toString();
                         var inhaltStringReplace = inhaltString;
                         var inhaltStringText;
                         var i_search;
                         
                         // remove all inside SCRIPT and STYLE tags
                         inhaltStringReplace=inhaltStringReplace.replace(/<script.*>[\w\W]{1,}(.*?)[\w\W]{1,}<\/script>/gi, "");
                         inhaltStringReplace=inhaltStringReplace.replace(/<style.*>[\w\W]{1,}(.*?)[\w\W]{1,}<\/style>/gi, "");
                         
                         // remove BR tags
                         inhaltStringReplace=inhaltStringReplace.replace(/<br>/gi, "");
                         inhaltStringReplace=inhaltStringReplace.replace(/<br\s\/>/gi, "");
                         inhaltStringReplace=inhaltStringReplace.replace(/<br\/>/gi, "");
                         
                         
                         // remove all else
                         inhaltStringReplace=inhaltStringReplace.replace(/<(?:.|\s)*?>/g, "");
                         
                         // get rid of html-encoded characters:
                         inhaltStringReplace=inhaltStringReplace.replace(/&nbsp;/gi," ");
                         inhaltStringReplace=inhaltStringReplace.replace(/&/gi,"&");
                         inhaltStringReplace=inhaltStringReplace.replace(/"/gi,'"');
                         inhaltStringReplace=inhaltStringReplace.replace(/</gi,'<');
                         inhaltStringReplace=inhaltStringReplace.replace(/>/gi,'>');
                         
                         //inhaltStringReplace=inhaltStringReplace.replace(/&#8594;/gi,'');
                         
                         if(debug) log(inhaltStringReplace);
                  
                  
                  // n-ten Treffer finden 
                  
                         function nthIndex(str, pat, n){
                         var L= str.length, i= -1;
                         while(n-- && i++<L){
                         i= str.indexOf(pat, i);
                         if (i < 0) break;
                             }
                         i_search =i;
                         }
                  
                  
                  // Funktion zum Tage im Monat zählen
                  
                  function DaysInMonth(month, year) {
                   return new Date(year, month, 0).getDate();
                  }
                  
                  // Wochentage auf deutsch
                  var wochentag = ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag' ];        
                         
                  // json starten
                  
                  var muellJason = "[";
                  
                  // Schleife zur abarbeitung des Arrays
                  
                  Object.keys(obj).forEach (function (val, key) {
                     
                  // "," zur Trennung der Daten im json. Sollte nur eine Müllart angegeben sein, dann die nächsten drei Zewilen auskommentieren 
                  
                  var today = new Date();
                  
                  if (key > 0) {
                     muellJason += ",";  
                  }
                  
                  var result = inhaltStringReplace.search (/&#8594;/gi);
                  if(debug) log("Suchergebnis ist: "+result);
                  
                  var inhaltStringReplaceNeu
                  if (result >= 0) {
                     inhaltStringReplaceNeu=inhaltStringReplace.replace(/&#8594;/gi,''); 
                     var muelltoday = 1;
                  }
                  else inhaltStringReplaceNeu=inhaltStringReplace;
                  
                  if(debug) log("Müll heute?: "+muelltoday);
                  
                  // Zuweisung der Farbe für das MüllIcon
                  
                  var iconColor = obj[val];
                  
                  var muellIcon = "<svg class='icon dustbin "+iconColor+"' data-txt='dustbin@"+iconColor+"' xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:cc='http://creativecommons.org/ns#' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:svg='http://www.w3.org/2000/svg' xmlns='http://www.w3.org/2000/svg' version='1.0' width='16' height='22' viewBox='0 0 468 468' id='svg2996'>   <defs id='defs3012'></defs>   <metadata id='metadata2998'> Created by potrace 1.8, written by Peter Selinger 2001-2007 <rdf:rdf>   <cc:work rdf:about=''>     <dc:format>image/svg+xml</dc:format>     <dc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage'></dc:type>     <dc:title></dc:title>   </cc:work> </rdf:rdf> </metadata>   <g id='g4034'>     <path d='m 164.4375,33.5 -0.65625,0.5 c -11.90412,10.555196 -23.8852,21.057535 -35.5625,31.84375 l -42.96875,0 0,45.03125 32.53125,0 c 13.22891,144.12046 25.89883,288.31731 39.46875,432.40625 9.69723,-1.98889 14.32028,1.0964 11.875,11.25 -0.0426,5.85383 15.04324,3.26475 18.03125,1.90625 -1.00901,-8.73036 -0.93648,-16.37136 10,-13.15625 l 160.59375,0 c 11.75,21.80169 42.56231,29.31009 62.96875,15.375 21.08406,-12.69988 27.25053,-43.85545 12.3125,-63.5625 -4.86724,-6.92593 -11.82906,-12.31065 -19.625,-15.53125 C 424.62583,361.71176 435.86015,243.85237 447.0625,126 c 17.64215,-13.78222 35.02804,-27.886275 52.53125,-41.84375 2.89271,-4.893749 0.4348,-15.122493 1.25,-22.09375 C 499.08199,57.205782 490.09686,53.870651 485.5,49.25 477.99288,43.982667 470.74179,37.617596 462.6875,33.5 l -298.25,0 z m 4.875,9.84375 291.71875,0 29.25,21.71875 c 0.0119,0.927631 0.0533,1.871122 0.0937,2.8125 0.97639,2.449641 0.85027,5.167262 -0.0625,7.65625 -0.008,0.02111 -0.0234,0.04143 -0.0312,0.0625 -0.51888,3.777511 -2.14687,7.029761 -6.8125,8.8125 l -35.125,28.03125 c 1.46565,-4.97558 -1.85222,-15.895744 6.6875,-12.4375 5.5213,1.58262 12.19009,-2.324505 10.0625,-8.84375 l 0,-25.3125 -322.0625,0 c 8.86915,-7.223116 16.87852,-16.668979 26.28125,-22.5 z m -74.21875,32.34375 360.125,0 c 0.0306,7.712935 2.54733,17.927536 -8.75,14.3125 -94.29274,0.208114 -188.73115,-0.555861 -282.9375,0.40625 -10.1217,4.75269 -19.48313,13.27115 -31.6875,10.625 l -36.75,0 0,-25.34375 z m 76.21875,23.90625 c 89.41386,0.54853 178.87681,0.09252 268.3125,0.25 l -35.90625,377.0625 c -25.33113,-4.95041 -51.26051,16.10244 -51.8125,41.84375 -0.25348,4.95829 0.29336,9.94215 1.65625,14.6875 l -187.4375,0 C 153.39299,392.565 140.43379,251.46157 127.84375,110.71875 c 9.78849,0.51047 20.51309,1.63486 28.59375,-5.03125 4.67542,-2.69526 9.40925,-5.82151 14.875,-6.09375 z m 225.46875,394.1875 c 18.62221,-0.69263 32.74554,20.5547 24.875,37.5625 -6.27158,16.68124 -30.29909,21.99414 -43.03125,9.46875 -14.14991,-11.79435 -10.47964,-37.066 6.34375,-44.3125 3.56947,-1.79753 7.71804,-2.66409 11.8125,-2.71875 z m 0.90625,4.09375 c -0.57219,-0.006 -1.13342,-0.007 -1.71875,0.0312 -16.41246,0.0663 -27.63561,20.14594 -19.1875,34.15625 7.29551,15.03871 30.88174,16.07631 39.53125,1.78125 10.30823,-14.81695 -0.88704,-35.79663 -18.625,-35.96875 z' transform='scale(0.8,0.8)' id='rect3852' style='font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:"+iconColor+";fill-opacity:1;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans'></path>     <path d='m 187.04414,86.30422 c 0,9.25 0,18.5 0,27.75 8.8657,2.63653 8.20074,-4.2576 7.6875,-11 -0.88762,-6.981373 -0.63624,-12.823742 8,-10.28125 20.07292,0 40.14583,0 60.21875,0 0,7.09375 0,14.1875 0,21.28125 8.85532,2.63657 8.1552,-4.2823 7.65625,-11 0,-6.25 0,-12.5 0,-18.75 -27.85417,0 -55.70833,0 -83.5625,0 l 0,1 0,1 z' id='rect3774' style='fill:"+iconColor+";stroke:none'></path>     <path d='m 246.10957,299.44346 c -1.20162,-1.79184 -13.13138,-21.89781 -13.13138,-22.13113 0,-0.35582 13.19507,-22.47629 13.40732,-22.47629 0.0834,0 0.15176,1.8904 0.15176,4.20087 0,3.3822 0.0542,4.24584 0.27806,4.43164 0.20925,0.17367 3.98995,0.2127 15.27853,0.15776 16.67177,-0.0812 16.14352,-0.0414 19.20743,-1.44518 0.8007,-0.36686 1.48668,-0.63616 1.52438,-0.59845 0.0377,0.0376 -3.37966,6.0737 -7.59414,13.41331 -8.38933,14.61019 -8.4627,14.71679 -10.76008,15.63297 -1.10265,0.43974 -1.35427,0.45449 -9.48432,0.55557 l -8.35161,0.10384 -0.0983,4.32318 c -0.0938,4.12593 -0.11328,4.30077 -0.4277,3.83191 z M 199.67,291.00079 c -4.86935,-0.56611 -9.27834,-4.18932 -10.83763,-8.90616 -0.44559,-1.34793 -0.53544,-1.97083 -0.54455,-3.77582 -0.0116,-2.29823 0.2835,-3.7894 1.19284,-6.02732 0.46366,-1.14109 3.87189,-7.36721 4.63457,-8.46641 l 0.37581,-0.54163 14.87125,0.0503 14.87127,0.0505 0,13.85387 0,13.85384 -11.69225,0.023 c -6.43074,0.0126 -12.22283,-0.0387 -12.87131,-0.11407 z m -23.07415,-26.65794 c -4.26057,-7.32993 -7.85812,-13.68348 -7.99458,-14.11897 -0.13644,-0.43549 -0.26416,-0.65918 -0.28383,-0.49707 -0.0196,0.16213 -0.10891,-0.059 -0.19835,-0.49126 -0.15929,-0.76999 -0.0105,-3.00897 0.16506,-2.48491 0.049,0.14642 0.2357,-0.16309 0.41472,-0.68778 0.17905,-0.52469 2.07284,-4.01176 4.20845,-7.74905 2.16788,-3.79378 3.8342,-6.91841 3.77264,-7.07431 -0.0607,-0.15358 -1.69732,-1.16352 -3.63704,-2.24431 -1.93972,-1.08081 -3.52906,-2.01786 -3.53187,-2.08233 -0.006,-0.14378 6.57047,-0.32902 17.79578,-0.50119 l 8.46674,-0.12987 6.34867,11.43236 c 3.49178,6.28779 6.29992,11.48113 6.24029,11.54073 -0.0595,0.0596 -1.75689,-0.84191 -3.77175,-2.0034 -3.60051,-2.07556 -3.66963,-2.10532 -4.02824,-1.73419 -0.55658,0.576 -13.94131,23.77568 -14.57267,25.25872 -0.72354,1.69955 -1.30968,3.87178 -1.49707,5.54808 l -0.15045,1.34592 -7.7465,-13.32717 z m 89.07588,-4.62263 c -0.0943,-0.14587 -3.45377,-5.92489 -7.46554,-12.84227 -5.41735,-9.34093 -7.23758,-12.63501 -7.07431,-12.80239 0.32833,-0.33656 23.31915,-13.43198 23.58171,-13.43198 0.12427,0 2.80048,4.44354 5.94713,9.87454 6.55474,11.31331 6.28956,10.82629 6.84861,12.57752 0.23306,0.73009 0.47242,1.27876 0.53191,1.21928 0.0595,-0.0595 0.17091,0.47802 0.24763,1.19443 0.15098,1.40997 -0.0334,3.68719 -0.28604,3.53111 -0.0857,-0.0529 -0.21682,0.23461 -0.29152,0.63896 -0.20892,1.13073 -1.51188,3.74177 -2.5523,5.11465 -1.72548,2.27683 -4.04472,3.812 -6.95568,4.60419 -1.30162,0.35423 -2.22633,0.42067 -6.9311,0.49796 -4.41554,0.0725 -5.4611,0.0397 -5.6005,-0.176 z m -65.31395,-41.16649 c -6.43074,-3.73488 -11.79495,-6.89275 -11.92048,-7.01749 -0.17303,-0.17195 1.23227,-2.74644 5.80886,-10.64177 5.70419,-9.84062 6.1237,-10.50386 7.60749,-12.02734 1.69965,-1.74509 3.33189,-2.69357 5.66885,-3.29412 1.5163,-0.38964 4.92245,-0.38707 6.59088,0.005 2.75547,0.6475 5.41411,2.44797 7.33993,4.97072 1.44033,1.88674 5.4911,8.82551 5.38626,9.22639 -0.0949,0.3629 -14.05668,24.59974 -14.5365,25.23452 -0.22908,0.30307 -1.35989,-0.30809 -11.94529,-6.45591 z m 42.05556,0.69155 c -5.0242,-0.0857 -9.39897,-0.18194 -9.7217,-0.2139 -0.50316,-0.0498 -0.0694,-0.35226 3.04313,-2.12147 3.19994,-1.81891 3.62944,-2.12152 3.62568,-2.55461 -0.004,-0.48586 -12.4336,-22.33433 -14.25345,-25.05483 -1.51468,-2.26428 -4.79833,-5.20178 -5.82449,-5.21048 -0.19508,-0.002 -0.48732,-0.0888 -0.64944,-0.1935 -0.35402,-0.22879 30.37826,-0.23669 32.03088,-0.008 0.59443,0.0822 0.94816,0.16475 0.78603,0.18349 -0.16212,0.0187 0.16507,0.19299 0.72711,0.38718 1.41989,0.49063 2.52157,1.30409 3.21461,2.37365 0.32406,0.5001 2.2456,3.7269 4.27007,7.17065 2.02447,3.44374 3.81896,6.34847 3.98778,6.45495 0.23503,0.14827 1.10892,-0.2796 3.73171,-1.82705 1.88363,-1.11135 3.50616,-2.06607 3.60559,-2.1216 0.34795,-0.19432 -0.14612,0.72795 -6.3232,11.80315 l -6.21981,11.15185 -3.4478,-0.0317 c -1.8963,-0.0174 -7.55851,-0.10189 -12.5827,-0.18752 z' id='path3042-4-0' style='fill:"+iconColor+"'></path>     <path d='m 379.767,65.367302 c -2.27366,-0.78034 -4.41606,-2.93783 -4.76517,-4.79874 -0.71345,-3.803 0.7568,-7.29316 3.71819,-8.82643 3.16358,-1.63796 7.60799,-0.409 9.60852,2.65692 1.81887,2.78753 1.47864,5.94628 -0.93596,8.68941 -2.3772,2.70063 -4.52579,3.34272 -7.62558,2.27884 z' id='path4011' style='fill:"+iconColor+";fill-opacity:1;stroke:none'></path>   </g> </svg>";
                  
                  // Position bestimmen
                  
                  var pos = inhaltStringReplaceNeu.indexOf( val, 1);                    
                  if(debug) log("pos ist: "+pos);
                  
                  var inhaltStringText = inhaltStringReplaceNeu.substring((pos-13),pos-1); 
                  if(debug) log("Datum ist: "+inhaltStringText);
                  
                  
                  nthIndex(inhaltStringText, ".", 1);
                  var t_m = inhaltStringText.slice(0, i_search);
                  var pos1 = i_search+1;
                  if(debug) log("pos1: " +pos1 );
                  
                  if ((muelltoday == 1) && (pos < 25)) {
                     t_m = t_m-1;
                  }
                  
                  nthIndex(inhaltStringText, ".", 2);
                  var m_m = inhaltStringText.slice(pos1, i_search);
                  var pos2 = i_search+1;
                  if(debug) log("pos2: " +pos2 );
                  
                  
                  var j_m = inhaltStringText.slice(pos2, inhaltStringText.len );
                  
                  // Datum des Abholtages setzen um den Wochentag zu ermitteln
                  var muelldate = new Date(j_m,m_m-1,t_m)
                  
                  // Hier kommt der Wochentag :-)
                  
                  var d = muelldate.getDay();
                  var muelldaydate = t_m +"." +m_m +"." +j_m;
                  
                  if(debug) log("Mülldate ist: "+wochentag[d]+", "+muelldate );
                  if(debug) log("Mülltag ist: "+t_m +" , " +m_m +" , " +j_m);
                  
                  
                  
                  
                  // Datum heute ermitteln
                  
                  if(debug) log(today);
                  
                     //Tag ermitteln
                         var t = today.getDate();
                         
                     // Wochentag ermitteln zum testen
                         var dd = today.getDay();
                  
                     //Monat ermitteln
                  
                         var m = today.getMonth()+1;
                  
                     //Jahr ermitteln
                         var j = today.getFullYear();
                         
                         if(debug) log("Datum heute ist: "+wochentag[dd]+", "+t+m+j);
                         
                  var muelltagout = wochentag[d];
                  
                  if (todaytomorrow) {
                     if (t==t_m) {
                         muelltagout = "Heute";
                     }
                     if (t==t_m-1) {
                         muelltagout = "Morgen";
                     }
                  }
                         
                  // Berechnung Tagesdifferenzen
                  
                  var diff = 0;
                  var dim = DaysInMonth(m, j);  // Tage des aktuellen Monats
                  if(debug) log("Tage aktueller Monat: "+dim);
                  
                  
                     if(j_m > j || m_m > m) {            // Prüfung: Jahr_Müll größer als aktuelles Jahr? Relevant bei Jahreswechsel ODEr Monat Müll größer aktueller Monat?
                             
                             diff = parseInt(dim) - parseInt(t) + parseInt(t_m);
                           
                         }
                         else diff = parseInt(t_m) - parseInt(t);
                         
                           if(debug) log("Tage bis zum nächsten Müll: "+diff);
                           
                     
                  muellJason += "{\"Tag\":\""+muelltagout+"\",\"Datum\":\""+muelldaydate+"\",\"Ereignis\":\""+muellIcon+" "+val+"\",\"Tage\":\""+diff+"\"}";          
                  
                  });
                  
                  // json schließen
                  
                  muellJason += "]";
                  
                  // und hier nun die Werte eintragen
                  
                  setState('javascript.0.muell.json', muellJason); 
                  
                  log("Müllkalender aktualisiert!");
                  
                  }
                  
                  schedule("5 0 * * *", function(){ muell()});
                  
                  // bei Start
                  
                  muell();
                  

                  J 1 Reply Last reply Reply Quote 0
                  • J
                    jwerlsdf @Glasfaser last edited by jwerlsdf

                    @Glasfaser
                    vielen Dank schon einmal. Jetzt scheint kein Fehler drinnen zu sein. Jedoch erhalte ich in der Oberfläche solch ein Aussehen:
                    55a668e2-ed43-40cd-8860-d47eaee1ab1d-grafik.png

                    Würdest du mir noch bitte einmal die Korrektur als Text-Datei zusenden? habe da schon wieder so viele Leerzeilen

                    Glasfaser 1 Reply Last reply Reply Quote 0
                    • J
                      jwerlsdf @sigi234 last edited by

                      @sigi234
                      ich habe es kurz gesehen. Bin aber erst einmal hier geblieben, da die Einstellungen/ Aussehen genau so waren, wie ich es mir vorgestellt habe.
                      Wo wäre denn bei diesem widget denn der Unterschied? Und ist es nicht eine weitere "Belastung" für den Raspi (Ram), wenn ich ein weiteres Programm installiere? Habe ja schon javascript für ein anderes Programm...

                      1 Reply Last reply Reply Quote 0
                      • Glasfaser
                        Glasfaser @jwerlsdf last edited by

                        @jwerlsdf

                        Hast du die Daten im Skript auf dein ICAL Eintrag geändert ,die in deinem Google Kalender vorhanden sind !?

                        2.JPG

                        Hier ein Widget , ( Voraussetzung Adapter Material Design Widgets )

                        [{"tpl":"tplVis-materialdesign-Table","data":{"oid":"javascript.0.muell.json","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","countCols":"3","tableLayout":"standard","showHeader":"true","headerTextSize":"16px","showColumn0":"true","colType0":"text","textAlign0":"right","showColumn1":"true","colType1":"text","textAlign1":"center","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,"showColumn2":"true","colType2":"text","textAlign2":"center","showColumn3":"true","colType3":"text","textAlign3":"center","showColumn4":"true","colType4":"text","textAlign4":"center","showColumn5":"true","colType5":"text","textAlign5":"center","label0":" ","label1":"Nächste Leerung<br><em style=\"font-size: 14px\">(in Tagen)</em>","label2":"Nächste Leerung","colorBackground":"transparent","fontFamily0":"RobotoCondensed-Light","fontFamily1":"RobotoCondensed-Light","fontFamily2":"RobotoCondensed-Light","colTextColor2":"#ffffff","colTextColor1":"#ffffff","colTextColor0":"#ffffff","colorHeaderRowText":"#ffffff","headerFontFamily":"RobotoCondensed-Bold","colTextSize0":"16px","colTextSize1":"16px","colTextSize2":"16px","colNoWrap0":false,"dividers":"transparent","columnWidth0":"100","colTextColor3":"#ffffff","label3":"Tage"},"style":{"left":"93px","top":"405px","width":"628px","height":"165px"},"widgetSet":"materialdesign"}]
                        

                        3.JPG

                        oder
                        so ein Widget wie du schon hast , nur etwas angepasst :

                        [{"tpl":"tplTableBody","data":{"g_fixed":true,"g_visibility":false,"g_css_font_text":true,"g_css_background":true,"g_css_shadow_padding":true,"g_css_border":true,"g_gestures":false,"g_signals":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","static_value":"[{\"Title\": \"first\", \"Value\": 1, \"_Description\": \"Value1\"}, {\"Title\": \"second\", \"Value\": 2, \"_Description\": \"Value2\"}]","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,"table_oid":"javascript.0.muell.json","name":"Mülltabelle","colCount":"4","detailed_wid":"w00597","colWidth1":"510px","colWidth2":"310px","hide_header":true,"show_scroll":false,"colName1":"Tag","colName2":"Datum","colName3":"Ereignis","colName4":"Tage","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,"colWidth3":"8411px","colWidth4":"16px","class":"mdui-table-striped","colAttr1":"Tag","new_on_top":true,"colAttr2":"Datum","colAttr3":"Ereignis","colAttr4":"Tage","colAttr5":"pid","colName5":"PID","colWidth5":"80px","colAttr6":"vmem","max_rows":"4"},"style":{"left":"282px","top":"55px","width":"302px","height":"100px","overflow-y":"","font-size":"13px","overflow-x":"","font-family":"Jura-DemiBold","text-shadow":"","color":"","font-weight":"","line-height":"3.7","background":"#303030","background-color":"#303030","background-repeat":"","font-style":"normal","text-align":"","font-variant":"normal","word-spacing":"","background-attachment":"","z-index":"1","letter-spacing":"","border-width":"0px","border-style":"inset","border-color":"gray","transform":"","border-radius":"11px"},"widgetSet":"basic"},{"tpl":"tplValueString","data":{"oid":"","g_fixed":true,"g_visibility":false,"g_css_font_text":true,"g_css_background":true,"g_css_shadow_padding":false,"g_css_border":true,"g_gestures":false,"g_signals":false,"g_last_change":false,"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,"name":"Mülltabelle Trennstrich","comment":"","visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","html_prepend":""},"style":{"left":"281px","top":"104px","width":"300px","height":"0px","color":"#e6e6e6","font-family":"Jura-DemiBold","font-weight":"","font-size":"14px","background-color":"","text-align":"center","z-index":"10","background":"#303030","border-radius":"1px","line-height":"25px","font-style":"normal","font-variant":"normal","border-color":"gray","border-style":"inset","border-width":"2px"},"widgetSet":"basic"}]
                        


                        4.JPG

                        J 1 Reply Last reply Reply Quote 0
                        • J
                          jwerlsdf @Glasfaser last edited by

                          @Glasfaser
                          weiß leider nicht wo der Fehler lag. Habe jetzt den adapter TrashSchedule genommen. Dieser funktioniert so wie erhofft. Trotzdem danke für deine Hilfe!

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post

                          Support us

                          ioBroker
                          Community Adapters
                          Donate

                          512
                          Online

                          31.9k
                          Users

                          80.2k
                          Topics

                          1.3m
                          Posts

                          8
                          35
                          5249
                          Loading More Posts
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes
                          Reply
                          • Reply as topic
                          Log in to reply
                          Community
                          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                          The ioBroker Community 2014-2023
                          logo