7static const char *
const TAG =
"fan.hbridge";
12 ESP_LOGD(TAG,
"Setting speed: a: %.2f, b: %.2f", a_level, b_level);
21 ESP_LOGD(TAG,
"Setting speed: a: %.2f, b: %.2f, enable: %.2f", a_level, b_level, enable);
25 ESP_LOGD(TAG,
"Braking");
32 if (restore.has_value()) {
33 restore->apply(*
this);
43 LOG_FAN(
"",
"H-Bridge Fan",
this);
45 ESP_LOGCONFIG(TAG,
" Decay Mode: Slow");
47 ESP_LOGCONFIG(TAG,
" Decay Mode: Fast");
52 if (
call.get_state().has_value())
54 if (
call.get_speed().has_value())
56 if (
call.get_oscillating().has_value())
58 if (
call.get_direction().has_value())
optional< bool > get_state() const
const char * get_preset_mode() const
optional< bool > get_oscillating() const
FanCall & set_state(bool binary_state)
optional< int > get_speed() const
optional< FanDirection > get_direction() const
bool set_preset_mode_(const char *preset_mode)
Set the preset mode (finds and stores pointer from traits). Returns true if changed.
FanDirection direction
The current direction of the fan.
bool oscillating
The current oscillation state of the fan.
bool state
The current on/off state of the fan.
int speed
The current fan speed level.
optional< FanRestoreState > restore_state_()
void set_supported_preset_modes(std::initializer_list< const char * > preset_modes)
Set the preset modes supported by the fan (from initializer list).
output::FloatOutput * pin_a_
std::vector< const char * > preset_modes_
void dump_config() override
output::BinaryOutput * oscillating_
void set_hbridge_levels_(float a_level, float b_level)
output::FloatOutput * enable_
void control(const fan::FanCall &call) override
output::FloatOutput * pin_b_
virtual void set_state(bool state)
Enable or disable this binary output.
void set_level(float state)
Set the level of this float output, this is called from the front-end.
Providing packet encoding functions for exchanging data with a remote host.