Woking Bin Collection Push Notifications

I found the process to check my bin collections long winded so I made an Azure Functions app to send a push notification to my phone the night before bin day so I know which bin to put out.

Push notification showing the details of an upcoming bin collection.

Which bin?!

Everyone has seen this image, right?

In case you haven’t: some guy created a light up bin that tells him which bins to take out. A BINdicator. Inspiring!

A small plastic refuse bin which is lit up green signifying the bin to take out this week.
The original ‘Bindicator’

I think this is a real problem. It comes to Tuesday and I know the bins are going out but heck if I remember whether it’s recycling or black bins this week. It’s dark in winter; I can’t see what bin other people have put out. And that’s not to even mention Christmas when I don’t know which day it is, let alone which day they’ll be collecting the bins.

Side note: There are a few people even offering bindicators as a product/service although I guess the pain of integrating and maintaining the information across many councils makes it a bit finicky.

I have said to my wife that I could have a go at turning this into a nationwide subscription service and we could retire on the proceeds. She’s not keen for this to be my legacy.

Options for knowing what bin day it is are as follows:

I found option 1 annoying (get it off the fridge, finger through looking for this week’s date) and I’m pretty sure we didn’t even get a leaflet for 2024.

For our council, option 2 is also pretty terrible. It is a minimum five click process to get to the information…

  1. Google “Woking bin collection”
  2. Optionally choose the Woking Council website (if you want an extra hop!)
  3. Optimally, choose the provider’s starting page instead
  4. Click “I live in Woking”
  5. Click “View my collections”
  6. Fill in your house number, street and postcode, submit
  7. Click the address
  8. Finally you can see upcoming collection information

You can bookmark step 4, but all the subsequent requests cannot be bookmarked; they respond dynamically to user interactions and aren’t recallable using a url.

So every time I was standing in my kitchen wanting to check which bin to put out I’d be there on my phone fumbling through this process.

Then I remembered the Bindicator…

Azure Functions App

As fun as it may have been to create a physical light-up bin, my idea was instead to get a push notification sent to my phone the evening before the bins are collected telling me which one to put out. Inform me right on my person, right on time…

I wouldn’t say I’m especially partial to Azure but I am all set up to tinker there and I figured this was a good use case for Functions. Run a function to scrape the council site and another to send the notification. The Azure push notifications accelerator (Notification Hubs) gives you a million free pushes a month.

All simple, serverless and running on timer triggers for a few pence.

Rather than going to the effort and cost of making a published app I opted for web push, creating a simple web page which would allow me to subscribe to browser push notifications. And since I was building this interface I figured I might as well set the app up to allow anyone to subscribe a device to updates for any (Woking, residential) address. I considered even pre-empting the addition of other bin sites by allowing for different scrapers to be invoked, but stopped shy of this (for now!)

Image showing my Woking Bin App interface once a user has subscribed.

 
The biggest challenge I faced initially was getting the functions app to deploy cleanly. In particular I wanted the static website html, css and js files to deploy to a blob storage container on build. After a good number of attempts at trying to get the build process to run scripts that connected to Azure, I realised it was simpler to get the GitHub Actions pipeline to Curl an http endpoint to trigger one of the app’s functions as the final step of the deployment process. This worked a charm and meant changes would be quickly reflected as I iteratively developed the interface.

Image showing static files for a website hosted in Azure Storage.
Static website files automatically deployed and served from Azure Blob Storage

 
Aside from the static website, the app is largely an orchestration of functions:

As I already had a storage bucket for the static website I opted to use simplistic Table Storage to hold all the data for the collections and user subscriptions.

Image showing bin collection data in Azure table storage.
Bin collection data held in Azure Table Storage

So there it is. I enjoyed the foray into Azure Functions. Even as I developed things the Azure Functions NodeJS framework seemed to be moving underneath me, but once everything was set up in VSCode it was a good experience with verbose debugging and the ability to run all the functions locally.

My Azure Functions bin app in Visual Studio Code
My Azure Functions bin app in Visual Studio Code

Frankly, I’m reasonably proud of this. Did I spend more time working on it than I’ll ever save when looking up bin data? Absolutely! Do I care? I do not.

And have I avoided terrible bin puns for this entire write up? Well, you may think this post is rubbish but I think I spared you!

Hero image credit: Pexels.