Skip to content

Latest commit

 

History

History
85 lines (61 loc) · 3.87 KB

File metadata and controls

85 lines (61 loc) · 3.87 KB

Manchester City Council Bin Collection Home Assistant Component

This Home Assistant component will scrape the Manchester City Council webpage to find out a households bin collection and create a sensor for each type of bin.

For example:

Entity State Attributes
sensor.black_grey_bin today colour: black / grey
next_collection: 2022-06-09
days: 0
icon: mdi:delete
friendly_name: Black / Grey bin
icon_color: #5a5858
sensor.blue_bin tomorrow colour: blue
next_collection: 2022-06-10
days: 1
icon: mdi:delete
friendly_name: Blue bin
icon_color: #3880de
sensor.brown_bin this_week colour: brown
next_collection: 2022-06-11
days: 8
icon: mdi:delete
friendly_name: Brown bin
icon_color: #5e3838
sensor.green_bin next_week colour: green
next_collection: 2022-06-17
days: 15
icon: mdi:delete
friendly_name: Green bin
icon_color: #158f15

Example Home Assistant dashboard

Installation

The recommended way to install this component is using HACS.

Configuration

Add the following to your configuration.yaml

bin_collection_manchester_council:
  postcode: m201aa
  address: 43 Mauldeth Road West

If you want to change the icon colours of the bins, you will need the custom-ui plugin.

An example customize.yaml to update the colours:

sensor.blue_bin:
  icon_color: "#3880de"
sensor.green_bin:
  icon_color: "#158f15"
sensor.brown_bin:
  icon_color: "#5e3838"
sensor.black_grey_bin:
  icon_color: "#5a5858"

Automations

Now that you have the bin sensors added to your Home Assistant you can start doing some cool automations. The example below configuration can be found here.

For this automation, you will need to create an input_boolean to track when the bins have been completed:

bins_completed:
    name: Bins Completed
    icon: mdi:check-circle
    initial: on

Add your bin sensors to a group:

bins:
  name: Bins
  entities:
    - sensor.black_grey_bin
    - sensor.blue_bin
    - sensor.brown_bin
    - sensor.green_bin

Node Red Example

  • Check if bins are being collected tomorrow and set input_boolean.bins_completed to off if there are
  • From 17:00 to 00:00 every 30 mins, send a notification to a mobile device as a reminder
  • Mark the bins collected either via the mobile notification action or in Home Assistant

Bin Notification Example Bin Notification Action Complete Example

Development

Either, copy the custom_components to your Home Assistant config directory, or spin up a local instance using Home Assistant Core. Using .devcontainer within the core repository will enable debugging as it will attach to the process.

cp -R ~/git/home-assistant-core/config/custom_components/bin_collection_manchester_council ./custom_components