7static const char *
const TAG =
"copy.fan";
44 if (
call.get_state().has_value())
46 if (
call.get_oscillating().has_value())
48 if (
call.get_speed().has_value())
50 if (
call.get_direction().has_value())
52 if (!
call.get_preset_mode().empty())
void control(const fan::FanCall &call) override
void dump_config() override
fan::FanTraits get_traits() override
FanCall & set_oscillating(bool oscillating)
FanCall & set_direction(FanDirection direction)
FanCall & set_speed(int speed)
FanCall & set_state(bool binary_state)
FanCall & set_preset_mode(const std::string &preset_mode)
virtual FanTraits get_traits()=0
void add_on_state_callback(std::function< void()> &&callback)
Register a callback that will be called each time the state changes.
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.
void set_direction(bool direction)
Set whether this fan supports changing direction.
void set_speed(bool speed)
Set whether this fan supports speed levels.
void set_supported_speed_count(int speed_count)
Set how many speed levels this fan has.
void set_oscillation(bool oscillation)
Set whether this fan supports oscillation.
void set_supported_preset_modes(const std::set< std::string > &preset_modes)
Set the preset modes supported by the fan.
Providing packet encoding functions for exchanging data with a remote host.