6static const char *
const TAG =
"template.fan";
15 if (restore.has_value()) {
16 restore->apply(*
this);
23 auto call_state =
call.get_state();
24 if (call_state.has_value())
25 this->
state = *call_state;
26 auto call_speed =
call.get_speed();
27 if (call_speed.has_value() && (this->speed_count_ > 0))
28 this->
speed = *call_speed;
29 auto call_oscillating =
call.get_oscillating();
30 if (call_oscillating.has_value() && this->has_oscillating_)
32 auto call_direction =
call.get_direction();
33 if (call_direction.has_value() && this->has_direction_)
void apply_preset_mode_(const FanCall &call)
Apply preset mode from a FanCall (handles speed-clears-preset convention)
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).
std::vector< const char * > preset_modes_
void control(const fan::FanCall &call) override
void dump_config() override