Hi there,
I have a low voltage switch connected to my gate motor which allows me to open and close the gate via Home Assistant and also provides the state of the gate back to Home Assistant. The state is based off an led that would have traditionally been connected to a handset inside the house. If the LED is on, that means that the gate is open, off means that it’s closed and when the gate is opening or closing the led flashes. Up until now this has been fine. However, I have now discovered covers, and the integration of covers with my Apple HomeKit. The problem I am having is that when the gate is opening or closing, I get a whole stack of notifications saying that the gate is open, and then that the gate is closed, open, closed, open closed, etc. I am looking for a way to either delay the reporting of the open/closed state until such time as the gate is actually open or closed, or provide a middle ground of opening or closing. I had added a delay to the yaml of 20 seconds, thinking that may help, but no luck… Any bright ideas?
cover:
- platform: template
covers:
gate_cover:
friendly_name: "Driveway Gate"
open_cover:
- service: switch.toggle
entity_id: switch.gate_switch
- delay: "00:00:20"
close_cover:
- service: switch.toggle
entity_id: switch.gate_switch
- delay: "00:00:20"
value_template: "{{ is_state('binary_sensor.gate_open_closed', 'on') }}"
icon_template: >-
{% if is_state('binary_sensor.gate_open_closed', 'on') %}
mdi:gate-open
{% else %}
mdi:gate
{% endif %}