mirror of
https://github.com/esphome/esphome-docs.git
synced 2024-08-31 00:19:54 +02:00
51 lines
1.4 KiB
ReStructuredText
51 lines
1.4 KiB
ReStructuredText
Simple Garage Door
|
|
==================
|
|
|
|
.. seo::
|
|
:description: Instructions for setting up a simple garage door in ESPHome.
|
|
:image: window-open.png
|
|
|
|
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`
|