esphome-docs/esphomeyaml/components/switch/gpio.rst

53 lines
1.4 KiB
ReStructuredText
Raw Normal View History

2018-05-13 11:37:02 +02:00
GPIO Switch
===========
The ``gpio`` switch platform allows you to use any pin on your node as a
switch. You can for example hook up a relay to a GPIO pin and use it
through this platform.
2018-06-01 18:10:00 +02:00
.. figure:: images/gpio-ui.png
:align: center
:width: 80.0%
2018-05-13 11:37:02 +02:00
.. code:: yaml
# Example configuration entry
switch:
- platform: gpio
pin: 25
name: "Living Room Dehumidifier"
Configuration variables:
2018-08-24 22:44:01 +02:00
------------------------
2018-05-13 11:37:02 +02:00
2018-06-01 18:10:00 +02:00
- **pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The
GPIO pin to use for the switch.
- **name** (**Required**, string): The name for the switch.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
- All other options from :ref:`Switch <config-switch>` and :ref:`MQTT Component <config-mqtt-component>`.
2018-06-06 22:26:25 +02:00
.. note::
If you want the pin to default to HIGH on startup, you can use the inverted property
of the :ref:`Pin Schema <config-pin_schema>`:
.. code:: yaml
# Example configuration entry
switch:
- platform: gpio
pin:
number: 25
inverted: True
name: "Living Room Dehumidifier"
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:`index`
- :doc:`/esphomeyaml/components/output/gpio`
- :doc:`API Reference </api/switch/index>`
2018-06-04 08:17:22 +02:00
- `Edit this page on GitHub <https://github.com/OttoWinter/esphomedocs/blob/current/esphomeyaml/components/switch/gpio.rst>`__
2018-10-12 16:33:22 +02:00
.. disqus::