Last active
December 31, 2022 23:52
-
-
Save cjmaio/f3cf5cf79915d91d75d7b0e0627c4686 to your computer and use it in GitHub Desktop.
Motion Activated Lights (Time of Day / Hold)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Motion Activated Lights (Time of Day / Hold) | |
description: Activate lights to brightness based on time of day, turn off lights based on hold state after selected time period | |
domain: automation | |
input: | |
motion_entity: | |
name: Motion Sensor | |
selector: | |
entity: | |
domain: binary_sensor | |
device_class: motion | |
light_target: | |
name: Light | |
selector: | |
target: | |
entity: | |
domain: light | |
hold_entity: | |
name: Hold Boolean | |
selector: | |
entity: | |
domain: input_boolean | |
on_night_time: | |
name: (Required) On Time Night | |
description: The time when the night mode starts. | |
selector: | |
time: {} | |
off_night_time: | |
name: (Required) Off Time Night | |
description: The time when the night mode ends. | |
selector: | |
time: {} | |
day_brightness: | |
name: Day brightness | |
description: Brightness, in daytime mode | |
default: 1 | |
selector: | |
number: | |
min: 1.0 | |
max: 100.0 | |
step: 1.0 | |
mode: slider | |
night_brightness: | |
name: Night brightness | |
description: Brightness, in night mode mode | |
default: 1 | |
selector: | |
number: | |
min: 1.0 | |
max: 100.0 | |
step: 1.0 | |
mode: slider | |
no_motion_wait_day: | |
name: Wait time day | |
description: Time to leave the light on after detecting the last movement for daytime mode. | |
default: 120 | |
selector: | |
number: | |
min: 0 | |
max: 3600 | |
unit_of_measurement: seconds | |
no_motion_wait_night: | |
name: Wait time night | |
description: Time to leave the light on after detecting the last movement in night mode | |
default: 120 | |
selector: | |
number: | |
min: 0 | |
max: 3600 | |
unit_of_measurement: seconds | |
# If motion is detected within the delay, | |
# we restart the script. | |
mode: restart | |
max_exceeded: silent | |
trigger: | |
- platform: state | |
entity_id: !input hold_entity | |
- platform: state | |
entity_id: !input motion_entity | |
action: | |
- choose: | |
- conditions: | |
- condition: state | |
entity_id: !input motion_entity | |
state: "on" | |
- condition: time | |
after: !input on_night_time | |
before: !input off_night_time | |
sequence: | |
- alias: "Turn on the light" | |
service: light.turn_on | |
data: | |
brightness_pct: !input night_brightness | |
target: !input light_target | |
- conditions: | |
- condition: state | |
entity_id: !input motion_entity | |
state: "on" | |
- condition: time | |
after: !input off_night_time | |
before: !input on_night_time | |
sequence: | |
- alias: "Turn on the light" | |
service: light.turn_on | |
data: | |
brightness_pct: !input day_brightness | |
target: !input light_target | |
- conditions: | |
- condition: state | |
entity_id: !input motion_entity | |
state: "off" | |
- condition: state | |
entity_id: !input hold_entity | |
state: "off" | |
sequence: | |
- alias: "Turn off the light" | |
service: light.turn_off | |
target: !input light_target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment