esphome-docs/cookbook/garage-door.rst
Otto Winter 6053f490b5
Update svg2png and seo.py (#1380)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2021-11-16 15:19:33 +13:00

51 lines
1.4 KiB
ReStructuredText

Simple Garage Door
==================
.. seo::
:description: Instructions for setting up a simple garage door in ESPHome.
:image: window-open.svg
The following is a possible configuration file for garage doors that are controlled by two relays:
One for opening and another one for closing the garage door. When either one of them is turned on
for a short period of time, the close/open action begins.
.. code-block:: yaml
switch:
- platform: gpio
pin: D3
name: "Garage Door Open Switch"
id: open_switch
- platform: gpio
pin: D4
name: "Garage Door Close Switch"
id: close_switch
cover:
- platform: template
name: "Garage Door"
open_action:
# Cancel any previous action
- switch.turn_off: close_switch
# Turn the OPEN switch on briefly
- switch.turn_on: open_switch
- delay: 0.1s
- switch.turn_off: open_switch
close_action:
- switch.turn_off: open_switch
- switch.turn_on: close_switch
- delay: 0.1s
- switch.turn_off: close_switch
stop_action:
- switch.turn_off: close_switch
- switch.turn_off: open_switch
optimistic: true
assumed_state: true
See Also
--------
- :doc:`/guides/automations`
- :doc:`/components/switch/gpio`
- :doc:`/components/cover/template`
- :ghedit:`Edit`