Denver - Trash Pickup Schedule

Denver has its trash collection published as an calendar which i have integrated into my frontend using an ical addon from user vmtyler

garbage
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.

2 Likes

How do/did you determine event_1 and event_0? My trash service obviously uses the same setup, as my link and website look identical (I’m in Austin) and I’m trying to incorporate this with the Google Calendar Component, which is native to HA.

event_0 is automatically created and populated from the ical-sensor-homeassistant. It is always the next date. See README.md

If any one is like me finding this thread, I needed to update the calendar name mine was ical_trash_calendar_event_0 not trash_calendar_event_0. Also the ‘name’ on the entity was actually ‘summary.’ I wish you dropped your icons, but I found some custom ones online. Otherwise really cool integration, thanks!

I’ve evolved this over the years, and now also have a physical 3d printed trash bin notifier


In short

Using a 3d printed trashbin, ESPHome, and a ESP8266 with LEDs, i can use HomeAssistant automation to trigger the LEDs depending on what is being picked up today.

Hey navet.

Could you show me how you did this?