I’m using the UK bin collection add on and was wondering if there was any way of changing the colour of an LED strip to a relevant colour to remind them. It needs to be on from 6pm the night before the bin goes out till 8:30am the next morning.
Green light for Green bin
Blue light for Black bin
Pink light for Pink lid bin
I’ve had a go at it but that didn’t work (see image).
I’ve got absolutely no idea how to do it
Help would be greatly appreciated
I’m sure I’ve seen a post somewhere on how to do it but can’t find it.
Thanks
I think your trigger didn’t work because sensor attributes are stored as data types, and your trigger is checking for a change in a string (because of the quotes).
Put this into Developer Tools > Template to confirm what the data type is:
{{ state_attr('sensor.rotherham_pink_lid_bin_3', 'days') }}
It will probably say ‘Result type: number’. I suspect removing the quotes around the numbers would make the trigger work.
On the other hand, if you want the light to come on at 6pm, and turn off at 8.30am, you should probably be using a time trigger, then checking in a condition what the days
attribute on the sensor is (if it == 2
), so it only runs on the relevant day.
Finally, it’s easier to get help if you post your automation as YAML, rather than a picture:
- in the Automation Editor UI, click the 3 dots top-right
- choose ‘Edit in YAML’
- choose ‘COPY TO CLIPBOARD’ (bottom left)
- paste in your forum post surrounded by backticks, to make the code appear formatted properly
Thanks, I’ll give that a try tomorrow and report back🤞🏻
I should have posted the yaml but my mrs was pecking my head as she wanted to go out, I already had the screenshot so it was quicker for me to use that.
I’ve just tried it, it says
Result type: number
2
There is 2 days left till collection
I’ve changed it to this
alias: Bin Pink light
description: ""
triggers:
- trigger: state
entity_id:
- sensor.rotherham_pink_lid_bin_3
attribute: days
from: 2
to: 1
conditions: []
actions:
- data:
rgb_color:
- 242
- 0
- 200
brightness_pct: 100
target:
entity_id: light.led_strip_light
action: light.turn_on
mode: single
Let’s hope it works! Keep us posted
It normally changes in the early hours of the morning, I’ll see if the light is on when I wake up
This morning the light was on
Next part is the time setting, what would I need to do to get it to come on and turn off at the required times?
I scrape my local councils website for the data, rather than use an addon (which up until now I didnt know existed :))
Here’s my automation that sends a nag to a tts device, and also sends a push notification to a phone. Both happen every 30 minutes between 7pm and 10pm the night before:-
alias: "Bins: Waste - Day before reminder"
description: ""
mode: single
triggers:
- minutes: /30
trigger: time_pattern
conditions:
- condition: template
value_template: >-
{{ now().month ==
(strptime(states('sensor.black_waste_bin_collection_date'), '%d %B
%Y').date().strftime('%m') | int) and now().day ==
((strptime(states('sensor.black_waste_bin_collection_date'), '%d %B
%Y').date().strftime('%d') | int) -1)}}
- condition: time
after: "19:00:00"
before: "22:00:00"
- condition: state
entity_id: input_boolean.bins_are_out
state: "off"
actions:
- data:
message: Waste and recycling is collected tomorrow.
title: Bins
action: notify.mobile_app_my_phone
- target:
entity_id: tts.piper
data:
cache: true
media_player_entity_id: media_player.s3_box_3_lounge_s3_box_media_player
message: Put the bins, out. Waste and recycling is collected tomorrow.
action: tts.speak
I have a different sensor and automation for just the recycling only collection so I know which bins to actually put out.
I’ve been having a play today and have started again, this seems to work better. I want to repeat the Alexa notification apparently the best way is by using alert but I’m not sure how do do it, I’m looked at the examples but it’s not making much sense to me.
This is the new automation
alias: Bin Black Test alert
description: ""
triggers:
- trigger: time
at: "17:45:00"
conditions:
- condition: numeric_state
entity_id: sensor.rotherham_black_bin_3
attribute: days
below: 2
actions:
- data:
rgb_color:
- 0
- 0
- 255
brightness_pct: 100
target:
entity_id: light.led_strip_light
action: light.turn_on
- action: notify.mobile_app_blobfishs_iphone
data:
message: The Black Bin is being collected tomorrow
- action: notify.alexa_media_kitchen_echo
metadata: {}
data:
message: The Black Bin is being collected tomorrow
mode: single