Bin Reminders
Ah the bins... Do you forget to take them out? Do you remember which ones need to actually be taken out that day? Do you struggle to remember to bring them back in? If you answered yes to any of that, then this blog post may well be for you.
I live in the UK and love home automation. I've been messing around with various systems for over 15 years. While I am currently migrating away from Openhab to Home assistant, I have been looking at what I can do to automate my life even more.
Firstly... The bins. I never seem to want to put the bins out, and I need to be nagged to do so. Not great when you live alone. So, first requirement then: Multiple reminders. If I do it, I don't want the later reminders. I also only want to be told to do it when I'm home.
If I put the bins out, I want to be reminded to bring them back in. I'm not saying someone is nicking bins around here, but I haven't seen one of my black bins in a while... Again, If I do bring them back in, or I don't put them out, I don't want to be pestered.
Lastly, I have to remember which bins go out when. I have used a calendar for this in the past, but my local authority posts the schedule on their website.
Just to add, I have a mobile phone with the home assistant app on it along with some RFID tags (qr codes can be used instead). This would give me a way to keep track of if I'm in and which bins I've put out / brought in.
The ideas here were robbed in part from Lewis' blog post and Reed's. While both are close, neither are exactly what I want.
Starting with the software install side of things, you will need Home assistant and HACS install. I used the "Waste Collection Schedule" component. This gave me calendar entries, and was a good starting point. In addition, I set up sensors for each of my bin type (nb, my sensors are in a separate file to configuration.yaml, although they could live there, just add "sensor:" and indent):
- platform: waste_collection_schedule
name: Black Bin schedule
value_template: "{{ value.daysTo }}"
details_format: upcoming
types:
- Black bin
My first automation then was to setup an alarm to prompt me with which bins I need to put out. I'm being lazy here, as I haven't done the work to combine everything in to single messages. My first reminder looks like this (in yaml):
alias: Bin Alarm
description: ""
trigger:
- platform: calendar
event: start
offset: "-12:0:0"
entity_id: calendar.stockport_council
condition: []
action:
- service: notify.mobile_app_pixel_7a
data:
message: "Bins: {{ trigger.calendar_event.summary }}"
mode: parallel
Ok. So now at midday the day before the bins are due out, I get a prompt. Next, I needed to be reminded if I put the bins out or not. For this, I got an RFID tag for each bin (I actually have 5 bin of 4 refuse types - 2 black bins). Each bin needed it's own tag. Tags are created under "Settings -> Tags".
At this stage I also created a toggle helper for each tag, named after the bin. Scan the tag, toggle the helper. Scan on putting out and return and that's done.
alias: Bin toggles
description: ""
trigger:
- platform: tag
tag_id: bfa7b1dc-486d-446f-81f2-a9ce3afbd7d4
id: Black 1
- platform: tag
tag_id: e4d111fe-7fc2-4997-bcec-e5986171f89a
id: Black 2
- platform: tag
tag_id: 5ac8cf8c-b1c6-46af-ae9c-65220fea5d97
id: Blue
- platform: tag
tag_id: abd5211c-d505-4de3-b81b-b088c34b9869
id: Brown
- platform: tag
tag_id: 056ee186-7e4e-4f25-9de6-4758fd2606f6
id: Green
condition: []
action:
- if:
- condition: trigger
id: Black 1
then:
- service: input_boolean.toggle
data: {}
target:
entity_id: input_boolean.black_bin_1
- if:
- condition: trigger
id: Black 2
then:
- service: input_boolean.toggle
data: {}
target:
entity_id: input_boolean.black_bin_2
- if:
- condition: trigger
id: Green
then:
- service: input_boolean.toggle
data: {}
target:
entity_id: input_boolean.green_bin
- if:
- condition: trigger
id: Blue
then:
- service: input_boolean.toggle
data: {}
target:
entity_id: input_boolean.blue_bin
- if:
- condition: trigger
id: Brown
then:
- service: input_boolean.toggle
data: {}
target:
entity_id: input_boolean.brown_bin
mode: single
Lastly, in terms of notifications I want them to display on my fire stick, my pixel 7a and send me a telegram message. For the FireTV, I use an app on the firestick and that works quite nicely for notifications. It's even called notifications :-)
So, now to tell home assistant which bins go out when and if I have put them out:
alias: Bin schedule Reminders - Take out
description: ""
trigger:
- platform: time
at: "20:00:00"
- platform: time
at: "21:00:00"
- platform: time
at: "22:00:00"
- platform: time
at: "23:00:00"
condition:
- condition: or
conditions:
- condition: and
conditions:
- condition: state
entity_id: sensor.green_bin_schedule
state: "1"
- condition: state
entity_id: input_boolean.green_bin
state: "off"
- condition: and
conditions:
- condition: state
entity_id: sensor.brown_bin_schedule
state: "1"
- condition: state
entity_id: input_boolean.brown_bin
state: "off"
- condition: and
conditions:
- condition: state
entity_id: sensor.blue_bin_schedule
state: "1"
- condition: state
entity_id: input_boolean.blue_bin
state: "off"
- condition: and
conditions:
- condition: state
entity_id: sensor.black_bin_schedule
state: "1"
- condition: or
conditions:
- condition: state
entity_id: input_boolean.black_bin_1
state: "off"
- condition: state
entity_id: input_boolean.black_bin_2
state: "off"
- condition: state
entity_id: device_tracker.pixel_7a_3
state: home
action:
- service: telegram_bot.send_message
data:
message: Take out the bins!
- service: notify.android_tv_fire_tv
data:
message: Take out the bins!
- service: notify.mobile_app_pixel_7a
data:
message: Take out the bins
mode: single
and to bring them back in:
alias: Bin schedule Reminders - Bring in
description: ""
trigger:
- platform: time
at: "20:00:00"
- platform: time
at: "21:00:00"
- platform: time
at: "22:00:00"
- platform: time
at: "23:00:00"
condition:
- condition: or
conditions:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.green_bin
state: "on"
- condition: not
conditions:
- condition: state
entity_id: sensor.green_bin_schedule
state: "1"
- condition: and
conditions:
- condition: state
entity_id: input_boolean.brown_bin
state: "on"
- condition: not
conditions:
- condition: state
entity_id: sensor.brown_bin_schedule
state: "1"
- condition: and
conditions:
- condition: not
conditions:
- condition: state
entity_id: sensor.blue_bin_schedule
state: "1"
- condition: state
entity_id: input_boolean.blue_bin
state: "on"
- condition: and
conditions:
- condition: not
conditions:
- condition: state
entity_id: sensor.black_bin_schedule
state: "1"
- condition: or
conditions:
- condition: state
entity_id: input_boolean.black_bin_1
state: "on"
- condition: state
entity_id: input_boolean.black_bin_2
state: "on"
- condition: state
entity_id: device_tracker.pixel_7a_3
state: home
action:
- service: telegram_bot.send_message
data:
message: Bring in the Bin!
- service: notify.android_tv_fire_tv
data:
message: Bring in the bins!!!
- service: notify.mobile_app_pixel_7a
data:
message: Bring in the bins!
mode: single