9#ifdef USE_OUTPUT_FLOAT_POWER_SCALING
10#define LOG_FLOAT_OUTPUT(this) \
11 LOG_BINARY_OUTPUT(this) \
12 if (this->max_power_ != 1.0f) { \
13 ESP_LOGCONFIG(TAG, " Max Power: %.1f%%", this->max_power_ * 100.0f); \
15 if (this->min_power_ != 0.0f) { \
16 ESP_LOGCONFIG(TAG, " Min Power: %.1f%%", this->min_power_ * 100.0f); \
19#define LOG_FLOAT_OUTPUT(this) LOG_BINARY_OUTPUT(this)
40#ifdef USE_OUTPUT_FLOAT_POWER_SCALING
68 template<
bool _use_output_
float_power_scaling = false>
void set_max_power(
float max_power) {
69 static_assert(_use_output_float_power_scaling,
70 "set_max_power() requires USE_OUTPUT_FLOAT_POWER_SCALING. "
71 "To enable it, add 'max_power: 100%' (or any value) to one output entry in your YAML — "
72 "the codegen will then keep the scaling fields. "
73 "See https://esphome.io/components/output/ for details.");
75 template<
bool _use_output_
float_power_scaling = false>
void set_min_power(
float min_power) {
76 static_assert(_use_output_float_power_scaling,
77 "set_min_power() requires USE_OUTPUT_FLOAT_POWER_SCALING. "
78 "To enable it, add 'min_power: 0%' (or any value) to one output entry in your YAML — "
79 "the codegen will then keep the scaling fields. "
80 "See https://esphome.io/components/output/ for details.");
82 template<
bool _use_output_
float_power_scaling = false>
void set_zero_means_zero(
bool zero_means_zero) {
83 static_assert(_use_output_float_power_scaling,
84 "set_zero_means_zero() requires USE_OUTPUT_FLOAT_POWER_SCALING. "
85 "To enable it, add 'zero_means_zero: true' to one output entry in your YAML.");
106#ifdef USE_OUTPUT_FLOAT_POWER_SCALING
125#ifdef USE_OUTPUT_FLOAT_POWER_SCALING
Base class for all output components that can output a variable level, like PWM.
void set_level(float state)
Set the level of this float output, this is called from the front-end.
void set_zero_means_zero(bool zero_means_zero)
void set_max_power(float max_power)
virtual void update_frequency(float frequency)
Set the frequency of the output for PWM outputs.
float get_min_power() const
Get the minimum power output.
void set_max_power(float max_power)
Set the maximum power output of this component.
virtual void write_state(float state)=0
void set_zero_means_zero(bool zero_means_zero)
Sets this output to ignore min_power for a 0 state.
float get_max_power() const
Get the maximum power output.
void write_state(bool state) override
Implement BinarySensor's write_enabled; this should never be called.
void set_min_power(float min_power)
Set the minimum power output of this component.
void set_min_power(float min_power)