My garage door is operated by a button. This means that both opening, closing, and stopping are done through this one button.
When the garage door is closed, I press the button and the garage door opens until it is fully open. If I then press the button again, the garage door closes until it is fully closed. If I press the button during opening or closing, the opening or closing is stopped. If the button is pressed again, the garage door is operated in the opposite direction. This means that if the garage door is currently opening and Stop is pressed, it will be closed again. If the garage door is currently closing and Stop is pressed, it will be opened again.
The button is connected to a Shelly Plus 1 with the ID 123456.
There is an addon installed on the Shelly Plus 1 with the ID 987654. This addon can detect whether the garage door is open or not.
I now need a Cover Template for this garage door in Home Assistant.
The current template looks as follows (does not work 100% perfectly):
cover:
- platform: template
covers:
garage_door:
friendly_name: "Garage Door Test 3"
device_class: garage
value_template: "{{ 'closed' if is_state('binary_sensor.987654', 'off') else 'open' }}"
open_cover:
service: switch.turn_on
entity_id: switch.123456
close_cover:
service: switch.turn_on
entity_id: switch.123456