esphome-docs/cookbook/garage-door.rst

51 lines
1.4 KiB
ReStructuredText
Raw Normal View History

2018-06-01 18:10:00 +02:00
Simple Garage Door
==================
2018-11-14 22:12:27 +01:00
.. seo::
2019-02-16 23:25:23 +01:00
:description: Instructions for setting up a simple garage door in ESPHome.
:image: window-open.png
2018-11-14 22:12:27 +01:00
2018-06-01 18:10:00 +02:00
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
2018-06-01 18:10:00 +02:00
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
2018-11-10 14:33:24 +01:00
- switch.turn_off: close_switch
2018-06-01 18:10:00 +02:00
# Turn the OPEN switch on briefly
2018-11-10 14:33:24 +01:00
- switch.turn_on: open_switch
2018-06-01 18:10:00 +02:00
- delay: 0.1s
2018-11-10 14:33:24 +01:00
- switch.turn_off: open_switch
2018-06-01 18:10:00 +02:00
close_action:
2018-11-10 14:33:24 +01:00
- switch.turn_off: open_switch
- switch.turn_on: close_switch
2018-06-01 18:10:00 +02:00
- delay: 0.1s
2018-11-10 14:33:24 +01:00
- switch.turn_off: close_switch
2018-06-01 18:10:00 +02:00
stop_action:
2018-11-10 14:33:24 +01:00
- switch.turn_off: close_switch
- switch.turn_off: open_switch
2018-06-01 18:10:00 +02:00
optimistic: true
2019-02-16 23:25:23 +01:00
assumed_state: true
2018-06-01 18:10:00 +02:00
See Also
2018-08-24 22:44:01 +02:00
--------
2018-06-01 18:10:00 +02:00
- :doc:`/guides/automations`
- :doc:`/components/switch/gpio`
- :doc:`/components/cover/template`
- :ghedit:`Edit`