Skip to content

Instantly share code, notes, and snippets.

@kdorff
Created March 8, 2022 19:20
Show Gist options
  • Save kdorff/84f2557e93e71e7d8f7174296ba05318 to your computer and use it in GitHub Desktop.
Save kdorff/84f2557e93e71e7d8f7174296ba05318 to your computer and use it in GitHub Desktop.
Home Assistant Automations for WLED on my stairs
##
## Motion detected upstairs
## -----------------------------
## If (timer.stairs_motion_timer is not active AND
## input_boolean.wled_stairs_auto_enabled is on),
## this will configure and turn on the lights and
## set timer.stairs_motion_timer to 15 seconds.
##
## The lights will be turned off by the
## expiration of timer.stairs_motion_timer in the
## automation "Stairs Automation - Timer Lights Off"
##
- alias: Stairs Automation - Upper
description: ''
trigger:
- platform: state
id: Stairs Upper Motion Detected
entity_id: binary_sensor.stairs_upper_motion_sensor
to: 'on'
from: 'off'
condition:
- condition: and
conditions:
- condition: not
conditions:
- condition: state
entity_id: timer.stairs_motion_timer
state: active
- condition: state
entity_id: input_boolean.wled_stairs_auto_enabled
state: 'on'
action:
- service: number.set_value
data:
value: '220'
target:
entity_id: number.wled_stairs_speed
- service: switch.turn_off
data: {}
target:
entity_id: switch.wled_stairs_reverse
- service: light.turn_on
data:
effect: Wipe
rgb_color:
- 255
- 255
- 255
brightness_pct: 26
target:
entity_id:
- light.wled_stairs
- service: timer.start
data:
duration: 00:00:15
target:
entity_id: timer.stairs_motion_timer
mode: single
##
## Motion detected downstars
## -----------------------------
## If (timer.stairs_motion_timer is not active AND
## input_boolean.wled_stairs_auto_enabled is on),
## this will configure and turn on the lights and
## set timer.stairs_motion_timer to 15 seconds.
##
## The lights will be turned off by the
## expiration of timer.stairs_motion_timer in the
## automation "Stairs Automation - Timer Lights Off"
##
- alias: Stairs Automation - Lower
description: ''
trigger:
- platform: state
id: Stairs Upper Motion Detected
entity_id: binary_sensor.stairs_lower_motion_sensor
to: 'on'
from: 'off'
condition:
- condition: and
conditions:
- condition: not
conditions:
- condition: state
entity_id: timer.stairs_motion_timer
state: active
- condition: state
entity_id: input_boolean.wled_stairs_auto_enabled
state: 'on'
action:
- service: number.set_value
data:
value: '220'
target:
entity_id: number.wled_stairs_speed
- service: switch.turn_on
data: {}
target:
entity_id: switch.wled_stairs_reverse
- service: light.turn_on
data:
effect: Wipe
rgb_color:
- 255
- 255
- 255
brightness_pct: 26
target:
entity_id:
- light.wled_stairs
- service: timer.start
data:
duration: 00:00:15
target:
entity_id: timer.stairs_motion_timer
mode: single
##
## Timer Expired, turn off the lights
## -----------------------------
## The timer has expired. Turn the stair
## lights off.
##
- alias: Stairs Automation - Timer Lights Off
description: ''
trigger:
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.stairs_motion_timer
condition: []
action:
- service: light.turn_off
data: {}
target:
device_id: light.wled_stairs
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment