Bin Calendar

December 28, 2020

Around this time each year it is especially useful to know when the rubbish is due to be collected by the local council, since the schedule is inevitably disrupted by the holidays until well into January. In fact where I live we have fortnightly collections, with different types of bin collected on alternate weeks, so I never find it easy to remember which bin is due to be put out.

This time last year I wrote a bin collections Twitter bot, mainly while exploring the Twitter API - but twelve months later, I have grown to accept that Twitter is not the most appropriate user experience for discovering important notifications.1

The correct user experience for looking up scheduled events is of course a calendar. The council do publish a PDF calendar, but it requires some deciphering, as they choose to combine everyone’s calendar on one page and then let you look up the bin colour like an old train timetable, given that you know your collection day. Fortunately they have also created a web service which tells you the exact collections due in the next few weeks, tied (I believe) directly into their backend systems. This API is used by the main web page which allows everyone to check their bin day, and so it was even updated correctly when these were disrupted early in the pandemic.

I have adapted my Twitter bot code (which reads this API) to instead publish an ics file; I have then subscribed to this in my favoured calendaring application, and enabled notifications at 5pm on the day before the bins are due. This should work.

A word on the implementation (since I apparently said nothing on my blog about this a year ago): I wrote it as a Google Cloud Function in Golang, triggered by Cloud Scheduler via Pub/Sub. The ics file is output to a Cloud Storage bucket. This requires only a few seconds of CPU time per day, and fits well within the smallest 128MB RAM quota - so is extremely inexpensive, with no significant attack surface to worry about.

Although in an ideal world the council would publish and maintain these calendars themselves, I find some joy in creating hacks like this.


  1. For one thing, I hardly ever look at Twitter now - in fact my bin bot is probably my most frequented Twitter feed - but even when I used Twitter more frequently, it was easy to lose important posts in a sea of news, jokes and arguments. I adopted a policy of following only people I knew in real life, which altered the feel of the network quite substantially; and of course ensuring a chronological feed rather than relying on the algorithm. But it didn’t make it feel right, and I’m happy to have social media fade out of my life. But I digress. ↩︎

Nifty tech tag lists fromĀ Wouter Beeftink