|
ESPHome 2025.12.0-dev
|
#include <fan.h>
Public Member Functions | |
| FanCall | turn_on () |
| FanCall | turn_off () |
| FanCall | toggle () |
| FanCall | make_call () |
| void | add_on_state_callback (std::function< void()> &&callback) |
| Register a callback that will be called each time the state changes. | |
| void | publish_state () |
| virtual FanTraits | get_traits ()=0 |
| void | set_restore_mode (FanRestoreMode restore_mode) |
| Set the restore mode of this fan. | |
| const char * | get_preset_mode () const |
| Get the current preset mode (returns pointer to string stored in traits, or nullptr if not set) | |
| bool | has_preset_mode () const |
| Check if a preset mode is currently active. | |
Public Member Functions inherited from esphome::EntityBase | |
| const StringRef & | get_name () const |
| void | set_name (const char *name) |
| bool | has_own_name () const |
| std::string | get_object_id () const |
| void | set_object_id (const char *object_id) |
| uint32_t | get_object_id_hash () |
| bool | is_internal () const |
| void | set_internal (bool internal) |
| bool | is_disabled_by_default () const |
| void | set_disabled_by_default (bool disabled_by_default) |
| EntityCategory | get_entity_category () const |
| void | set_entity_category (EntityCategory entity_category) |
| ESPDEPRECATED("Use get_icon_ref() instead for better performance (avoids string copy). Will be removed in ESPHome 2026.5.0", "2025.11.0") std void | set_icon (const char *icon) |
| StringRef | get_icon_ref () const |
| uint32_t | get_device_id () const |
| void | set_device (Device *device) |
| bool | has_state () const |
| void | set_has_state (bool state) |
| uint32_t | get_preference_hash () |
| Get a unique hash for storing preferences/settings for this entity. | |
Data Fields | |
| bool | state {false} |
| The current on/off state of the fan. | |
| bool | oscillating {false} |
| The current oscillation state of the fan. | |
| int | speed {0} |
| The current fan speed level. | |
| FanDirection | direction {FanDirection::FORWARD} |
| The current direction of the fan. | |
Protected Member Functions | |
| virtual void | control (const FanCall &call)=0 |
| optional< FanRestoreState > | restore_state_ () |
| void | save_state_ () |
| void | dump_traits_ (const char *tag, const char *prefix) |
| bool | set_preset_mode_ (const char *preset_mode) |
| Set the preset mode (finds and stores pointer from traits). Returns true if changed. | |
| bool | set_preset_mode_ (const std::string &preset_mode) |
| Set the preset mode (finds and stores pointer from traits). Returns true if changed. | |
| void | clear_preset_mode_ () |
| Clear the preset mode. | |
| const char * | find_preset_mode_ (const char *preset_mode) |
| Find and return the matching preset mode pointer from traits, or nullptr if not found. | |
Protected Member Functions inherited from esphome::EntityBase | |
| StringRef | get_object_id_ref_for_api_ () const |
| void | calc_object_id_ () |
| bool | is_object_id_dynamic_ () const |
| Check if the object_id is dynamic (changes with MAC suffix) | |
Protected Attributes | |
| friend | FanCall |
| CallbackManager< void()> | state_callback_ {} |
| ESPPreferenceObject | rtc_ |
| FanRestoreMode | restore_mode_ |
Protected Attributes inherited from esphome::EntityBase | |
| StringRef | name_ |
| const char * | object_id_c_str_ {nullptr} |
| const char * | icon_c_str_ {nullptr} |
| uint32_t | object_id_hash_ {} |
| Device * | device_ {} |
| struct esphome::EntityBase::EntityFlags | flags_ |
| void esphome::fan::Fan::add_on_state_callback | ( | std::function< void()> && | callback | ) |
|
protected |
|
protectedpure virtual |
|
protected |
|
protected |
|
inline |
|
pure virtual |
|
inline |
|
protected |
|
protected |
|
protected |
|
inline |
| FanDirection esphome::fan::Fan::direction {FanDirection::FORWARD} |
| bool esphome::fan::Fan::oscillating {false} |
|
protected |
|
protected |
| bool esphome::fan::Fan::state {false} |
|
protected |