How to create a waste collection visual in Home Assistant

Using Nextcoud Calendar, we can create waste collection sensors.

by Pete
Published: Updated: 10 minutes read

If you’re like me, keeping track of various waste collection days can be a bit of a headache. But don’t worry, there’s a solution, and it involves everyone’s favorite home automation platform – Home Assistant.

In this post, I’ll guide you through the process of integrating Nextcloud calendar with Home Assistant to display your bin/waste collection schedule efficiently.

Outcome

In simple terms, we aim to create a Lovelace tile that displays a sensor as either on or off, with colors indicating the scheduled collection day.

Let’s get into it

For this to work, you’ll the following:

The logic for this to work is that by using reoccurring calendar entries for each bin collection, we can use Home Assistant to create sensors that we can do things with.

For this example, my bin collection’s look like this:

  1. Every Wednesday, our general waste bin is collected
  2. Every second Wednesday, our recycle bin is collected
  3. Every other Wednesday, our green bin is collected

Configuring Nextcloud Calendar

For now, I’ll assume that Nextcloud is installed, working and ready to go.

To install the Calendar app in Nextcloud, you can follow these steps:

  1. Log in to your Nextcloud instance as an administrator.
  2. Click on the “Apps” button in the top right corner of the screen.
  3. In the Apps page, search for “Calendar” in the search bar.
  4. Once you find the “Calendar” app, click on the “Download and enable” button to the right of the app.
  5. Wait for the app to download and install. This may take a few moments.
  6. Once the installation is complete, click on the “Enabled” button to the right of the app.
  7. The Calendar app should now be installed and enabled in your Nextcloud instance.
  8. To access the Calendar app, click on the “Calendar” button in the top left corner of the screen. You should now see the Calendar interface, where you can create, view, and manage events.

1
Next step is to add your bin collection dates:

garbage-collection-Screenshot_20230228_144409.png
  • Create a new Calendar – I called mine: Garbage
  • Create a new event for the general Garbage. Click New Event. I want Home Assistant to light up my sensor Tuesday night so I created my entry to start from 10am on Tuesday to 11am on Wednesday. I called mine “Garbage Collection“. Because it happens every week, I made it reoccurring every Tuesday.
  • Next, create a new event for the Green Bin (ie: what picks up green waste) – the difference is that the Green Bin get’s picked up every 2nd week. Create a New Event, I used the same entry to start from 10am on Tuesday to 11am on Wednesday but reoccurred every 2nd Tuesday. I called this entry Green Bin Collection.
green_bin_collection-Screenshot_20230228_144432.png
  • One the Green Bin has been created, we need to create an entry for the recycling bin. Follow the same steps as before for the Green Bin but make the reoccurring even happen on subsequent weeks to the Green Bin. I called this entry Recycling Collection.
recycling-collection-Screenshot_20230228_144340.png

Your calendar should look something like this:

2
Configuring Home Assistant

Now that we’ve created a Nextcloud calendar, we can access it via calDAV and map the entries to a sensor in Home Assistant. Neat. calDav calendar is built into Home Assistant so you don’t need install the integration manually.

To do so, do the following:

  • Open file editor in Home Assistant
  • Make sure you’ve opened configuration.yaml
  • Create a new calDAV calendar entry – you can create your own, but I recommend you follow mine.
  • Here is my code
calendar:
  - platform: caldav
    url: https://<your nextcloud base url>/remote.php/dav
    username: <your username>
    password: <your app password>
    custom_calendars:
      - name: "Garbage Collection"
        calendar: "Garbage"
        search: "Garbage"
      - name: "Green Bin Collection"
        calendar: "Garbage"
        search: "Green Bin"
      - name: "Recycle Bin Collection"
        calendar: "Garbage"
        search: "Recycling"
  • Note: if you don’t know your caldav url, you can find it by going to your Nextcloud calendar, press Calendar Settings, Copy primary CalDAV address
  • You can see that I’m using the Search function to import and filter by the keywords of the entries that I created.
  • Now restart Home Assistant for the sensors to be created.

If all goes well, you should see three sensors listed under Devices & Services, Entities

  • Garbage Collection (Entity ID: calendar.garbage_garbage_collection)
  • Green Bin Collection (Entity ID: calendar.garbage_green_bin_collection)
  • Recycle Bin Collection (Entity ID: calendar.garbage_recycle_bin_collection)

3
Creating a Lovelace Tile

To be super simple, to create a stacked Garbage collection into a vertical stack to look like mine:

type: vertical-stack
cards:
  - type: custom:mushroom-title-card
    title: Bin Collection
  - type: tile
    entity: calendar.garbage_garbage_collection
    show_entity_picture: false
    icon: mdi:trash-can
    color: red
    name: Garbage Bin
  - square: false
    columns: 2
    type: grid
    cards:
      - type: tile
        entity: calendar.garbage_recycle_bin_collection
        name: Recycle Bin
        icon: mdi:recycle
        color: yellow
      - type: tile
        entity: calendar.garbage_green_bin_collection
        name: Green Bin
        icon: mdi:leaf
        color: green

Notes:

  • My Garbage bin lid is red, so I colored the sensor Red
  • My Recycle bin lid is yellow, so I colored the sensor Yellow
  • My Green bin lid is green, so I colored the sensor Green
  • I use a custom tile card from a HAC repo called “Mushroom” that gives me a nice flat heading that I called “Bin Collection”. You can use a normal Tile or a Markdown tile for heading style of your choice.

In Summary

With this setup, you can effortlessly use Nextcloud and Home Assistant to create calendar sensors that visually represent your bin collection schedule. It’s a practical and visually appealing way to stay on top of your waste management routine.

What’s next? You might consider creating an automation to receive reminders when collection days approach. However, with this schedule visible on your home screen, you may find it a convenient daily reminder.

Give it a try, and simplify your waste collection routine with Home Assistant and Nextcloud integration.