Skip to content

Instantly share code, notes, and snippets.

@zsarnett
Last active March 5, 2022 02:55
Show Gist options
  • Save zsarnett/85ac077018e44b09e66d470a8f9a1ded to your computer and use it in GitHub Desktop.
Save zsarnett/85ac077018e44b09e66d470a8f9a1ded to your computer and use it in GitHub Desktop.
Open Blinds when motion is detected at a Certain Time of day
blueprint:
name: "Open Blinds when motion is detected at a Certain Time of day"
description: "This Automation has your Blinds open 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 blinds to open"
selector:
entity:
domain: binary_sensor
device_class: motion
blind:
name: "Blinds"
description: "This is the blind to control"
selector:
target:
entity:
domain: cover
start_time:
name: "Time to start looking for motion"
description: "This will be the time the automation starts looking for motion"
default: "07:00:00"
selector:
time:
end_time:
name: "Time to stop looking for motion"
description: "This will be the time the automation stops looking for motion (Recommendation - 3-4 hours between start and end)"
default: "11:00:00"
selector:
time:
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
condition:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
- sat
- sun
before: !input end_time
after: !input start_time
- condition: template
value_template: "{{as_timestamp(this.attributes.last_triggered)|timestamp_custom('%-d') != as_timestamp(now())|timestamp_custom('%-d')}}"
action:
service: cover.open_cover
target: !input blind
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment