Skip to content

Commit e3ca50b

Browse files
cdce8pfabaff
authored andcommitted
Simplyfied scripts (home-assistant#3473)
- Simplyfied scripts using service_template - Changed "all_covers" to "cover_gorup"
1 parent a72cfa7 commit e3ca50b

File tree

1 file changed

+22
-30
lines changed

1 file changed

+22
-30
lines changed

source/_components/cover.template.markdown

+22-30
Original file line numberDiff line numberDiff line change
@@ -170,27 +170,33 @@ This example allows you to control two or more covers at once.
170170
```yaml
171171
homeassistant:
172172
customize:
173-
all_covers:
173+
cover_group:
174174
assume_state: true
175175
176176
cover:
177177
- platform: template
178178
covers:
179-
all_covers:
180-
friendly_name: "All Covers"
179+
cover_group:
180+
friendly_name: "Cover Group"
181181
open_cover:
182-
service: script.cover_all_open
182+
service: script.cover_group
183+
data:
184+
modus: 'open'
183185
close_cover:
184-
service: script.cover_all_close
186+
service: script.cover_group
187+
data:
188+
modus: 'close'
185189
stop_cover:
186-
service: script.cover_all_stop
190+
service: script.cover_group
191+
data:
192+
modus: 'stop'
187193
set_cover_position:
188-
service: script.cover_all_set_position
194+
service: script.cover_group_position
189195
data_template:
190-
position: "{{ position }}"
191-
value_template: "{{ is_state('sensor.all_covers', 'open') }}"
196+
position: "{{position}}"
197+
value_template: "{{is_state('sensor.cover_group', 'open')}}"
192198
icon_template: >-
193-
{% if is_state('sensor.all_covers', 'open') %}
199+
{% if is_state('sensor.cover_group', 'open') %}
194200
mdi:window-open
195201
{% else %}
196202
mdi:window-closed
@@ -202,7 +208,7 @@ cover:
202208
sensor:
203209
- platform: template
204210
sensors:
205-
all_covers:
211+
cover_group:
206212
value_template: >-
207213
{% if is_state('cover.bedroom', 'open') %}
208214
open
@@ -216,35 +222,21 @@ sensor:
216222
- cover.livingroom
217223
218224
script:
219-
cover_all_open:
220-
sequence:
221-
- service: cover.open_cover
222-
data:
223-
entity_id:
224-
- cover.bedroom
225-
- cover.livingroom
226-
cover_all_stop:
227-
sequence:
228-
- service: cover.stop_cover
229-
data:
230-
entity_id:
231-
- cover.bedroom
232-
- cover.livingroom
233-
cover_all_close:
225+
cover_group:
234226
sequence:
235-
- service: cover.close_cover
227+
- service_template: "cover.{{modus}}_cover"
236228
data:
237229
entity_id:
238230
- cover.bedroom
239231
- cover.livingroom
240-
cover_all_set_position:
232+
cover_group_position:
241233
sequence:
242234
- service: cover.set_cover_position
243235
data_template:
244236
entity_id:
245237
- cover.bedroom
246238
- cover.livingroom
247-
position: "{{ position }}"
239+
position: "{{position}}"
248240
249241
automation:
250242
- alias: "Close covers at night"
@@ -255,7 +247,7 @@ automation:
255247
action:
256248
- service: cover.set_cover_position
257249
data:
258-
entity_id: cover.all_covers
250+
entity_id: cover.cover_group
259251
position: 25
260252
```
261253
{% endraw %}

0 commit comments

Comments
 (0)