mirror of
https://github.com/esphome/esphome-docs.git
synced 2025-01-05 19:08:49 +01:00
4f83b3f333
* Add missing space, Add missing space to fan component. * Update ir_transmitter.rst
117 lines
3.5 KiB
ReStructuredText
117 lines
3.5 KiB
ReStructuredText
IR Transmitter Switch
|
|
=====================
|
|
|
|
The ``ir_transmitter`` switch platform allows you to create switches
|
|
that send an IR code using the :doc:`/esphomeyaml/components/ir_transmitter`. Every time
|
|
the switch is turned on, the IR signal with the provided IR code is sent
|
|
out.
|
|
|
|
Theoretically this platform can also be used to create arbitrary output
|
|
signals on any pin by using the ``raw:`` option.
|
|
|
|
.. figure:: images/ir_transmitter-ui.png
|
|
:align: center
|
|
:width: 80.0%
|
|
|
|
.. code:: yaml
|
|
|
|
# Example configuration entry
|
|
ir_transmitter:
|
|
- id: 'ir_hub1'
|
|
pin: 32
|
|
|
|
# Individual switches
|
|
switch:
|
|
- platform: ir_transmitter
|
|
ir_transmitter_id: 'ir_hub1'
|
|
name: "Panasonic TV Off"
|
|
panasonic:
|
|
address: 0x4004
|
|
command: 0x100BCBD
|
|
repeat: 25
|
|
|
|
Configuration variables:
|
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
- **name** (**Required**, string): The name for the switch.
|
|
- The IR code, see :ref:`ir_transmitter-ir_codes`. Only one
|
|
of them can be specified per switch.
|
|
- **repeat** (*Optional*, int): How often the command should be
|
|
repeated. Additionally, an ``wait_time`` option can be specified in the ``repeat`` section
|
|
to set how long to wait in between repeats. Defaults to 1 (code is
|
|
sent once). Example: ``repeat\: \{times\: 10, wait_time\: 20us\}``
|
|
- **ir_transmitter_id** (*Optional*, :ref:`config-id`): The id of the :doc:`/esphomeyaml/components/ir_transmitter`.
|
|
Defaults to the first hub specified.
|
|
- **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>`.
|
|
|
|
.. _ir_transmitter-ir_codes:
|
|
|
|
Defining IR Codes
|
|
~~~~~~~~~~~~~~~~~
|
|
|
|
To get the IR codes, first use an Arduino or similar device with an IR
|
|
Receiver and upload the `Aruino-IRRemote IRRecvDump
|
|
sketch <https://github.com/z3t0/Arduino-IRremote/blob/master/examples/IRrecvDumpV2/IRrecvDumpV2.ino>`__.
|
|
Then press the buttons on the remote and observe the serial monitor. It
|
|
should include all the information needed to setup these IR codes.
|
|
|
|
.. code:: yaml
|
|
|
|
nec:
|
|
address: 0x4242
|
|
command: 0x8484
|
|
lg:
|
|
data: 0x01234567890ABC
|
|
nbits: 28
|
|
sony:
|
|
data: 0xABCDEF
|
|
nbits: 12
|
|
panasonic:
|
|
address: 0x4004
|
|
command: 0x1000BCD
|
|
raw:
|
|
carrier_frequency: 35kHz
|
|
data:
|
|
- 1000
|
|
- -1000
|
|
|
|
Configuration variables:
|
|
|
|
- **nec**: Send a NEC IR code.
|
|
|
|
- **address**: The address of the device.
|
|
- **command**: The command to send.
|
|
|
|
- **lg**: Send an LG IR code.
|
|
|
|
- **data**: The data bytes to send.
|
|
- **nbits**: The number of bits to send, defaults to 28.
|
|
|
|
- **sony**: Send an Sony IR code.
|
|
|
|
- **data**: The data bytes to send.
|
|
- **nbits**: The number of bits to send, defaults to 12.
|
|
|
|
- **panasonic**: Send an Panasonic IR code.
|
|
|
|
- **address**: The address of the device.
|
|
- **command**: The command to send.
|
|
|
|
- **raw**: Send an arbitrary signal.
|
|
|
|
- **carrier_frequency**: The frequency to use for the carrier. A lot
|
|
of IR sensors only respond to a very specific frequency.
|
|
- **data**: List containing integers describing the signal to send.
|
|
Each value is a time in µs declaring how long the carrier should
|
|
be switched on or off. Positive values mean ON, negative values
|
|
mean OFF.
|
|
|
|
See Also
|
|
^^^^^^^^
|
|
|
|
- :doc:`index`
|
|
- :doc:`/esphomeyaml/components/ir_transmitter`
|
|
- :doc:`API Reference </api/switch/ir-transmitter>`
|
|
- `Edit this page on GitHub <https://github.com/OttoWinter/esphomedocs/blob/current/esphomeyaml/components/switch/ir_transmitter.rst>`__
|