Good day everyone.
I have a LED light strip running down my staircase and have a sensor at the top and bottom of the stairs.
Currently I have 5 automations setup to run the effect basically.
Top stair trigger, so when the top stair triggers it turns on the light and sets a triggered state. then the bottom sensor has two automations based on the state (I still need to setup the if then actions automation to basically clean them up into one automation but that’s for later). 1 automation triggers the light to dim and turn off if the top sensor has been triggered. and the other runs the same light up sequence in reverse.
I need some help figuring out how to have the “turn off” sequence delay if another person enters the stairwell (follows the first trigger). I imagine having a counter and then having the turn off delay based on that counter being greater than 1 but I can’t figure out how to logically do it.
Top stair triggered initial
alias: PRESENCE_Stair lights on Top
description: Turn the stair lights on when top motions is detected.
trigger:
- platform: state
entity_id:
- binary_sensor.stair_sensor_top_stair_motion_top
to: "on"
condition:
- condition: state
entity_id: input_boolean.stair_auto_leds
state: "on"
- condition: state
entity_id: light.stairwell_bannister_light
state: "off"
- condition: state
entity_id: input_boolean.top_stair_sensor_tripped
state: "off"
action:
- service: input_boolean.turn_on
metadata: {}
data: {}
target:
entity_id: input_boolean.top_stair_sensor_tripped
- service: light.turn_on
metadata: {}
data: {}
target:
entity_id: light.stairwell_bannister_light_main
- service: select.select_option
metadata: {}
data:
option: Start Wipe
target:
entity_id: select.stairwell_bannister_light_preset
- service: timer.start
metadata: {}
data:
duration: "00:02:00"
target:
entity_id: timer.stair_motion_timer
enabled: true
- delay:
hours: 0
minutes: 0
seconds: 6
milliseconds: 0
- service: select.select_option
metadata: {}
data:
option: Solid WW
target:
entity_id: select.stairwell_bannister_light_preset
mode: single
Bottom Stair triggered second
description: >-
Turns the stair lights off when the bottom sensor picks up movement after
initial transition
trigger:
- platform: state
entity_id:
- binary_sensor.stair_sensor_bottom_stair_motion_bottom
to: "on"
condition:
- condition: state
entity_id: light.stairwell_bannister_light
state: "on"
- condition: state
entity_id: input_boolean.stair_auto_leds
state: "on"
- condition: state
entity_id: input_boolean.top_stair_sensor_tripped
state: "on"
action:
- service: light.turn_on
target:
entity_id: light.stairwell_bannister_light
data:
transition: 5
brightness: 1
rgbw_color:
- 0
- 0
- 0
- 255
effect: Solid
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
enabled: true
- service: light.turn_off
metadata: {}
data: {}
target:
entity_id: light.stairwell_bannister_light
- service: input_boolean.turn_off
target:
entity_id: input_boolean.top_stair_sensor_tripped
data: {}
mode: single
The state cleanup (catch all if someone goes down and back up the stairs halfway)
alias: Presence. Stair motion cleanup
description: >-
Resets the stair motion triggers after a two minute timer if the light is
still on.
trigger:
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.stair_motion_timer
id: Timer finished
condition:
- condition: or
conditions:
- condition: state
entity_id: input_boolean.bottom_stair_sensor_tripped
state: "on"
- condition: state
entity_id: input_boolean.top_stair_sensor_tripped
state: "on"
- condition: state
entity_id: light.stairwell_bannister_light
state: "on"
action:
- service: light.turn_on
target:
entity_id: light.stairwell_bannister_light
data:
transition: 5
brightness: 1
- service: light.turn_off
target:alias: PRESENCE_Stair lights on Top
description: Turn the stair lights on when top motions is detected.
trigger:
- platform: state
entity_id:
- binary_sensor.stair_sensor_top_stair_motion_top
to: "on"
condition:
- condition: state
entity_id: input_boolean.stair_auto_leds
state: "on"
- condition: state
entity_id: light.stairwell_bannister_light
state: "off"
- condition: state
entity_id: input_boolean.top_stair_sensor_tripped
state: "off"
action:
- service: input_boolean.turn_on
metadata: {}
data: {}
target:
entity_id: input_boolean.top_stair_sensor_tripped
- service: light.turn_on
metadata: {}
data: {}
target:
entity_id: light.stairwell_bannister_light_main
- service: select.select_option
metadata: {}
data:
option: Start Wipe
target:
entity_id: select.stairwell_bannister_light_preset
- service: timer.start
metadata: {}
entity_id: light.stairwell_bannister_light
data: {}
- service: input_boolean.turn_off
metadata: {}
data: {}
target:
entity_id:
- input_boolean.bottom_stair_sensor_tripped
- input_boolean.top_stair_sensor_tripped
mode: single
I’d appreciate some direction and advice please.
Thanks.