2018-10-04 18:59:17 +02:00
.. _output:
2018-05-13 11:37:02 +02:00
Output Component
================
2018-11-14 22:12:27 +01:00
.. seo ::
2019-02-16 23:25:23 +01:00
:description: Instructions for setting up generic outputs in ESPHome
2021-11-16 03:19:33 +01:00
:image: folder-open.svg
2018-11-14 22:12:27 +01:00
2018-05-13 11:37:02 +02:00
Each platform of the `` output `` domain exposes some output to
2019-02-16 23:25:23 +01:00
ESPHome. These are grouped into two categories: `` binary `` outputs
2018-05-13 11:37:02 +02:00
(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.
2018-11-19 18:32:16 +01:00
.. code-block :: yaml
2018-05-13 11:37:02 +02:00
# Example configuration entry
output:
- platform: ...
2018-10-20 15:10:26 +02:00
id: my_output_id
2018-05-13 11:37:02 +02:00
power_supply: power_supply_id
2021-07-28 23:56:11 +02:00
inverted: false
2019-02-26 19:11:07 +01:00
min_power: 0.01
2018-05-13 11:37:02 +02:00
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
2019-02-07 13:54:45 +01:00
supply </components/power_supply>` to connect to
2018-06-01 18:10:00 +02:00
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
2021-07-28 23:56:11 +02:00
as inverted. Defaults to `` false `` .
2021-02-20 22:02:46 +01:00
Float outputs only:
- **min_power** (*Optional* , float): Sets the minimum output value of this output platform.
2023-02-05 10:19:11 +01:00
Must be in range from 0 to max_power. Defaults to `` 0 `` . If zero_means_zero is `` false `` this will be output value when the entity is turned off.
2021-02-20 22:02:46 +01:00
- **max_power** (*Optional* , float): Sets the maximum output value of this output platform.
Must be in range from min_power to 1. Defaults to `` 1 `` .
2021-08-02 10:33:08 +02:00
- **zero_means_zero** (*Optional* , boolean): Sets the output to use actual 0 instead of `` min_power `` .
Defaults to `` false `` .
2018-06-01 18:10:00 +02:00
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.
2018-11-19 18:32:16 +01:00
.. code-block :: yaml
2018-08-22 22:05:28 +02:00
on_...:
then:
2022-10-11 17:07:17 +02:00
- output.turn_on: light_1
2018-08-22 22:05:28 +02:00
2018-10-20 14:53:27 +02:00
.. note ::
This action can also be expressed in :ref: `lambdas <config-lambda>` :
2018-11-19 18:32:16 +01:00
.. code-block :: cpp
2018-10-20 14:53:27 +02:00
2022-10-11 17:07:17 +02:00
id(light_1).turn_on();
2018-10-20 14:53:27 +02:00
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.
2018-11-19 18:32:16 +01:00
.. code-block :: yaml
2018-08-22 22:05:28 +02:00
on_...:
then:
2022-10-11 17:07:17 +02:00
- output.turn_off: light_1
2018-08-22 22:05:28 +02:00
2018-10-20 14:53:27 +02:00
.. note ::
This action can also be expressed in :ref: `lambdas <config-lambda>` :
2018-11-19 18:32:16 +01:00
.. code-block :: cpp
2018-10-20 14:53:27 +02:00
2022-10-11 17:07:17 +02:00
id(light_1).turn_off();
2018-10-20 14:53:27 +02:00
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
2023-02-16 14:53:19 +01:00
works with floating point outputs like :doc: `/components/output/esp8266_pwm` , :doc: `/components/output/ledc` , :doc: `/components/output/sigma_delta` , :doc: `/components/output/slow_pwm` .
2018-08-22 22:05:28 +02:00
2018-11-19 18:32:16 +01:00
.. code-block :: yaml
2018-08-22 22:05:28 +02:00
on_...:
then:
- output.set_level:
2022-10-11 17:07:17 +02:00
id: light_1
2018-08-22 22:05:28 +02:00
level: 50%
2018-10-20 14:53:27 +02:00
.. note ::
This action can also be expressed in :ref: `lambdas <config-lambda>` :
2018-11-19 18:32:16 +01:00
.. code-block :: cpp
2018-10-20 14:53:27 +02:00
// range is 0.0 (off) to 1.0 (on)
2022-10-11 17:07:17 +02:00
id(light_1).set_level(0.5);
2018-10-20 14:53:27 +02:00
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
2019-02-07 13:54:45 +01:00
- :doc: `/components/switch/output`
- :doc: `/components/power_supply`
- :doc: `/components/light/binary`
- :doc: `/components/light/monochromatic`
- :doc: `/components/light/rgb`
- :doc: `/components/fan/binary`
- :doc: `/components/fan/speed`
2019-05-12 22:44:59 +02:00
- :apiref: `binary_output.h <output/binary_output.h>` ,
:apiref: `float_output.h <output/float_output.h>`
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
*
2022-10-11 17:12:24 +02:00
2022-10-11 17:07:17 +02:00
- :ghedit: `Edit`
2022-10-11 17:12:24 +02:00