Skip to content

Instantly share code, notes, and snippets.

@0xjams
Created September 15, 2022 03:45
Show Gist options
  • Save 0xjams/ddf2974aaf8248029ce72d6ff9d4cd39 to your computer and use it in GitHub Desktop.
Save 0xjams/ddf2974aaf8248029ce72d6ff9d4cd39 to your computer and use it in GitHub Desktop.
blueprint:
name: Door activated light (at night)
description: Turn the light on to brightness when door is open (depending on time interval)
domain: automation
input:
motion_entity:
name: Door Sensor
selector:
entity:
domain: binary_sensor
light_target:
name: Light
selector:
target:
entity:
domain: switch
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: {}
# If motion is detected within the delay,
# we restart the script.
mode: restart
max_exceeded: silent
trigger:
platform: state
entity_id: !input motion_entity
from: "off"
to: "on"
action:
- choose:
- conditions:
- condition: time
after: !input on_night_time
before: !input off_night_time
sequence:
- alias: "Turn on the light"
service: switch.turn_on
target: !input light_target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment