ESPHome 2025.5.0
Loading...
Searching...
No Matches
float_output.h
Go to the documentation of this file.
1#pragma once
2
4#include "binary_output.h"
5
6namespace esphome {
7namespace output {
8
9#define LOG_FLOAT_OUTPUT(this) \
10 LOG_BINARY_OUTPUT(this) \
11 if (this->max_power_ != 1.0f) { \
12 ESP_LOGCONFIG(TAG, " Max Power: %.1f%%", this->max_power_ * 100.0f); \
13 } \
14 if (this->min_power_ != 0.0f) { \
15 ESP_LOGCONFIG(TAG, " Min Power: %.1f%%", this->min_power_ * 100.0f); \
16 }
17
31class FloatOutput : public BinaryOutput {
32 public:
39 void set_max_power(float max_power);
40
47 void set_min_power(float min_power);
48
53 void set_zero_means_zero(bool zero_means_zero);
54
59 void set_level(float state);
60
67 virtual void update_frequency(float frequency) {}
68
69 // ========== INTERNAL METHODS ==========
70 // (In most use cases you won't need these)
71
73 float get_max_power() const;
74
76 float get_min_power() const;
77
78 protected:
80 void write_state(bool state) override;
81 virtual void write_state(float state) = 0;
82
83 float max_power_{1.0f};
84 float min_power_{0.0f};
86};
87
88} // namespace output
89} // namespace esphome
uint16_le_t frequency
Definition bl0942.h:6
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.
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.
bool state
Definition fan.h:0
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7