esphome-docs/components/switch/uart.rst

44 lines
1.2 KiB
ReStructuredText
Raw Normal View History

UART Switch
===========
2018-11-14 22:12:27 +01:00
.. seo::
2019-02-16 23:25:23 +01:00
:description: Instructions for setting up UART switches in ESPHome that can output arbitrary UART sequences when activated.
:image: uart.png
2018-11-14 22:12:27 +01:00
The ``uart`` switch platform allows you to send a pre-defined sequence of bytes on a
:doc:`UART bus </components/uart>` when triggered.
.. code-block:: yaml
# Example configuration entry
uart:
baud_rate: 9600
tx_pin: D0
switch:
- platform: uart
name: "UART String Output"
data: 'DataToSend'
- platform: uart
name: "UART Bytes Output"
data: [0xDE, 0xAD, 0xBE, 0xEF]
Configuration variables:
2018-08-24 22:44:01 +02:00
------------------------
- **data** (**Required**, string or list of bytes): The data to send via UART. Either an ASCII string
or a list of bytes.
- **name** (**Required**, string): The name for the switch.
- **uart_id** (*Optional*, :ref:`config-id`): Manually specify the ID of the UART hub.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
2019-02-17 12:28:17 +01:00
- All other options from :ref:`Switch <config-switch>`.
See Also
2018-08-24 22:44:01 +02:00
--------
- :doc:`/components/uart`
- :apiref:`switch_/uart_switch.h`
- :ghedit:`Edit`
2018-10-12 16:33:22 +02:00
.. disqus::