Skip to content

Instantly share code, notes, and snippets.

@florian-asche
Forked from idominiki/GarbageCollection.yaml
Last active January 6, 2024 16:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save florian-asche/1aa727c7e79ec0ffe73da29831481fd1 to your computer and use it in GitHub Desktop.
Save florian-asche/1aa727c7e79ec0ffe73da29831481fd1 to your computer and use it in GitHub Desktop.
- type: custom:mushroom-title-card
title: Abfall
- type: horizontal-stack
cards:
- type: custom:button-card
entity: sensor.abfall_gelber_sack
icon: mdi:delete-empty
show_name: false
show_state: false
show_icon: true
color: yellow
state:
- operator: <=
value: '0'
text-color: var(--label-badge-red)
styles:
icon:
- animation: rotating 2s ease infinite
- operator: <=
value: '1'
text-color: var(--label-badge-yellow)
styles:
icon:
- animation: blink 2s ease infinite
- operator: <=
value: '2'
text-color: var(--label-badge-green)
styles:
grid:
- grid-template-areas: '"i" "days"'
- grid-template-columns: 1fr
- grid-template-rows: 1fr 0.2fr
card:
- width: 120px
- height: 130px
- text-align: center
name:
- font-size: 14px
custom_fields:
days: |
[[[
if (entity.state == 0) return entity.attributes.friendly_name + "<br><div style='font-size: 14px;'>Heute</div><br><br>";
else if (entity.state == 1) return entity.attributes.friendly_name + "<br><div style='font-size: 14px;'>Morgen</div><br><br>";
else
return entity.attributes.friendly_name + "<br><div style='font-size: 14px;'>in " + entity.state + " Tagen</div><br><br>";
]]]
- type: custom:button-card
entity: sensor.abfall_restmull
icon: mdi:trash-can
icon_color: gray
show_name: false
show_state: false
show_icon: true
color: black
state:
- operator: <=
value: '0'
text-color: var(--label-badge-red)
styles:
icon:
- animation: rotating 2s ease infinite
- color: black
- operator: <=
value: '1'
text-color: var(--label-badge-yellow)
styles:
icon:
- animation: blink 2s ease infinite
- color: black
- operator: <=
value: '2'
text-color: var(--label-badge-green)
styles:
grid:
- grid-template-areas: '"i" "days"'
- grid-template-columns: 1fr
- grid-template-rows: 1fr 0.2fr
card:
- width: 120px
- height: 130px
- text-align: center
name:
- font-size: 14px
custom_fields:
days: |
[[[
if (entity.state == 0) return entity.attributes.friendly_name + "<br><div style='font-size: 14px;'>Heute</div><br><br>";
else if (entity.state == 1) return entity.attributes.friendly_name + "<br><div style='font-size: 14px;'>Morgen</div><br><br>";
else
return entity.attributes.friendly_name + "<br><div style='font-size: 14px;'>in " + entity.state + " Tagen</div><br><br>";
]]]
- type: horizontal-stack
cards:
- type: custom:button-card
entity: sensor.abfall_altpapier
icon: mdi:trash-can-outline
show_name: false
show_state: false
show_icon: true
color: var(--label-badge-blue)
state:
- operator: <=
value: '0'
text-color: var(--label-badge-red)
styles:
icon:
- animation: rotating 2s ease infinite
- operator: <=
value: '1'
text-color: var(--label-badge-yellow)
styles:
icon:
- animation: blink 2s ease infinite
- operator: <=
value: '2'
text-color: var(--label-badge-green)
styles:
grid:
- grid-template-areas: '"i" "days"'
- grid-template-columns: 1fr
- grid-template-rows: 1fr 0.2fr
card:
- width: 120px
- height: 130px
- text-align: center
name:
- font-size: 14px
custom_fields:
days: |
[[[
if (entity.state == 0) return entity.attributes.friendly_name + "<br><div style='font-size: 14px;'>Heute</div><br><br>";
else if (entity.state == 1) return entity.attributes.friendly_name + "<br><div style='font-size: 14px;'>Morgen</div><br><br>";
else
return entity.attributes.friendly_name + "<br><div style='font-size: 14px;'>in " + entity.state + " Tagen</div><br><br>";
]]]
- type: custom:button-card
entity: sensor.abfall_kompost
icon: mdi:trash-can-outline
show_name: false
show_state: false
show_icon: true
color: green
state:
- operator: <=
value: '0'
text-color: var(--label-badge-red)
styles:
icon:
- animation: rotating 2s ease infinite
- operator: <=
value: '1'
text-color: var(--label-badge-yellow)
styles:
icon:
- animation: blink 2s ease infinite
- operator: <=
value: '2'
text-color: var(--label-badge-green)
styles:
grid:
- grid-template-areas: '"i" "days"'
- grid-template-columns: 1fr
- grid-template-rows: 1fr 0.2fr
card:
- width: 120px
- height: 130px
- text-align: center
name:
- font-size: 14px
custom_fields:
days: |
[[[
if (entity.state == 0) return entity.attributes.friendly_name + "<br><div style='font-size: 14px;'>Heute</div><br><br>";
else if (entity.state == 1) return entity.attributes.friendly_name + "<br><div style='font-size: 14px;'>Morgen</div><br><br>";
else
return entity.attributes.friendly_name + "<br><div style='font-size: 14px;'>in " + entity.state + " Tagen</div><br><br>";
]]]
---
# waste_collection_schedule source configuration
waste_collection_schedule:
sources:
- name: abfallnavi_de
args:
service: gt2
ort: Gütersloh
strasse: WILHELM-LEHMANN-STR.
sensor:
- platform: waste_collection_schedule
#source_index: 0
name: Abfall Guetersloh
details_format: "upcoming"
#count: COUNT
#leadtime: LEADTIME
#value_template: VALUE_TEMPLATE
#date_template: DATE_TEMPLATE
# types:
# - Appointment Type 1
# - Appointment Type 2
- platform: waste_collection_schedule
#source_index: 0
name: Abfall - Gelber Sack
#details_format: "upcoming"
types:
- "Gelber Sack 2-wtl."
#count: COUNT
#leadtime: LEADTIME
#value_template: VALUE_TEMPLATE
#value_template: '{{value.types|join(", ")}}'
value_template: '{{value.daysTo}}'
#value_template: 'on {{value.date.strftime("%a")}}, {{value.date.strftime("%d.%m.%Y")}}'
#date_template: DATE_TEMPLATE
# types:
# - Appointment Type 1
# - Appointment Type 2
- platform: waste_collection_schedule
#source_index: 0
name: Abfall - Altpapier
#details_format: "upcoming"
types:
- "Papier 4-wtl."
#count: COUNT
#leadtime: LEADTIME
#value_template: VALUE_TEMPLATE
#value_template: '{{value.types|join(", ")}}'
value_template: '{{value.daysTo}}'
#value_template: 'on {{value.date.strftime("%a")}}, {{value.date.strftime("%d.%m.%Y")}}'
#date_template: DATE_TEMPLATE
# types:
# - Appointment Type 1
# - Appointment Type 2
- platform: waste_collection_schedule
#source_index: 0
name: Abfall - Restmüll
#details_format: "upcoming"
types:
- "Rest 2-wtl."
#count: COUNT
#leadtime: LEADTIME
#value_template: VALUE_TEMPLATE
#value_template: '{{value.types|join(", ")}}'
value_template: '{{value.daysTo}}'
#value_template: 'on {{value.date.strftime("%a")}}, {{value.date.strftime("%d.%m.%Y")}}'
#date_template: DATE_TEMPLATE
# types:
# - Appointment Type 1
# - Appointment Type 2
- platform: waste_collection_schedule
#source_index: 0
name: Abfall - Kompost
#details_format: "upcoming"
types:
- "Kompost 2-wtl."
#count: COUNT
#leadtime: LEADTIME
#value_template: VALUE_TEMPLATE
#value_template: '{{value.types|join(", ")}}'
value_template: '{{value.daysTo}}'
#value_template: 'on {{value.date.strftime("%a")}}, {{value.date.strftime("%d.%m.%Y")}}'
#date_template: DATE_TEMPLATE
# types:
# - Appointment Type 1
# - Appointment Type 2
blueprint:
name: Waste Collection Schedule Reminder
domain: automation
input:
trash_calendar:
name: Trash calendar
description: Calendar containing all-day events when trash needs to be picked up.
selector:
entity:
filter:
domain: sensor
reminder_time:
name: Reminder time
description: At what time the day before do you want to be reminded
default: '18:00:00'
selector:
time: {}
day_offset:
name: Day offset
description: Amount of days to be added to the triggers date to check for sensor
value matches. E.g. 1 to be notified the day before or 0 for notification
on the garbage collection day.
default: 1
reminder_title:
name: Reminder title
description: Shown as title in the notification
default: Abfall
reminder_message:
name: Reminder message
description: Accompanying text in the notification
default: 'Der nachfolgende Müll wird morgen abgeholt: '
notifier:
name: Notifier
description: Name of integration you prefer to use for notifications. E.g. notify.notify
default: notify.notify
variables:
reminder_title: !input 'reminder_title'
reminder_message: !input 'reminder_message'
day_offset: !input 'day_offset'
trash_calendar: !input 'trash_calendar'
sensors_tomorrow: "{{ state_attr(trash_calendar, (now() + timedelta(days=day_offset)).strftime('%Y-%m-%d')) }}"
trigger:
platform: time
at: !input 'reminder_time'
condition:
condition: template
value_template: "{{ sensors_tomorrow | length > 0 }}"
action:
service: !input 'notifier'
data:
title: '{{ reminder_title }}'
message: '{{ reminder_message }}{{ sensors_tomorrow }}'
data:
ttl: 0
priority: high
@newelley
Copy link

newelley commented Jan 6, 2024

I forked this to change to an English translation, as it worked flawlessly with my setup. Thankyou for updating the code 🥇

Ich habe dies geforkt, um zu einer englischen Übersetzung zu wechseln, da es mit meinem Setup einwandfrei funktionierte. Vielen Dank für die Aktualisierung des Codes 🥇

@florian-asche
Copy link
Author

I forked this to change to an English translation, as it worked flawlessly with my setup. Thankyou for updating the code 🥇

Ich habe dies geforkt, um zu einer englischen Übersetzung zu wechseln, da es mit meinem Setup einwandfrei funktionierte. Vielen Dank für die Aktualisierung des Codes 🥇

Thanks for your reply. I also added a nice looking lovelace example just now. If the trash is in one day, the icon will blink, and if the trash is today it will spin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment