CodeforLancaster / ideas

A place for our Ideas
3 stars 1 forks source link

How could we help Lancaster residents find when their next bin collection is, and for which bins? #16

Closed neilmorton closed 3 years ago

neilmorton commented 5 years ago

Problem

How could we help Lancaster residents find when their next bin collection is, and for which bins?

This idea was inspired by a discussion at the Code for Lancaster meet on 30th April.

How many people misplace the bin collection calendar they are sent once a year, and don't know when their bin collection day is, or which bins are supposed to be out this week?

How many people loose track of the collection days over bank holidays etc?

Initial solution thoughts

Data is available in PDF form online. At a minimum this could be scrapped for the data. Better would be getting this data in spreadsheet or similar format from the council as and when it changes.

With this data, we could then create an Alexa skill.

Example. "Alexa, Is it bin day?" ... "Your grey bins are due for collection tomorrow."

or

"Alexa, When bins?" ... "Your grey bins are due for collection tomorrow."

Whilst writing this up, I also thought that it could perhaps be interesting to look to have the option to ask what you can pout in each bin.

nderjung commented 5 years ago

Would love to get a notification on my phone auto-magically the night before. Atm i just set an alarm but I always forget which bin it is and then have to do the look up by hand. And with bank holidays, it sometimes changes date too.

Atm, we're in a bit of luck to make this a little easier. The Lancaster council has worked with the university to create this: http://www.lancaster.gov.uk/bins-recycling/bin-collection-calendar which does the main job. Following the <iframe> yields this link: https://lancaster.ombiel.co.uk/aek/c/aekbcf04bd1a3e9b6cc2?__cm_bl=yes&email=guest_1@anonymous_lancaster.ac.uk&wmode=transparent?wmode=transparent

Following the network request trail yields a request to an (MS ISS/.NET) API server: https://ilancasterapi.lancaster.ac.uk//production/api/v1/Cache?token=<token>

Playing with the link results in a full API of the server: https://ilancasterapi.lancaster.ac.uk/production/Help

It looks like we can publically access the end points for both finding the location of a bin collection based on postcode in JSON format: https://ilancasterapi.lancaster.ac.uk//production/api/v1/CityAndRegion/Bins/Address/<postcode>

And then pushing the value from the relevant address getting a list of collection dates and bin types via: https://ilancasterapi.lancaster.ac.uk//production/api/v1/CityAndRegion/Bins/Collection/<address>

This can then be fed into Alexa, for instance, or some ical server cron job thingy.

nderjung commented 5 years ago

For alexa, this tutorial can help: https://github.com/alexa/alexa-skills-kit-sdk-for-python/tree/master/samples/GetDeviceAddress

It looks like there may be a need for a little bit of conversion between the results from the iLancaster API that yields the address from the postcode and then saving that result somewhere on behalf of the Alexa user to later use when the question is asked "When is the bin collection?" /etal

cr0sis commented 4 years ago

Hi, I've been working on this ESP8266/NodeMCU project for a while now and using the above API I've come up with this example sketch. There is a line of code you must change for your own address of course and if you have no RGB led's you can comment out those functions and any line where the functions are called entirely, and just monitor the serial line for output. This is a work in progress and I'm adding new features all the time/learning how to code in C++.

If you have WS2811 led's for this sketch, there is a knightrider chasing red led animation for 15 minutes, a purple soft glow animation while updating itself and on recycling day there is a soft green glowing animation for a minute every 15. This will be escapable with buttons or sensors eventually. Enjoy!

neilmorton commented 3 years ago

Closing issue as group no longer active.