Skip to content

Instantly share code, notes, and snippets.

@Kirbo
Last active May 9, 2021 23:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kirbo/182b3c25ce8bd5ee97c2f72bce4bdf64 to your computer and use it in GitHub Desktop.
Save Kirbo/182b3c25ce8bd5ee97c2f72bce4bdf64 to your computer and use it in GitHub Desktop.
blueprint:
name: Automate window cover
description: Automatically open and close window cover.
domain: automation
input:
window_cover:
name: Window cover
description: Which window cover to open/close.
selector:
entity:
domain: cover
window_sensor:
name: Window sensor
description: Binary sensor that prevents window cover to close, if this state is "on".
selector:
entity:
domain: binary_sensor
device_class: window
window_closed_delay:
name: Window closed delay
description: Delay when to close window cover, after the Window Sensor state goes to "off"
selector:
number:
min: 0
max: 120
step: 1
mode: slider
unit_of_measurement: seconds
default: 5
workday_sensor:
name: Workday sensor
description: Workday sensor, read more [here](https://www.home-assistant.io/integrations/workday/).
selector:
entity:
domain: binary_sensor
days_to_trigger:
name: Trigger on
description: On which days do you want this automation to trigger.
selector:
select:
options:
- Workdays
- Weekends
- Everyday
default: Everyday
time_to_open:
name: Time to open
description: Time to open the window cover.
selector:
time:
default: "07:00:00"
position_to_open:
name: Position to open the window cover to.
selector:
number:
min: 0
max: 100
step: 1
mode: slider
unit_of_measurement: "%"
default: 100
time_to_close:
name: Time to close
description: Time to close the window cover.
selector:
time:
default: "21:00:00"
position_to_close:
name: Position to close the window cover to.
selector:
number:
min: 0
max: 100
step: 1
mode: slider
unit_of_measurement: "%"
default: 0
trigger:
- platform: state
entity_id: !input window_sensor
from: "on"
to: "off"
for:
seconds: !input window_closed_delay
- platform: time
at: !input time_to_open
- platform: time
at: !input time_to_close
action:
- choose:
# Open the window cover
- conditions:
- condition: time
after: !input time_to_open
before: !input time_to_close
- condition: state
entity_id: !input workday_sensor
state: "{{ days_to_trigger == 'Workdays' OR days_to_trigger == 'Everyday' }}"
sequence:
- service: cover.set_cover_position
target:
entity_id: !input window_cover
data:
position: !input position_to_open
# Close the window cover
- conditions:
- condition: time
after: !input time_to_close
before: !input time_to_open
- condition: state
entity_id: !input workday_sensor
state: "{{ days_to_trigger == 'Workdays' OR days_to_trigger == 'Everyday' }}"
- condition: state
entity_id: !input window_sensor
state: "off"
sequence:
- service: cover.set_cover_position
target:
entity_id: !input window_cover
data:
position: !input position_to_close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment