-
-
Save jasonmadigan/df3473e12be3bad4a35150a319a5c990 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
platform: template | |
covers: | |
gate: | |
friendly_name: "Gate" | |
# With only one sensor, we'll have to guess. | |
# If the sensor reports closed, the door is closed. No guessing needed. | |
# If the sensor reports open, it could | |
# Help from: https://community.home-assistant.io/t/cover-timing/183404/4 | |
value_template: >- | |
{% if is_state('binary_sensor.gate_contact_sensor', 'off') %} | |
closed | |
{% elif is_state('input_boolean.gate_moving', 'on') %} | |
moving | |
{% elif is_state('binary_sensor.gate_contact_sensor', 'on') %} | |
open | |
{% else %} | |
unknown | |
{% endif %} | |
open_cover: | |
service: script.open_gate | |
close_cover: | |
service: script.close_gate | |
icon_template: >- | |
{% if is_state('binary_sensor.gate_contact_sensor', 'off') %} | |
mdi:gate | |
{% elif is_state('input_boolean.gate_moving', 'on') %} | |
mdi:gate-arrow-left | |
{% elif is_state('binary_sensor.gate_contact_sensor', 'on') %} | |
mdi:gate-open | |
{% else %} | |
mdi:gate-alert | |
{% endif %} | |
# Binary virtual "moving" sensor | |
input_boolean: | |
gate_moving: | |
name: Gate Moving | |
initial: off | |
# Automation | |
- id: '1647011691136' | |
alias: gate cover called | |
trigger: | |
platform: event | |
event_type: call_service | |
event_data: | |
domain: cover | |
condition: | |
condition: template | |
value_template: '{{ trigger.event.as_dict()[''data''][''service_data''][''entity_id''] == ''cover.gate'' }}' # or whatever your gate cover is called | |
action: | |
- service: input_boolean.turn_on | |
entity_id: input_boolean.gate_moving | |
- delay: 00:00:30 | |
- service: input_boolean.turn_off | |
entity_id: input_boolean.gate_moving |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment