Widget rechnen
Verfasst: 2. Sep 2023 16:26
Moin,
ich benötige einmal eure Hilfe bitte. Ich möchte folgendes Widget https://community.openhab.org/t/garbage ... n/114871/4als Anzeige für die Müllabholungen nutzen. Ich habe es für mich angepasst bekomme aber die Badge (heute/morgen) nicht hin. Ich bekomme immer nur ein "undefined"
es geht um diese beiden Zeilen.

Widget
Items
Datun heute
Kalendar Eintrag
ich benötige einmal eure Hilfe bitte. Ich möchte folgendes Widget https://community.openhab.org/t/garbage ... n/114871/4als Anzeige für die Müllabholungen nutzen. Ich habe es für mich angepasst bekomme aber die Badge (heute/morgen) nicht hin. Ich bekomme immer nur ein "undefined"
es geht um diese beiden Zeilen.
Code: Alles auswählen
badge: '=((items.garbage_collection_restmuell.displayState == items.LokaleZeitDateTime.displayState) ? "Heute" : (items.garbage_collection_restmuell.displayState == LokaleZeitDateTime.plusDays(1).toString()) ? "Morgen" : false)'
badgeColor: '=((items.garbage_collection_restmuell.displayState == items.LokaleZeitDateTime.displayState) ? "red" : "yellow")'
Widget
Code: Alles auswählen
uid: garbage_cell_v4
tags: []
props:
parameterGroups: []
timestamp: Aug 31, 2023, 10:13:13 PM
component: f7-card
config:
title: ="Abfuhrtermine:"
slots:
default:
- component: f7-card-content
slots:
default:
- component: f7-list
config:
mediaList: true
slots:
default:
- component: oh-list-item
config:
badge: '=((items.garbage_collection_restmuell.displayState == items.LokaleZeitDateTime.displayState) ? "Heute" : (items.garbage_collection_restmuell.displayState == LokaleZeitDateTime.plusDays(1).toString()) ? "Morgen" : false)'
badgeColor: '=((items.garbage_collection_restmuell.displayState == items.LokaleZeitDateTime.displayState) ? "red" : "yellow")'
footer: =items.garbage_collection_restmuell.displayState
icon: f7:trash
iconColor: black
title: Restmüll
visible: '=items.garbage_collection_restmuell.state == "UNDEF" ? false : true'
- component: oh-list-item
config:
badge: '=((items.garbage_collection_bioabfall.displayState == items.LokaleZeitDateTime.displayState) ? "Heute" : (items.garbage_collection_bioabfall.displayState == LokaleZeitDateTime.plusDays(1).toString()) ? "Morgen" : false)'
badgeColor: '=((items.garbage_collection_bioabfall.displayState == items.local_dateweekday.displayState) ? "red" : "yellow")'
footer: =items.garbage_collection_bioabfall.displayState
icon: f7:trash
iconColor: teal
title: Bioabfall
visible: '=items.garbage_collection_bioabfall.state == "UNDEF" ? false : true'
- component: oh-list-item
config:
badge: '=((items.garbage_collection_gelb.displayState == items.LokaleZeitDateTime.displayState) ? "Heute" : (items.garbage_collection_gelb.displayState == LokaleZeitDateTime.plusDays(1).toString()) ? "Morgen" : false)'
badgeColor: '=((items.garbage_collection_gelb.displayState == items.LokaleZeitDateTime.displayState) ? "red" : "yellow")'
footer: =items.garbage_collection_gelb.displayState
icon: f7:trash
iconColor: yellow
title: Gelbe Tonne
visible: '=items.garbage_collection_gelb.state == "UNDEF" ? false : true'
- component: oh-list-item
config:
badge: '=((items.garbage_collection_papier.displayState == items.LokaleZeitDateTime.displayState) ? "Heute" : (items.garbage_collection_papier.displayState == LokaleZeitDateTime.plusDays(1).toString()) ? "Morgen" : false)'
badgeColor: '=((items.garbage_collection_papier.displayState == items.LokaleZeitDateTime.displayState) ? "red" : "yellow")'
footer: =items.garbage_collection_papier.displayState
icon: f7:trash
iconColor: blue
title: Papier Tonne
visible: '=items.garbage_collection_papier.state == "UNDEF" ? false : true'
- component: oh-list-item
config:
badge: '=((items.garbage_collection_christmas.displayState == items.local_dateweekday.displayState) ? "Heute" : (items.garbage_collection_christmas.displayState == LokaleZeitDateTime.plusDays(1).toString()) ? "Morgen" : false)'
badgeColor: '=((items.garbage_collection_christmas.displayState == items.LokaleZeitDateTime.displayState) ? "red" : "yellow")'
footer: =items.garbage_collection_christmas.displayState
icon: f7:trash
iconColor: green
title: Weihnachtsbäume
visible: '=items.garbage_collection_christmas.state == "UNDEF" ? false : true'
- component: f7-card-footer
slots:
default:
- component: Label
config:
text: '="Nächste Abholung: " + items.garbage_collection_titel.state + " " + items.garbage_collection.displayState'
Datun heute
Code: Alles auswählen
DateTime LokaleZeitDateTime "Datum und zeit jetzt [%1$td.%1$tm.%1$tY]" {channel="ntp:ntp:local:dateTime"}
Code: Alles auswählen
DateTime garbage_collection_restmuell "Start [%1$td.%1$tm.%1$tY]" (itemInGroup) {channel="icalendar:eventfilter:36df030a24:2f9ff51343:result_0#begin"}