Hello,
I created a garbage calender:
This is the code:
title: Müllabfuhr
type: vertical-stack
in_card: true
cards:
- type: custom:button-card
entity: sensor.abfall_bio
layout: icon_name_state2nd
show_label: true
label: |
[[[
var days_to = entity.state.split("|")[1]
if (days_to == 0)
{ return "Heute" }
else if (days_to == 1)
{ return "Morgen" }
else
{ return "in " + days_to + " Tagen" }
]]]
show_name: true
name: Abholung des Bioabfalls
state:
- color: red
operator: template
value: '[[[ return entity.state.split("|")[1] == 0 ]]]'
- color: orange
operator: template
value: '[[[ return entity.state.split("|")[1] == 1 ]]]'
- value: default
- type: custom:button-card
entity: sensor.abfall_restmuell
layout: icon_name_state2nd
show_label: true
label: |
[[[
var days_to = entity.state.split("|")[1]
if (days_to == 0)
{ return "Heute" }
else if (days_to == 1)
{ return "Morgen" }
else
{ return "in " + days_to + " Tagen" }
]]]
show_name: true
name: Abholung des Restabfalls
state:
- color: red
operator: template
value: '[[[ return entity.state.split("|")[1] == 0 ]]]'
- color: orange
operator: template
value: '[[[ return entity.state.split("|")[1] == 1 ]]]'
- value: default
- type: custom:button-card
entity: sensor.abfall_gelbersack
layout: icon_name_state2nd
show_label: true
label: |
[[[
var days_to = entity.state.split("|")[1]
if (days_to == 0)
{ return "Heute" }
else if (days_to == 1)
{ return "Morgen" }
else
{ return "in " + days_to + " Tagen" }
]]]
show_name: true
name: Abholung des Plastikabfalls
state:
- color: red
operator: template
value: '[[[ return entity.state.split("|")[1] == 0 ]]]'
- color: orange
operator: template
value: '[[[ return entity.state.split("|")[1] == 1 ]]]'
- value: default
- type: custom:button-card
entity: sensor.abfall_papier
layout: icon_name_state2nd
show_label: true
label: |
[[[
var days_to = entity.state.split("|")[1]
if (days_to == 0)
{ return "Heute" }
else if (days_to == 1)
{ return "Morgen" }
else
{ return "in " + days_to + " Tagen" }
]]]
show_name: true
name: Abholung des Papierabfalls
state:
- color: red
operator: template
value: '[[[ return entity.state.split("|")[1] == 0 ]]]'
- color: orange
operator: template
value: '[[[ return entity.state.split("|")[1] == 1 ]]]'
- value: default
Now I want it to be sorted by days, so that the nearest is always a the top.
Is there a way to do this? In didn’t find anything usefull until now.