Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save jkraemer/3c211f1b505c9fb3389aefa7a91b04d8 to your computer and use it in GitHub Desktop.

Select an option

Save jkraemer/3c211f1b505c9fb3389aefa7a91b04d8 to your computer and use it in GitHub Desktop.
Home Assistant blueprint for Presence Activated Light automation
blueprint:
name: Presence Light
description: Turn on a light when presence is detected.
domain: automation
input:
presence_entity:
name: Presence Sensor
description: Presence sensor device
selector:
entity:
domain: binary_sensor
device_class: occupancy
light_target:
name: Light
description: The light to turn on
selector:
target:
entity:
domain: light
bright_percentage:
name: Bright Percentage
description: Brightness level that the light will turn into once is turned on
default: 100
selector:
number:
min: 0
max: 100
unit_of_measurement: percentage
on_transition:
name: Turning on transition
description: Time in seconds of transition turning on
default: 0
selector:
number:
min: 0
max: 10
unit_of_measurement: seconds
no_motion_wait:
name: Wait time
description: Time to wait after motion stops before turning off the light
default: 0
selector:
number:
min: 0
max: 3600
unit_of_measurement: seconds
off_transition:
name: Turning off transition
description: Time in seconds of transition turning off
default: 0
selector:
number:
min: 0
max: 10
unit_of_measurement: seconds
light_sensor:
name: Light sensor
description: Light sensor to read from
default: []
selector:
entity:
domain:
- sensor
device_class:
- illuminance
multiple: false
light_threshold:
name: Light threshold
description: Light sensor‘s lower threshold
default: 10
selector:
number:
min: 0
max: 255
mode: single
trigger:
platform: state
entity_id: !input presence_entity
from: "off"
to: "on"
condition:
- condition: numeric_state
entity_id: !input light_sensor
below: !input light_threshold
action:
- alias: "Turn on the light"
service: light.turn_on
target: !input light_target
data:
brightness_pct: !input bright_percentage
transition: !input on_transition
- alias: "Wait until there is no motion from device for the set time interval"
wait_for_trigger:
trigger: state
entity_id: !input presence_entity
from: "on"
to: "off"
for:
hours: 0
minutes: 0
seconds: !input no_motion_wait
continue_on_timeout: false
- alias: "Turn off the light"
service: light.turn_off
target: !input light_target
data:
transition: !input off_transition
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment