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).
Base Output Configuration¶
Each output platform extends this configuration schema.
# Example configuration entry
output:
- platform: ...
id: my_output_id
power_supply: power_supply_id
inverted: False
max_power: 0.75
Configuration variables:
- id (Required, ID): The id to use for this output component.
- power_supply (Optional, ID): The 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.
output.turn_on
Action¶
This action turns the output with the given ID on when executed.
on_...:
then:
- output.turn_on: relay_1
output.turn_off
Action¶
This action turns the output with the given ID off when executed.
on_...:
then:
- output.turn_off: relay_1
output.set_level
Action¶
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.
on_...:
then:
- output.set_level:
id: output_1
level: 50%
Note
This action can also be expressed in lambdas:
// range is 0.0 (off) to 1.0 (on)
id(relay_1).set_level(0.5);