Denver has its trash collection published as an calendar which i have integrated into my frontend using an ical addon from user vmtyler
First add ical to your instance by following the instructions on the github page.
The go to Denver Gov and then get the url for the Google Calendar.
configuration.yaml for ical
- platform: ical
name: "Trash Calendar"
url: "Google URL from above"
Now it is a matter of creating some sensors. These sensors scan the calendar events for different pick up types, and then assigns a picture. It also formats the date, and calculates number of days until pickup.
trash_this_pickup:
friendly_name: 'This pickup'
value_template: >
{{ states.sensor.trash_calendar_event_0.attributes.start.strftime('%A %d %b')}} ({{ (as_timestamp((states.sensor.trash_calendar_event_0.attributes.start|string)[0:19]) | timestamp_custom("%j") | int) - (as_timestamp(now()) | timestamp_custom("%-j") | int) }} days)
entity_picture_template: >-
{% if is_state_attr('sensor.trash_calendar_event_0','name','Trash and compost (sign-up only)') %}
/local/trashonly.png
{% elif is_state_attr('sensor.trash_calendar_event_0','name','Trash, extra trash, and compost (sign-up only)') %}
/local/trashandextra.png
{% elif is_state_attr('sensor.trash_calendar_event_0','name','Trash, compost (sign-up only), and extra trash') %}
/local/trashandextra.png
{% elif is_state_attr('sensor.trash_calendar_event_0','name','Trash, compost (sign-up only), and recycle') %}
/local/trashandrecycle.png
{% elif is_state_attr('sensor.trash_calendar_event_0','name','Trash, recycle, and compost (sign-up only)') %}
/local/trashandrecycle.png
{% elif is_state_attr('sensor.trash_calendar_event_0','name','Trash, compost (sign-up only), and recycle') %}
/local/trashandrecycle.png
{% elif is_state_attr('sensor.trash_calendar_event_0','name','Trash, compost (sign-up only), recycle, and treecycle collection') %}
/local/trashandrecycle.png
{% elif is_state_attr('sensor.trash_calendar_event_0','name','Trash, compost (sign-up only), and treecycle collection') %}
/local/trashonly.png
{% else %}
/local/error.png
{% endif %}
trash_next_pickup:
friendly_name: 'Next pickup'
value_template: >
{{ states.sensor.trash_calendar_event_1.attributes.start.strftime('%A %d %b')}} ({{ (as_timestamp((states.sensor.trash_calendar_event_1.attributes.start|string)[0:19]) | timestamp_custom("%j") | int) - (as_timestamp(now()) | timestamp_custom("%-j") | int) }} days)
entity_picture_template: >-
{% if is_state_attr('sensor.trash_calendar_event_1','name','Trash and compost (sign-up only)') %}
/local/trashonly.png
{% elif is_state_attr('sensor.trash_calendar_event_1','name','Trash, extra trash, and compost (sign-up only)') %}
/local/trashandextra.png
{% elif is_state_attr('sensor.trash_calendar_event_1','name','Trash, compost (sign-up only), and extra trash') %}
/local/trashandextra.png
{% elif is_state_attr('sensor.trash_calendar_event_1','name','Trash, compost (sign-up only), and recycle') %}
/local/trashandrecycle.png
{% elif is_state_attr('sensor.trash_calendar_event_1','name','Trash, recycle, and compost (sign-up only)') %}
/local/trashandrecycle.png
{% elif is_state_attr('sensor.trash_calendar_event_1','name','Trash, compost (sign-up only), and recycle') %}
/local/trashandrecycle.png
{% elif is_state_attr('sensor.trash_calendar_event_1','name','Trash, compost (sign-up only), recycle, and treecycle collection') %}
/local/trashandrecycle.png
{% elif is_state_attr('sensor.trash_calendar_event_1','name','Trash, compost (sign-up only), and treecycle collection') %}
/local/trashonly.png
{% else %}
/local/error.png
{% endif %}
Then is a matter of just adding to lovelace
entities:
- entity: sensor.trash_next_date
- entity: sensor.trash_next_next_date
show_header_toggle: false
title: Garbage
type: entities
Probably not a huge amount of people from Denver that require this, but hopefully someone can find this useful.