Skip to content

Instantly share code, notes, and snippets.

@zsarnett
Last active March 8, 2022 01:29
Show Gist options
  • Save zsarnett/36a112425d253ad09dd8f57056141b3b to your computer and use it in GitHub Desktop.
Save zsarnett/36a112425d253ad09dd8f57056141b3b to your computer and use it in GitHub Desktop.
Turn on light to custom brightness and warmness
blueprint:
name: "Turn on light to custom brightness and warmness"
description: "This Automation lights turn on when motion is detected in a room"
domain: automation
input:
motion:
name: "Motion Detector"
description: "This will be the motion detector device that triggers the lights to turn on"
selector:
entity:
domain: binary_sensor
device_class: motion
light:
name: Light
selector:
target:
entity:
domain: light
delay:
name: Wait time
description: Time to leave the light on after last motion is detected.
default: 60
selector:
number:
min: 0
max: 3600
unit_of_measurement: seconds
brightness:
name: Brightness
description: The brightness percentage you want to turn the lights on to.
default: 25
selector:
number:
min: 0
max: 100
unit_of_measurement: '%'
temp:
name: Color Temp
description: Color Temperature. Lower is bluer and higher is more orange.
default: 153
selector:
number:
min: 153
max: 370
unit_of_measurement: mireds
variables:
motion: !input motion
motion_device: "{{ device_id(motion) }}"
trigger:
type: motion
platform: device
device_id: "{{ motion_device }}"
entity_id: !input motion
domain: binary_sensor
action:
- service: light.turn_on
data:
transition: 1
brightness_pct: !input brightness
color_temp: !input temp
target: !input light
- wait_for_trigger:
platform: state
entity_id: !input motion
from: 'on'
to: 'off'
- delay: !input delay
- service: light.turn_off
target: !input light
# If motion is detected within the delay,
# we restart the script.
mode: restart
max_exceeded: silent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment