FWIW I have created the following switch based on a garage door cover. Code blocks below taken from switches.yaml that’s referenced from within configuration.yaml:
switch: !include switches.yaml
- platform: template
switches:
garage_door_main:
friendly_name: "Main Garage Door Switch"
value_template: "{{ is_state('cover.main_garage_door', 'open') }}"
turn_on:
service: cover.open_cover
data:
entity_id: cover.main_garage_door
turn_off:
service: cover.close_cover
data:
entity_id: cover.main_garage_door
Also built this switch for my front gate (uses a MimoLite relay, so needed to use the binary sensor to guage on/off and switch to open / close it)
- platform: template
switches:
front_drive_gate:
friendly_name: "Front Driveway Gate"
value_template: "{{ is_state('binary_sensor.front_gate_contact', 'on') }}"
turn_on:
service: switch.toggle
data:
entity_id: switch.front_gate
turn_off:
service: switch.toggle
data:
entity_id: switch.front_gate
Might not be exactly what you’re after, but hopefully puts you in the right direction.