Skip to content

Instantly share code, notes, and snippets.

@peyanski
Last active March 12, 2021 09:05
Show Gist options
  • Save peyanski/e4795f8a85d0d2ee55bb9fde42cef892 to your computer and use it in GitHub Desktop.
Save peyanski/e4795f8a85d0d2ee55bb9fde42cef892 to your computer and use it in GitHub Desktop.
Shelly Motion Blueprint
blueprint:
name: ShellyMotionSensor-activated Light KP
description: Turn on a light when motion is detected.
domain: automation
source_url: https://gist.github.com/peyanski/e4795f8a85d0d2ee55bb9fde42cef892
input:
motion_entity:
name: Motion Sensor
selector:
entity:
domain: sensor
light_target:
name: Light
selector:
target:
entity:
domain: light
no_motion_wait:
name: Wait time
description: Time to leave the light on after last motion is detected.
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 motion_entity
from: "False"
to: "True"
action:
- service: light.turn_on
target: !input light_target
- wait_for_trigger:
platform: state
entity_id: !input motion_entity
from: "True"
to: "False"
- delay: !input no_motion_wait
- 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