Skip to content

Script to extract bin collection information from the York API for Home Assistant

License

Notifications You must be signed in to change notification settings

nigelm/york_bin_collection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

York Bin Collection Data

York Council (in the UK) has an API which can tell you when bins (refuse, garbage or your regional variant) wil be collected - and what type of collection it will be.

This is documented at York Waste Collection Lookup

The previous version stopped working at the point where python was no longer available within the HA container. So it has (finally) been ported to AppDaemon.

Usage

  • Set up AppDaemon - see the documentation
  • Put the script into the AppDaemon apps directory
  • Edit the apps/apps.yaml file - see example below
  • Ensure AppDaemon is running (if it was already it should restart when the above edits are made)
  • Check for a sensor.bin_collection entity - check the attributes

The apps/apps.yaml file looks like this for me (with the UPRN set for your own household)

---
## comment out the original hello_world app
#hello_world:
#  module: hello
#  class: HelloWorld
york_bin_collection:
  module: york_bin_collection
  class: YorkBinCollection
  uprn: 100050567115
  entity: sensor.bin_collection
# end

You can obtain your UPRN from the links at York Waste Collection Lookup

To use your collection info you could add a card to the dashboard - an example template would look like this:-

Next collection on {{ strptime(states('sensor.bin_collection'),'%Y-%m-%d').strftime("%A (%-d %B, %Y) ") }}

Items collected:-

{% for set in state_attr('sensor.bin_collection', 'next_collection_types') %}
- <ha-icon icon="{{ set.icon }}"></ha-icon> {{ set.wasteType }}
{% endfor %}

If you are working with automations, the two boolean attributes is_today and is_tomorrow can assist you in making sure it runs on the right day.


About

Script to extract bin collection information from the York API for Home Assistant

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages