hi,
i got an automation that opens the cover of a window when i open the window.
since i have 9 windows it´s a quite long automation since i have set it for every windowsensor/cover.
just wanted to know if there is a way to make it a shorter automation. any ideas?
current automation:
alias: Cover
description: open Cover when Window is open
trigger:
- platform: state
entity_id:
- binary_sensor.window_hallway_contact
from: "off"
to: "on"
- platform: state
entity_id:
- binary_sensor.window_bedroom_1_contact
from: "off"
to: "on"
- platform: state
entity_id:
- binary_sensor.window_bedroom_2_contact
from: "off"
to: "on"
- platform: state
entity_id:
- binary_sensor.window_office_1_contact
from: "off"
to: "on"
- platform: state
entity_id:
- binary_sensor.window_office_2_contact
from: "off"
to: "on"
- platform: state
entity_id:
- binary_sensor.window_livingroom_1_contact
from: "off"
to: "on"
- platform: state
entity_id:
- binary_sensor.window_livingroom_2_contact
from: "off"
to: "on"
- platform: state
entity_id:
- binary_sensor.window_livingroom_3_contact
from: "off"
to: "on"
- platform: state
entity_id:
- binary_sensor.door_balcony_contact
from: "off"
to: "on"
condition: []
action:
- if:
- condition: state
entity_id: binary_sensor.window_office_1_contact
state: "on"
then:
- service: cover.set_cover_position
data:
position: 100
target:
entity_id: cover.pc_l
- if:
- condition: state
entity_id: binary_sensor.window_office_2_contact
state: "on"
then:
- service: cover.set_cover_position
data:
position: 100
target:
entity_id: cover.pc_r
- if:
- condition: state
entity_id: binary_sensor.window_bedroom_1_contact
state: "on"
then:
- service: cover.set_cover_position
data:
position: 100
target:
entity_id: cover.schlaf_l
- if:
- condition: state
entity_id: binary_sensor.window_bedroom_2_contact
state: "on"
then:
- service: cover.set_cover_position
data:
position: 100
target:
entity_id: cover.schlaf_r
- if:
- condition: state
entity_id: binary_sensor.window_hallway_contact
state: "on"
then:
- service: cover.set_cover_position
data:
position: 100
target:
entity_id: cover.gang
- if:
- condition: state
entity_id: binary_sensor.window_livingroom_1_contact
state: "on"
then:
- service: cover.set_cover_position
data:
position: 100
target:
entity_id: cover.wz_1
- if:
- condition: state
entity_id: binary_sensor.window_livingroom_2_contact
state: "on"
then:
- service: cover.set_cover_position
data:
position: 100
target:
entity_id: cover.wz_2
- if:
- condition: state
entity_id: binary_sensor.window_livingroom_3_contact
state: "on"
then:
- service: cover.set_cover_position
data:
position: 100
target:
entity_id: cover.wz_3
- if:
- condition: state
entity_id: binary_sensor.door_balcony_contact
state: "on"
then:
- service: cover.set_cover_position
data:
position: 100
target:
entity_id: cover.balkon
mode: single