2018-10-04 18:59:17 +02:00
|
|
|
.. _output:
|
|
|
|
|
2018-05-13 11:37:02 +02:00
|
|
|
Output Component
|
|
|
|
================
|
|
|
|
|
|
|
|
Each platform of the ``output`` domain exposes some output to
|
|
|
|
esphomelib. These are grouped into two categories: ``binary`` outputs
|
|
|
|
(that can only be ON/OFF) and ``float`` outputs (like PWM, can output
|
|
|
|
any rational value between 0 and 1).
|
|
|
|
|
2018-06-01 18:10:00 +02:00
|
|
|
.. _config-output:
|
2018-05-13 11:37:02 +02:00
|
|
|
|
|
|
|
Base Output Configuration
|
2018-10-12 16:33:22 +02:00
|
|
|
-------------------------
|
2018-05-13 11:37:02 +02:00
|
|
|
|
|
|
|
Each output platform extends this configuration schema.
|
|
|
|
|
|
|
|
.. code:: yaml
|
|
|
|
|
|
|
|
# Example configuration entry
|
|
|
|
output:
|
|
|
|
- platform: ...
|
|
|
|
id: myoutput_id
|
|
|
|
power_supply: power_supply_id
|
|
|
|
inverted: False
|
|
|
|
max_power: 0.75
|
|
|
|
|
|
|
|
Configuration variables:
|
|
|
|
|
2018-06-01 18:10:00 +02:00
|
|
|
- **id** (**Required**, :ref:`config-id`): The id to use for this output component.
|
|
|
|
- **power_supply** (*Optional*, :ref:`config-id`): The :doc:`power
|
|
|
|
supply </esphomeyaml/components/power_supply>` to connect to
|
|
|
|
this output. When the output is enabled, the power supply will
|
|
|
|
automatically be switched on too.
|
|
|
|
- **inverted** (*Optional*, boolean): If the output should be treated
|
|
|
|
as inverted. Defaults to ``False``.
|
|
|
|
- **max_power** (*Optional*, float): Only for float outputs. Sets the
|
|
|
|
maximum output value of this output platform. Each value will be
|
|
|
|
multiplied by this. Must be in range from 0 to 1. Defaults to 1.
|
|
|
|
|
2018-08-22 22:05:28 +02:00
|
|
|
|
|
|
|
.. _output-turn_on_action:
|
|
|
|
|
|
|
|
``output.turn_on`` Action
|
2018-10-12 16:33:22 +02:00
|
|
|
*************************
|
2018-08-22 22:05:28 +02:00
|
|
|
|
|
|
|
This action turns the output with the given ID on when executed.
|
|
|
|
|
|
|
|
.. code:: yaml
|
|
|
|
|
|
|
|
on_...:
|
|
|
|
then:
|
|
|
|
- output.turn_on: relay_1
|
|
|
|
|
2018-10-20 14:53:27 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
This action can also be expressed in :ref:`lambdas <config-lambda>`:
|
|
|
|
|
|
|
|
.. code:: cpp
|
|
|
|
|
|
|
|
id(relay_1).turn_on();
|
|
|
|
|
2018-08-22 22:05:28 +02:00
|
|
|
.. _output-turn_off_action:
|
|
|
|
|
|
|
|
``output.turn_off`` Action
|
2018-10-12 16:33:22 +02:00
|
|
|
**************************
|
2018-08-22 22:05:28 +02:00
|
|
|
|
|
|
|
This action turns the output with the given ID off when executed.
|
|
|
|
|
|
|
|
.. code:: yaml
|
|
|
|
|
|
|
|
on_...:
|
|
|
|
then:
|
|
|
|
- output.turn_off: relay_1
|
|
|
|
|
2018-10-20 14:53:27 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
This action can also be expressed in :ref:`lambdas <config-lambda>`:
|
|
|
|
|
|
|
|
.. code:: cpp
|
|
|
|
|
|
|
|
id(relay_1).turn_off();
|
|
|
|
|
2018-08-22 22:05:28 +02:00
|
|
|
.. _output-set_level_action:
|
|
|
|
|
|
|
|
``output.set_level`` Action
|
2018-10-12 16:33:22 +02:00
|
|
|
***************************
|
2018-08-22 22:05:28 +02:00
|
|
|
|
|
|
|
This action sets the float output to the given level when executed. Note: This only
|
|
|
|
works with floating point outputs like ESP8266 PWM or LEDC.
|
|
|
|
|
|
|
|
.. code:: yaml
|
|
|
|
|
|
|
|
on_...:
|
|
|
|
then:
|
|
|
|
- output.set_level:
|
|
|
|
id: output_1
|
|
|
|
level: 50%
|
|
|
|
|
2018-10-20 14:53:27 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
This action can also be expressed in :ref:`lambdas <config-lambda>`:
|
|
|
|
|
|
|
|
.. code:: cpp
|
|
|
|
|
|
|
|
// range is 0.0 (off) to 1.0 (on)
|
|
|
|
id(relay_1).set_level(0.5);
|
|
|
|
|
2018-06-01 18:10:00 +02:00
|
|
|
Full Output Index
|
2018-10-12 16:33:22 +02:00
|
|
|
-----------------
|
2018-06-01 18:10:00 +02:00
|
|
|
|
|
|
|
- :doc:`/esphomeyaml/components/switch/output`
|
|
|
|
- :doc:`/esphomeyaml/components/power_supply`
|
|
|
|
- :doc:`/esphomeyaml/components/light/binary`
|
|
|
|
- :doc:`/esphomeyaml/components/light/monochromatic`
|
|
|
|
- :doc:`/esphomeyaml/components/light/rgb`
|
|
|
|
- :doc:`/esphomeyaml/components/fan/binary`
|
|
|
|
- :doc:`/esphomeyaml/components/fan/speed`
|
2018-06-03 12:50:44 +02:00
|
|
|
- :doc:`API Reference </api/output/index>`
|
2018-06-04 08:17:22 +02:00
|
|
|
- `Edit this page on GitHub <https://github.com/OttoWinter/esphomedocs/blob/current/esphomeyaml/components/output/index.rst>`__
|
2018-06-01 18:10:00 +02:00
|
|
|
|
|
|
|
.. toctree::
|
|
|
|
:maxdepth: 1
|
2018-10-20 14:53:27 +02:00
|
|
|
:glob:
|
2018-06-01 18:10:00 +02:00
|
|
|
|
2018-10-20 14:53:27 +02:00
|
|
|
*
|
2018-10-12 16:33:22 +02:00
|
|
|
|
|
|
|
.. disqus::
|