Skip to content

Instantly share code, notes, and snippets.

@samuolis
Last active October 3, 2022 06:08
Show Gist options
  • Save samuolis/24aae860612d517cfab764c8bbbcb2c8 to your computer and use it in GitHub Desktop.
Save samuolis/24aae860612d517cfab764c8bbbcb2c8 to your computer and use it in GitHub Desktop.
motion and occupancy clear blueprint
blueprint:
name: Motion and occupaancy Light switch off when both agreed
description: Turn off lights when no motion and occupancy.
domain: automation
input:
motion_entity:
name: Motion Sensor
selector:
entity:
domain: binary_sensor
device_class: motion
multiple: true
occupancy_entity:
name: Occupancy sensor
selector:
entity:
domain: binary_sensor
device_class: occupancy
multiple: true
no_motion_wait:
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
light_target:
name: Light to control
selector:
target:
entity:
domain: light
mode: restart
max_exceeded: silent
trigger:
- platform: state
entity_id: !input motion_entity
from: "on"
to: "off"
for: !input no_motion_wait
- platform: state
entity_id: !input occupancy_entity
from: "on"
to: "off"
for: !input no_motion_wait
condition:
- condition: and
conditions:
- condition: state
entity_id: !input motion_entity
state: "off"
for: !input no_motion_wait
- condition: state
entity_id: !input occupancy_entity
state: "off"
for: !input no_motion_wait
action:
- 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