[UK] Looking for a beginner friendly tutorial on displaying when bins go out

I’m really new to Home Assistant,
Only got my first sensor last week and a Conbee 2 USB Stick.

Thought it would be cool to display which bin goes out on friday?
General or Recycling

I successfully use scrape sensor on the council’s website, does you council have s site where you put in your postcode and get the next collection dates ?

Hi Jon

There could be multiple ways of doing this but the one I use and like is through a custom component.
First step would be to install HACS, the community addon store: HACS
Once that has been installed, search in the integrations tab for “Garbage Collection” its also available here https://github.com/bruxy70/Garbage-Collection
Once that’s installed and home assistant restarted you should be able to add your two bins under the garbage collection sensor in the integration menu.

2 Likes

Yes, I used to use that but my council has a habit of changing the days around holidays.

My lot release a years worth of dates including all the holiday changes, you can set them up in a Google Calendar, make a new one specifically for it if you want as they’re free, only takes a minute to set up if you set the standard alternating ones as recurring and then just revise the holiday changes. Then use the Google Calendar component in HA to set up sensors to show the info you want in the front end…

Just keep the calendar itself up to date and HA will keep up.

You may find this useful…

Just tried this myself out of interest as I just use calendar notifications to put them out the night before. We have green, grey and brown bins and in the calendar they are referred to as ‘whatever colour bin collection’ so I added a new calendar under the main one like this…

  - device_id: bins
    ignore_availability: true
    name: Bin collection
    track: true
    search: 'bin'

This creates an entity called calendar.bins from which you can then use the message state which is the next event on the calendar to create a sensor which varies according to that state, in my case Green bin collection, Grey bin collection or Brown bin collection could just display the colour as a word or a different coloured pictogram for instance.

This is the sensor to go with it…

- platform: template
  sensors:
    bin_collection:
      value_template: '{{ states.calendar.bins.attributes.message }}'
      friendly_name: 'Next collection'

Or you could use the lovelace calendar card and have something simple like this…

Screenshot 2020-06-24 at 17.16.43

Just checked Sefton Council to see, they have a calander (.pdf) which dates to december but that’s about it so i could just manually put that it somewhere

Just had a look and there is data on there but I don’t know how to scrape from an .APSX webpage, sorry, maybe the manual input into a google calendar as mentioned above is your best bet

Yes! could you please tell me more? Thank you

Bin Collection Calendar Dates - West Lothian Council this is the website to put the postcode in

Its a while since I did this !
You will need a postcode and address in that site, Then press F12 in chrome to see the output and hover over each of the dates, should say it on the RHS.
Have a search on this forum for ways to use the scrape sensor with this info, it can be a LOT of trial and error !

You could put a request on here, this is what I’m using now:

1 Like

@Holdestmade thanks for flagging this one up. That integration is perfect. I have the information I need now how do I display it?

May I ask what approach you have taken to display or alert? Do you have a card or some other notification?

I use a custom made picture elements card (coloured outline if bin is due) and also alexa announces at bedtime if the bins are due tomorrow.

I also have a 3D printed wheelie bin in the hallway that glows the right colour if the bin is due to be put out tomorrow (using esphome and a single RGB LED)

1 Like

Nice. That’s somewhat more advanced than my simple entity filter card but for now it does what I need. Your solution is something to aspire to! :sunglasses:

I have a bin (or two) on my floorplan showing the colors and number of days to collect and after clicking it’s opening the popup card like this:

Hello @Holdestmade !
Can you share your amazing custom made card ?
Thx in advance.

Sure, I use icons for the days now though

image

type: picture-elements
image: /local/images/BG_BINStrans.png
card_mod:
  style: |
    ha-card {
      outline:
      {% if (states('sensor.home_green_bin_2') == 'Today' or states('sensor.home_green_bin_2') == 'Tomorrow') %}
        solid 1.5px green;
      {% elif (states('sensor.home_blue_bin_2') == 'Today' or states('sensor.home_blue_bin_2') == 'Tomorrow') %}
        solid 1.5px #3498DB;
      {% elif (states('sensor.home_brown_bin_2') == 'Today' or states('sensor.home_brown_bin_2') == 'Tomorrow') %}
        solid 1.5px #E67E22;
      {% endif %}
      background:
      {% if (states('sensor.home_green_bin_2') == 'Today' or states('sensor.home_blue_bin_2') == 'Today' or states('sensor.home_brown_bin_2') == 'Today') %}
        #424242;
      {% endif %}
      border: 0px;
    }

elements:
  - type: image
    title: null
    entity: sensor.home_green_bin_2
    image: /local/images/icons8-waste-240-green.png
    state_filter:
      "unavailable": grayscale(100%) brightness(40%) drop-shadow(0px 0px 2px Red)
      "Failed to Update": grayscale(100%) brightness(40%) drop-shadow(0px 0px 2px Red)
      "Today": drop-shadow(0px 0px 4px Green) saturate(200%)
      "Tomorrow": drop-shadow(0px 0px 4px Green) saturate(150%)
    style:
      top: 46%
      left: 20%
      width: 12%
  - type: image
    title: null
    entity: sensor.home_green_bin_2
    image: /local/images/icons8-leave-240.png
    state_filter:
      "unavailable": grayscale(100%) brightness(40%) drop-shadow(0px 0px 2px Red)
      "Failed to Update": grayscale(100%) brightness(40%) drop-shadow(0px 0px 2px Red)
      "Monday": grayscale(100%)
      "Tuesday": grayscale(100%)
      "Wednesday": grayscale(100%)
      "Thursday": grayscale(100%)
      "Friday": grayscale(100%)
      "Saturday": grayscale(100%)
      "Sunday": grayscale(100%)
      "Today": drop-shadow(0px 0px 4px cyan) saturate(200%)
      "Tomorrow": drop-shadow(0px 0px 4px cyan) saturate(150%)
    state_image:
      "Failed to Update": /local/images/icons8-leave-240.png
      "Monday": /local/images/icons8-monday-240.png
      "Tuesday": /local/images/icons8-tuesday-240.png
      "Wednesday": /local/images/icons8-wednesday-240.png
      "Thursday": /local/images/icons8-thursday-240.png
      "Friday": /local/images/icons8-friday-240.png
      "Saturday": /local/images/icons8-saturday-240.png
      "Sunday": /local/images/icons8-sunday-240.png
      "Tomorrow": /local/images/icons8-tomorrow-240.png
      "Today": /local/images/icons8-today-240.png
    style:
      top: 63%
      left: 16%
      width: 8%
  - type: state-label
    entity: sensor.home_green_bin_2
    attribute: days
    tap_action:
      action: none
    hold_action:
      action: none
    style:
      top: 47%
      left: 20%
      font-weight: bold

  - type: image
    title: null
    entity: sensor.home_blue_bin_2
    image: /local/images/icons8-waste-240-blue.png
    state_filter:
      "unavailable": grayscale(100%) brightness(40%) drop-shadow(0px 0px 2px Red)
      "Failed to Update": grayscale(100%) brightness(40%) drop-shadow(0px 0px 2px Red)
      "Today": drop-shadow(0px 0px 4px Blue) saturate(200%)
      "Tomorrow": drop-shadow(0px 0px 4px Blue) saturate(150%)
    style:
      top: 46%
      left: 50%
      width: 12%
  - type: image
    title: null
    entity: sensor.home_blue_bin_2
    image: /local/images/icons8-leave-240.png
    state_filter:
      "unavailable": grayscale(100%) brightness(40%) drop-shadow(0px 0px 2px Red)
      "Failed to Update": grayscale(100%) brightness(40%) drop-shadow(0px 0px 2px Red)
      "Monday": grayscale(100%)
      "Tuesday": grayscale(100%)
      "Wednesday": grayscale(100%)
      "Thursday": grayscale(100%)
      "Friday": grayscale(100%)
      "Saturday": grayscale(100%)
      "Sunday": grayscale(100%)
      "Today": drop-shadow(0px 0px 4px cyan) saturate(200%)
      "Tomorrow": drop-shadow(0px 0px 4px cyan) saturate(150%)
    state_image:
      "Failed to Update": /local/images/icons8-leave-240.png
      "Monday": /local/images/icons8-monday-240.png
      "Tuesday": /local/images/icons8-tuesday-240.png
      "Wednesday": /local/images/icons8-wednesday-240.png
      "Thursday": /local/images/icons8-thursday-240.png
      "Friday": /local/images/icons8-friday-240.png
      "Saturday": /local/images/icons8-saturday-240.png
      "Sunday": /local/images/icons8-sunday-240.png
      "Tomorrow": /local/images/icons8-tomorrow-240.png
      "Today": /local/images/icons8-today-240.png
    style:
      top: 63%
      left: 46%
      width: 8%
  - type: state-label
    entity: sensor.home_blue_bin_2
    attribute: days
    tap_action:
      action: none
    hold_action:
      action: none
    style:
      top: 47%
      left: 50%
      font-weight: bold

  - type: image
    title: null
    entity: sensor.home_brown_bin_2
    image: /local/images/icons8-waste-240-brown.png
    state_filter:
      "unavailable": grayscale(100%) brightness(40%) drop-shadow(0px 0px 2px Red)
      "Failed to Update": grayscale(100%) brightness(40%) drop-shadow(0px 0px 2px Red)
      "Today": drop-shadow(0px 0px 4px Brown) saturate(200%)
      "Tomorrow": drop-shadow(0px 0px 4px Brown) saturate(150%)
    style:
      top: 46%
      left: 80%
      width: 12%
  - type: image
    title: null
    entity: sensor.home_brown_bin_2
    image: /local/images/icons8-leave-240.png
    state_filter:
      "unavailable": grayscale(100%) brightness(40%) drop-shadow(0px 0px 2px Red)
      "Failed to Update": grayscale(100%) brightness(40%) drop-shadow(0px 0px 2px Red)
      "Monday": grayscale(100%)
      "Tuesday": grayscale(100%)
      "Wednesday": grayscale(100%)
      "Thursday": grayscale(100%)
      "Friday": grayscale(100%)
      "Saturday": grayscale(100%)
      "Sunday": grayscale(100%)
      "Today": drop-shadow(0px 0px 4px cyan) saturate(200%)
      "Tomorrow": drop-shadow(0px 0px 4px cyan) saturate(150%)
    state_image:
      "Failed to Update": /local/images/icons8-leave-240.png
      "Monday": /local/images/icons8-monday-240.png
      "Tuesday": /local/images/icons8-tuesday-240.png
      "Wednesday": /local/images/icons8-wednesday-240.png
      "Thursday": /local/images/icons8-thursday-240.png
      "Friday": /local/images/icons8-friday-240.png
      "Saturday": /local/images/icons8-saturday-240.png
      "Sunday": /local/images/icons8-sunday-240.png
      "Tomorrow": /local/images/icons8-tomorrow-240.png
      "Today": /local/images/icons8-today-240.png
    style:
      top: 63%
      left: 76%
      width: 8%
  - type: state-label
    entity: sensor.home_brown_bin_2
    attribute: days
    tap_action:
      action: none
    hold_action:
      action: none
    style:
      top: 47%
      left: 80%
      font-weight: bold


green_bin2
blue_bin2
brown_bin2
icons8-leave-240
icons8-monday-240
icons8-tuesday-240
icons8-wednesday-240
icons8-thursday-240
icons8-friday-240
icons8-saturday-240
icons8-sunday-240
icons8-today-240
icons8-tomorrow-240

This thread popped up when I was looking for a way to display bin collections using images.

My current “sensor” in my Configuration.yaml is:

sensor:
  - platform: template
    sensors:
      bin_week:
        friendly_name: "Bin Week"
        value_template: >- 
          {% if ((((as_timestamp(now()) - 18000) % 1209600) / 604800) | int) == 0 %}
            {{ "Recycling"}}
          {% else %}
            {{ "General"}}
          {% endif %}

18000 = Unix Timestamp of the first Thursday, 5am UTC (when my bins get collected)
1209600 = The seconds in 2 weeks (2 week collection cycle)
604800 = The seconds in 1 week (used to show which of the weeks we’re in)

The math returns a 0 for the first week & 1 for the 2nd week (on a 2 week cycle, starting on Thursdays 5am)… which is then converted into the strings “Recycling” or “General”, for displaying in a normal entity card.