andreasc
(andreas)
July 11, 2024, 7:33am
1
hi all, have some question on how to sync the state of 2 individual covers with one that would possibly cover both.
In more detail, currently i have this cover configuration:
- platform: template
covers:
garage_door_1:
device_class: garage
friendly_name: "Garage Door 1"
unique_id: "garagedoor1"
optimistic: true
open_cover:
- service: switch.turn_on
target:
entity_id: switch.garage_1
close_cover:
- service: switch.turn_on
target:
entity_id: switch.garage_1
garage_door_2:
device_class: garage
friendly_name: "Garage Door 2"
unique_id: "garagedoor2"
optimistic: true
open_cover:
- service: switch.turn_on
target:
entity_id: switch.garage_2
close_cover:
- service: switch.turn_on
target:
entity_id: switch.garage_2
type or paste code here
With the above, each door can have it’s own state.
But if i create similar configuration to control both at the same time:
both_garage_doors:
device_class: garage
friendly_name: "Both Garage Doors"
unique_id: "bothgaragedoors"
optimistic: true
open_cover:
- service: switch.turn_on
target:
entity_id: switch.garage_1
- service: switch.turn_on
target:
entity_id: switch.garage_2
close_cover:
- service: switch.turn_on
target:
entity_id: switch.garage_1
- service: switch.turn_on
target:
entity_id: switch.garage_2
Then if i use the “both garage doors” entity to open both, the state is not registered to each door.
Anyway i can do this?
Thanks
tom_l
July 11, 2024, 8:22am
2
You could follow the door states with a couple of input boolean helpers. But this would rely on you only ever using Home Assistant to control the doors and no other method. No physical controls or remote controls.
Do you really have no way of determining the door states?
andreasc
(andreas)
July 11, 2024, 8:45am
3
hi , yes i got it that i should only controlling them via home assistant.
can you help with the boolean helpers?
tom_l
July 11, 2024, 8:58am
4
Sure, go to Settings → Devices & Services → Helpers and create two “Toggle” helpers. Call them Garage 1 and Garage 2. Then update your covers to this:
- platform: template
covers:
garage_door_1:
device_class: garage
friendly_name: "Garage Door 1"
unique_id: "garagedoor1"
value_template: "{{ is_state('input_boolean.garage_1','on') }}"
open_cover:
- service: switch.turn_on
target:
entity_id: switch.garage_1
- service: input_boolean.turn_on
target:
entity_id: input_boolean.garage_1
close_cover:
- service: switch.turn_on
target:
entity_id: switch.garage_1
- service: input_boolean.turn_off
target:
entity_id: input_boolean.garage_1
garage_door_2:
device_class: garage
friendly_name: "Garage Door 2"
unique_id: "garagedoor2"
value_template: "{{ is_state('input_boolean.garage_2','on') }}"
open_cover:
- service: switch.turn_on
target:
entity_id: switch.garage_2
- service: input_boolean.turn_on
target:
entity_id: input_boolean.garage_2
close_cover:
- service: switch.turn_on
target:
entity_id: switch.garage_2
- service: input_boolean.turn_off
target:
entity_id: input_boolean.garage_2
both_garage_doors:
device_class: garage
friendly_name: "Both Garage Doors"
unique_id: "bothgaragedoors"
value_template: "{{ is_state('input_boolean.garage_1','on') or is_state('input_boolean.garage_2','on') }}"
open_cover:
- service: switch.turn_on
target:
entity_id: switch.garage_1
- service: switch.turn_on
target:
entity_id: switch.garage_2
close_cover:
- service: switch.turn_on
target:
entity_id: switch.garage_1
- service: switch.turn_on
target:
entity_id: switch.garage_2
Note if you open one of the garage doors individually then the Both Doors Cover will show as open. If you only want this to happen when both doors are open change the value template from or
to and
:
value_template: "{{ is_state('input_boolean.garage_1','on') and is_state('input_boolean.garage_2','on') }}"
1 Like
andreasc
(andreas)
July 11, 2024, 10:37am
5
Thank you mate. Missed the input boolean definitions in the “both garage” part, but got the idea and completed it.
Thanks again.
1 Like