HI,
I had a switch template so that on the picture glace for my garage door camera, it would have an icon of the state of the garage door, and I could press it and it would open/close depending on state.
I have had the same template when using MyQ (before the dreaded closing of the API), then RatGDO with MQTT, and now to ESPHome.
If the garage door is closed, pressing the switch button on the place card will open the garage. However, if the garage is open, it will not close the garage door. The icons still show the correct state however.
code is as follows.
switch:
- platform: template
switches:
garage:
value_template: "{{ is_state('cover.ratdgo_door', 'open') }}"
turn_on:
service: cover.open_cover
data:
entity_id: cover.ratgdo_door
turn_off:
service: cover.close_cover
data:
entity_id: cover.ratgdo_door
icon_template: >-
{% if is_state('cover.ratgdo_door', 'open') %}
mdi:garage-open
{% else %}
mdi:garage
{% endif %}
How would I get it to close with this template? TIA