Hi,
I have a gate currently controlled by a shelly1, and I’m trying to expose it as a garage door in homekit so I can operate it from carplay.
I decided to try using the cover template (as I learned throughout this forum) coupled with a boolean to keep the state of the gate (open or closed)
This is my current setup:
- switch.shelly1_68c123 - is the shelly switch controlling the gate;
- input_boolean.gate_open - is the boolean I use to keep the (fake) state of the gate.
cover:
- platform: template
covers:
main_gate:
device_class: garage
friendly_name: "Main Gate"
value_template: >-
{% if is_state('input_boolean.gate_open', false) %}
Open
{% else %}
Closed
{% endif %}
open_cover:
- service: switch.turn_on
data:
entity_id: switch.shelly1_68c123
- service: input_boolean.turn_on
entity_id: input_boolean.gate_open
close_cover:
- service: switch.turn_on
data:
entity_id: switch.shelly1_68c123
- service: input_boolean.turn_off
entity_id: input_boolean.gate_open
stop_cover:
- service: switch.turn_on
data:
entity_id: switch.shelly1_68c123
icon_template: >-
{% if is_state('input_boolean.gate_open', true) %}
mdi:garage-open
{% else %}
mdi:garage
{% endif %}
input_boolean:
gate_open:
initial: false
It’s correctly exposed into homekit and enables me to open and close the gate, but the state gets stuck in “opening” and “closing.”
Any idea on how I can fix this?