forked from EPMatt/awesome-ha-blueprints
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cover.yaml
182 lines (176 loc) · 7.82 KB
/
cover.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# Blueprint metadata
blueprint:
name: Hook - Cover
description: |
# Hook - Cover
Hook automation which allows to control a cover. Supports opening, closing and tilting the cover. Features may vary depending on the selected cover. Features may vary depending on the selected Controller.
An automation created with this blueprint must be linked to a [Controller](https://epmatt.github.io/awesome-ha-blueprints/blueprints/controllers) automation.
Controllers are blueprints which allow to easily integrate a wide range of controllers (wall switches, remotes, dimmers, etc.) and use them to run a set of actions when interacting with them.
They expose an abstract interface used by Hooks to create controller-based automations.
A list of controllers supported by this hook is available [here](https://epmatt.github.io/awesome-ha-blueprints/docs/blueprints/hooks/cover#supported-controllers).
📕 Full documentation regarding this blueprint is available [here](https://epmatt.github.io/awesome-ha-blueprints/docs/blueprints/hooks/cover).
🚀 This blueprint is part of the **[Awesome HA Blueprints](https://epmatt.github.io/awesome-ha-blueprints) project**.
ℹ️ Version 2022.07.30
source_url: https://github.com/EPMatt/awesome-ha-blueprints/blob/main/blueprints/hooks/cover/cover.yaml
domain: automation
input:
controller_device:
name: (Required) Controller Device
description: The controller device which will control the Cover. Choose a value only if the integration used to connect the controller to Home Assistant exposes it as a Device. This value should match the one specified in the corresponding Controller automation.
default: ''
selector:
device:
controller_entity:
name: (Required) Controller Entity
description: The controller entity which will control the Cover. Choose a value only if the integration used to connect the controller to Home Assistant exposes it as an Entity. This value should match the one specified in the corresponding Controller automation.
default: ''
selector:
entity:
domain: sensor
controller_model:
name: (Required) Controller model
description: The model for the controller used in this automation. Choose a value from the list of supported controllers.
selector:
select:
options:
- IKEA E1524/E1810 TRÅDFRI Wireless 5-Button Remote
- IKEA E1743 TRÅDFRI On/Off Switch & Dimmer
- IKEA E1766 TRÅDFRI Open/Close Remote
- IKEA E1812 TRÅDFRI Shortcut button
- SONOFF SNZB-01 Wireless Switch
- Xiaomi WXCJKG11LM Aqara Opple 2 button remote
- Xiaomi WXCJKG12LM Aqara Opple 4 button remote
- Xiaomi WXCJKG12LM Aqara Opple 4 button remote (#2)
- Xiaomi WXCJKG13LM Aqara Opple 6 button remote
- Xiaomi WXCJKG13LM Aqara Opple 6 button remote (#2)
- Xiaomi WXCJKG13LM Aqara Opple 6 button remote (#3)
- Xiaomi WXKG11LM Aqara Wireless Switch Mini
cover:
name: (Required) Cover
description: Cover which will be controlled with this automation.
selector:
entity:
domain: cover
# Automation schema
variables:
# convert blueprint inputs into variables to be used in templates
controller_model: !input controller_model
# supported controllers and mappings
controller_mapping:
IKEA E1524/E1810 TRÅDFRI Wireless 5-Button Remote:
open_cover: button_up_short
close_cover: button_down_short
close_cover_tilt: button_left_short
open_cover_tilt: button_right_short
stop_cover_all: button_center_short
IKEA E1743 TRÅDFRI On/Off Switch & Dimmer:
open_cover: button_up_short
open_cover_tilt: button_up_long
close_cover: button_down_short
close_cover_tilt: button_down_long
stop_cover_all: button_down_double
IKEA E1766 TRÅDFRI Open/Close Remote:
open_cover: button_up_short
close_cover: button_down_short
stop_cover_all: button_down_double
IKEA E1812 TRÅDFRI Shortcut button:
open_cover: button_short
stop_cover_all: button_long
close_cover: button_double
SONOFF SNZB-01 Wireless Switch:
open_cover: button_short
stop_cover_all: button_long
close_cover: button_double
Xiaomi WXCJKG11LM Aqara Opple 2 button remote:
open_cover: button_1_short
open_cover_tilt: button_1_long
close_cover: button_2_short
close_cover_tilt: button_2_long
stop_cover_all: button_2_double
Xiaomi WXCJKG12LM Aqara Opple 4 button remote:
open_cover: button_1_short
open_cover_tilt: button_1_long
close_cover: button_2_short
close_cover_tilt: button_2_long
stop_cover_all: button_2_double
Xiaomi WXCJKG12LM Aqara Opple 4 button remote (#2):
open_cover: button_3_short
open_cover_tilt: button_3_long
close_cover: button_4_short
close_cover_tilt: button_4_long
stop_cover_all: button_4_double
Xiaomi WXCJKG13LM Aqara Opple 6 button remote:
open_cover: button_1_short
open_cover_tilt: button_1_long
close_cover: button_2_short
close_cover_tilt: button_2_long
stop_cover_all: button_2_double
Xiaomi WXCJKG13LM Aqara Opple 6 button remote (#2):
open_cover: button_3_short
open_cover_tilt: button_3_long
close_cover: button_4_short
close_cover_tilt: button_4_long
stop_cover_all: button_4_double
Xiaomi WXCJKG13LM Aqara Opple 6 button remote (#3):
open_cover: button_5_short
open_cover_tilt: button_5_long
close_cover: button_6_short
close_cover_tilt: button_6_long
stop_cover_all: button_6_double
Xiaomi WXKG11LM Aqara Wireless Switch Mini:
open_cover: button_short
stop_cover_all: button_long
close_cover: button_double
# pre-choose actions for buttons based on configured controller
# no need to perform this task at automation runtime
open_cover: '{{ controller_mapping[controller_model]["open_cover"] | default(None) }}'
close_cover: '{{ controller_mapping[controller_model]["close_cover"] | default(None) }}'
open_cover_tilt: '{{ controller_mapping[controller_model]["open_cover_tilt"] | default(None) }}'
close_cover_tilt: '{{ controller_mapping[controller_model]["close_cover_tilt"] | default(None) }}'
stop_cover_all: '{{ controller_mapping[controller_model]["stop_cover_all"] | default(None) }}'
mode: restart
max_exceeded: silent
trigger:
- platform: event
event_type: ahb_controller_event
event_data:
controller: !input controller_device
- platform: event
event_type: ahb_controller_event
event_data:
controller: !input controller_entity
condition: []
action:
- variables:
action: '{{ trigger.event.data.action }}'
- choose:
- conditions: '{{ action == open_cover }}'
sequence:
- service: cover.open_cover
entity_id: !input cover
- conditions: '{{ action == close_cover }}'
sequence:
- service: cover.close_cover
entity_id: !input cover
- conditions: '{{ action == stop_cover }}'
sequence:
- service: cover.stop_cover
entity_id: !input cover
- conditions: '{{ action == open_cover_tilt }}'
sequence:
- service: cover.open_cover_tilt
entity_id: !input cover
- conditions: '{{ action == close_cover_tilt }}'
sequence:
- service: cover.close_cover_tilt
entity_id: !input cover
- conditions: '{{ action == stop_cover_tilt }}'
sequence:
- service: cover.stop_cover_tilt
entity_id: !input cover
- conditions: '{{ action == stop_cover_all }}'
sequence:
- service: cover.stop_cover
entity_id: !input cover
- service: cover.stop_cover_tilt
entity_id: !input cover