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); \ 42 this->binary_state_ = binary_state;
46 this->binary_state_ = binary_state;
63 ESPDEPRECATED(
"set_speed() with string argument is deprecated, use integer argument instead.",
"2021.9")
64 FanCall &set_speed(
const char *legacy_speed);
91 std::string preset_mode_{};
126 void add_on_state_callback(std::function<
void()> &&callback);
128 void publish_state();
138 virtual void control(
const FanCall &call) = 0;
143 void dump_traits_(
const char *tag,
const char *prefix);
optional< bool > oscillating_
FanCall & set_direction(optional< FanDirection > direction)
optional< FanDirection > get_direction() const
optional< int > get_speed() const
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.
FanRestoreMode
Restore mode of a fan.
FanCall & set_speed(int speed)
esphome::fan::Fan __attribute__
optional< bool > binary_state_
FanDirection
Simple enum to represent the direction of a fan.
void set_restore_mode(FanRestoreMode restore_mode)
Set the restore mode of this fan.
optional< bool > get_state() const
optional< bool > get_oscillating() const
FanCall & set_oscillating(bool oscillating)
FanRestoreMode restore_mode_
FanCall & set_state(optional< bool > binary_state)
FanCall & set_state(bool binary_state)
FanCall & set_preset_mode(const std::string &preset_mode)
Implementation of SPI Controller mode.
const LogString * fan_direction_to_string(FanDirection direction)
enum ESPDEPRECATED("LegacyFanDirection members are deprecated, use FanDirection instead.", "2022.2") LegacyFanDirection
std::string get_preset_mode() const
FanCall & set_direction(FanDirection direction)
FanCall & set_oscillating(optional< bool > oscillating)