mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-08 01:46:50 +00:00
Simplyfied scripts (#3473)
- Simplyfied scripts using service_template - Changed "all_covers" to "cover_gorup"
This commit is contained in:
parent
a72cfa7b11
commit
e3ca50b478
@ -170,27 +170,33 @@ This example allows you to control two or more covers at once.
|
|||||||
```yaml
|
```yaml
|
||||||
homeassistant:
|
homeassistant:
|
||||||
customize:
|
customize:
|
||||||
all_covers:
|
cover_group:
|
||||||
assume_state: true
|
assume_state: true
|
||||||
|
|
||||||
cover:
|
cover:
|
||||||
- platform: template
|
- platform: template
|
||||||
covers:
|
covers:
|
||||||
all_covers:
|
cover_group:
|
||||||
friendly_name: "All Covers"
|
friendly_name: "Cover Group"
|
||||||
open_cover:
|
open_cover:
|
||||||
service: script.cover_all_open
|
service: script.cover_group
|
||||||
|
data:
|
||||||
|
modus: 'open'
|
||||||
close_cover:
|
close_cover:
|
||||||
service: script.cover_all_close
|
service: script.cover_group
|
||||||
|
data:
|
||||||
|
modus: 'close'
|
||||||
stop_cover:
|
stop_cover:
|
||||||
service: script.cover_all_stop
|
service: script.cover_group
|
||||||
|
data:
|
||||||
|
modus: 'stop'
|
||||||
set_cover_position:
|
set_cover_position:
|
||||||
service: script.cover_all_set_position
|
service: script.cover_group_position
|
||||||
data_template:
|
data_template:
|
||||||
position: "{{ position }}"
|
position: "{{position}}"
|
||||||
value_template: "{{ is_state('sensor.all_covers', 'open') }}"
|
value_template: "{{is_state('sensor.cover_group', 'open')}}"
|
||||||
icon_template: >-
|
icon_template: >-
|
||||||
{% if is_state('sensor.all_covers', 'open') %}
|
{% if is_state('sensor.cover_group', 'open') %}
|
||||||
mdi:window-open
|
mdi:window-open
|
||||||
{% else %}
|
{% else %}
|
||||||
mdi:window-closed
|
mdi:window-closed
|
||||||
@ -202,7 +208,7 @@ cover:
|
|||||||
sensor:
|
sensor:
|
||||||
- platform: template
|
- platform: template
|
||||||
sensors:
|
sensors:
|
||||||
all_covers:
|
cover_group:
|
||||||
value_template: >-
|
value_template: >-
|
||||||
{% if is_state('cover.bedroom', 'open') %}
|
{% if is_state('cover.bedroom', 'open') %}
|
||||||
open
|
open
|
||||||
@ -216,35 +222,21 @@ sensor:
|
|||||||
- cover.livingroom
|
- cover.livingroom
|
||||||
|
|
||||||
script:
|
script:
|
||||||
cover_all_open:
|
cover_group:
|
||||||
sequence:
|
sequence:
|
||||||
- service: cover.open_cover
|
- service_template: "cover.{{modus}}_cover"
|
||||||
data:
|
data:
|
||||||
entity_id:
|
entity_id:
|
||||||
- cover.bedroom
|
- cover.bedroom
|
||||||
- cover.livingroom
|
- cover.livingroom
|
||||||
cover_all_stop:
|
cover_group_position:
|
||||||
sequence:
|
|
||||||
- service: cover.stop_cover
|
|
||||||
data:
|
|
||||||
entity_id:
|
|
||||||
- cover.bedroom
|
|
||||||
- cover.livingroom
|
|
||||||
cover_all_close:
|
|
||||||
sequence:
|
|
||||||
- service: cover.close_cover
|
|
||||||
data:
|
|
||||||
entity_id:
|
|
||||||
- cover.bedroom
|
|
||||||
- cover.livingroom
|
|
||||||
cover_all_set_position:
|
|
||||||
sequence:
|
sequence:
|
||||||
- service: cover.set_cover_position
|
- service: cover.set_cover_position
|
||||||
data_template:
|
data_template:
|
||||||
entity_id:
|
entity_id:
|
||||||
- cover.bedroom
|
- cover.bedroom
|
||||||
- cover.livingroom
|
- cover.livingroom
|
||||||
position: "{{ position }}"
|
position: "{{position}}"
|
||||||
|
|
||||||
automation:
|
automation:
|
||||||
- alias: "Close covers at night"
|
- alias: "Close covers at night"
|
||||||
@ -255,7 +247,7 @@ automation:
|
|||||||
action:
|
action:
|
||||||
- service: cover.set_cover_position
|
- service: cover.set_cover_position
|
||||||
data:
|
data:
|
||||||
entity_id: cover.all_covers
|
entity_id: cover.cover_group
|
||||||
position: 25
|
position: 25
|
||||||
```
|
```
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user