-
Notifications
You must be signed in to change notification settings - Fork 0
/
conditional-close-blinds.yaml
60 lines (56 loc) · 1.66 KB
/
conditional-close-blinds.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
blueprint:
name: Conditional Close Blinds
description: Conditionally close blinds depending on if the window is open. When the window is open, allow cover to close half way, or stay open and automatically close once the window has shut.
domain: automation
source_url: https://github.com/cjmaio/ha-blueprints/blob/master/conditional-close-blinds.yaml
input:
cover:
name: Cover
selector:
entity:
domain: cover
window_sensor:
name: Window Sensor
selector:
entity:
domain: binary_sensor
device_class: window
open_window_cover_close_pct:
name: Open Window Cover Close Percentage
default: 50
selector:
number:
min: 0
max: 100
step: 1
unit_of_measurement: "%"
mode: slider
variables:
cover: !input cover
open_window_cover_close_pct: !input open_window_cover_close_pct
window_sensor: !input window_sensor
trigger:
- platform: sun
event: sunset
- platform: state
entity_id: !input window_sensor
to: "off"
condition:
- condition: sun
before: sunrise
after: sunset
action:
- service: cover.set_cover_position
target:
entity_id: !input cover
data_template:
position: >
{% if is_state(window_sensor, 'on') %} {{open_window_cover_close_pct}} {% else %} 0 {% endif %}
- delay:
seconds: 20
- service: cover.set_cover_position
target:
entity_id: !input cover
data_template:
position: >
{% if is_state(window_sensor, 'on') -%} {{open_window_cover_close_pct}} {%- else -%} 0 {%- endif %}