Autor Thema: [Template] Müllabholung  (Gelesen 352 mal)

Offline Wolle02

  • Sr. Member
  • ****
  • Beiträge: 631
[Template] Müllabholung
« am: 14 April 2022, 15:30:17 »
Ich habe hier noch ein Template gebastelt, das vielleicht für die interessant sein könnte, die ihre Müllkalender mit dem Modul CALVIEW auswerten.

{
  "name": "trash",
  "author": "Wolle02",
  "date": "2022-04-07",
  "status": {
    "bar": ["t_001_daysleft:3:0:success", "t_001_daysleft:2:100:success", "t_001_daysleft:1:100:warning", "t_001_daysleft:0:100:error"]
  },
  "main": [
    {
      "text": ["next::%s"],
      "text2": ["t_001_daysleft:2:in %n Tagen", "t_001_daysleft:1:morgen", "t_001_daysleft:0:heute"]
    }
  ],
  "info": {
    "left1": ["next:::mdi-trash-can"],
"mid1": ["nextafter::danach %s"],
"mid2": ["nextafter_days:2:in %n Tagen", "nextafter_days:1:morgen"]
  }
}


Wegen der Infozeile und vor allem weil bei mir manchmal mehrere Mülltonnen am gleichen Tag abgeholt werden, sind im Calview-Device folgende Userreadings erforderlich:

next {my $d1 = (ReadingsNum("$name","t_001_daysleft",0));
      my $d2 = (ReadingsNum("$name","t_002_daysleft",0));
      my $d3 = (ReadingsNum("$name","t_003_daysleft",0));
      my $t1 = (ReadingsVal("$name","t_001_summary",0));
      my $t2 = (ReadingsVal("$name","t_002_summary",0));
      my $t3 = (ReadingsVal("$name","t_003_summary",0));
      if ($d1 == $d3) {
         return $t1.", ".$t2." und ".$t3
      }
      elsif ($d1 == $d2) {
         return $t1." und ".$t2
      }
      else {
         return $t1
      }
},

nextafter {
      my $d1 = (ReadingsNum("$name","t_001_daysleft",0));
      my $d2 = (ReadingsNum("$name","t_002_daysleft",0));
      my $d3 = (ReadingsNum("$name","t_003_daysleft",0));
      my $t2 = (ReadingsVal("$name","t_002_summary",0));
      my $t3 = (ReadingsVal("$name","t_003_summary",0));
      my $t4 = (ReadingsVal("$name","t_004_summary",0));
      if ($d1 == $d3) {
         return $t4
      }
      elsif ($d1 == $d2) {
         return $t3
      }
      else {
         return $t2
      }
},

nextafter_days {
      my $d1 = (ReadingsNum("$name","t_001_daysleft",0));
      my $d2 = (ReadingsNum("$name","t_002_daysleft",0));
      my $d3 = (ReadingsNum("$name","t_003_daysleft",0));
      my $d4 = (ReadingsNum("$name","t_004_daysleft",0));
      if ($d1 == $d3) {
         return $d4
      }
      elsif ($d1 == $d2) {
         return $d3
      }
      else {
         return $d2
      }
}

Einfaches Copy & Paste sollte reichen.
Danach in appOptions mit
{"template": "trash"}einbinden.
Gefällt mir Gefällt mir x 1 Liste anzeigen