13#define LOG_FAN(prefix, type, obj) \
14 if ((obj) != nullptr) { \
15 ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \
16 (obj)->dump_traits_(TAG, prefix); \
63 ESPDEPRECATED(
"set_speed() with string argument is deprecated, use integer argument instead.",
"2021.9")
FanCall & set_oscillating(bool oscillating)
FanCall & set_direction(FanDirection direction)
optional< bool > binary_state_
optional< FanDirection > direction_
FanCall & set_direction(optional< FanDirection > direction)
optional< bool > get_state() const
ESPDEPRECATED("set_speed() with string argument is deprecated, use integer argument instead.", "2021.9") FanCall &set_speed(const char *legacy_speed)
optional< bool > get_oscillating() const
FanCall & set_state(optional< bool > binary_state)
FanCall & set_speed(int speed)
FanCall & set_state(bool binary_state)
FanCall & set_oscillating(optional< bool > oscillating)
optional< int > get_speed() const
optional< bool > oscillating_
FanCall & set_preset_mode(const std::string &preset_mode)
optional< FanDirection > get_direction() const
std::string get_preset_mode() const
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.
FanRestoreMode restore_mode_
CallbackManager< void()> state_callback_
bool oscillating
The current oscillation state of the fan.
virtual void control(const FanCall &call)=0
bool state
The current on/off state of the fan.
void set_restore_mode(FanRestoreMode restore_mode)
Set the restore mode of this fan.
int speed
The current fan speed level.
void dump_traits_(const char *tag, const char *prefix)
optional< FanRestoreState > restore_state_()
FanRestoreMode
Restore mode of a fan.
@ RESTORE_INVERTED_DEFAULT_OFF
@ RESTORE_INVERTED_DEFAULT_ON
const LogString * fan_direction_to_string(FanDirection direction)
esphome::fan::Fan __attribute__
FanDirection
Simple enum to represent the direction of a fan.
Providing packet encoding functions for exchanging data with a remote host.
void apply(Fan &fan)
Apply these settings to the fan.
FanCall to_call(Fan &fan)
Convert this struct to a fan call that can be performed.