ESPHome 2026.5.0-dev
Loading...
Searching...
No Matches
esphome::fan::FanTraits Class Reference

#include <fan_traits.h>

Public Member Functions

 FanTraits ()=default
 
 FanTraits (bool oscillation, bool speed, bool direction, int speed_count)
 
bool supports_oscillation () const
 Return if this fan supports oscillation.
 
void set_oscillation (bool oscillation)
 Set whether this fan supports oscillation.
 
bool supports_speed () const
 Return if this fan supports speed modes.
 
void set_speed (bool speed)
 Set whether this fan supports speed levels.
 
int supported_speed_count () const
 Return how many speed levels the fan has.
 
void set_supported_speed_count (int speed_count)
 Set how many speed levels this fan has.
 
bool supports_direction () const
 Return if this fan supports changing direction.
 
void set_direction (bool direction)
 Set whether this fan supports changing direction.
 
const std::vector< const char * > & supported_preset_modes () const
 
 ESPDEPRECATED ("Call set_supported_preset_modes() on the Fan entity instead. Removed in 2026.11.0", "2026.5.0") void set_supported_preset_modes(std
 
 ESPDEPRECATED ("Call set_supported_preset_modes() on the Fan entity instead. Removed in 2026.11.0", "2026.5.0") void set_supported_preset_modes(const std
 
void set_supported_preset_modes (const std::vector< std::string > &preset_modes)=delete
 
void set_supported_preset_modes (std::initializer_list< std::string > preset_modes)=delete
 
bool supports_preset_modes () const
 Return if preset modes are supported.
 
const char * find_preset_mode (const char *preset_mode) const
 Find and return the matching preset mode pointer from supported modes, or nullptr if not found.
 
const char * find_preset_mode (const char *preset_mode, size_t len) const
 

Protected Member Functions

void set_supported_preset_modes_ (const std::vector< const char * > *preset_modes)
 Set the preset modes pointer (only Fan::wire_preset_modes_() should call this).
 

Protected Attributes

bool oscillation_ {false}
 
bool speed_ {false}
 
bool direction_ {false}
 
int speed_count_ {}
 
const std::vector< const char * > * preset_modes_ {nullptr}
 
std::vector< const char * > compat_preset_modes_
 

Detailed Description

Definition at line 14 of file fan_traits.h.

Constructor & Destructor Documentation

◆ FanTraits() [1/2]

esphome::fan::FanTraits::FanTraits ( )
default

◆ FanTraits() [2/2]

esphome::fan::FanTraits::FanTraits ( bool oscillation,
bool speed,
bool direction,
int speed_count )
inline

Definition at line 19 of file fan_traits.h.

Member Function Documentation

◆ ESPDEPRECATED() [1/2]

esphome::fan::FanTraits::ESPDEPRECATED ( "Call set_supported_preset_modes() on the Fan entity instead. Removed in 2026.11.0" ,
"2026.5.0"  ) const
inline

Definition at line 47 of file fan_traits.h.

◆ ESPDEPRECATED() [2/2]

esphome::fan::FanTraits::ESPDEPRECATED ( "Call set_supported_preset_modes() on the Fan entity instead. Removed in 2026.11.0" ,
"2026.5.0"  )
inline

Definition at line 41 of file fan_traits.h.

◆ find_preset_mode() [1/2]

const char * esphome::fan::FanTraits::find_preset_mode ( const char * preset_mode) const
inline

Find and return the matching preset mode pointer from supported modes, or nullptr if not found.

Definition at line 65 of file fan_traits.h.

◆ find_preset_mode() [2/2]

const char * esphome::fan::FanTraits::find_preset_mode ( const char * preset_mode,
size_t len ) const
inline

Definition at line 68 of file fan_traits.h.

◆ set_direction()

void esphome::fan::FanTraits::set_direction ( bool direction)
inline

Set whether this fan supports changing direction.

Definition at line 37 of file fan_traits.h.

◆ set_oscillation()

void esphome::fan::FanTraits::set_oscillation ( bool oscillation)
inline

Set whether this fan supports oscillation.

Definition at line 25 of file fan_traits.h.

◆ set_speed()

void esphome::fan::FanTraits::set_speed ( bool speed)
inline

Set whether this fan supports speed levels.

Definition at line 29 of file fan_traits.h.

◆ set_supported_preset_modes() [1/2]

void esphome::fan::FanTraits::set_supported_preset_modes ( const std::vector< std::string > & preset_modes)
delete

◆ set_supported_preset_modes() [2/2]

void esphome::fan::FanTraits::set_supported_preset_modes ( std::initializer_list< std::string > preset_modes)
delete

◆ set_supported_preset_modes_()

void esphome::fan::FanTraits::set_supported_preset_modes_ ( const std::vector< const char * > * preset_modes)
inlineprotected

Set the preset modes pointer (only Fan::wire_preset_modes_() should call this).

Definition at line 84 of file fan_traits.h.

◆ set_supported_speed_count()

void esphome::fan::FanTraits::set_supported_speed_count ( int speed_count)
inline

Set how many speed levels this fan has.

Definition at line 33 of file fan_traits.h.

◆ supported_preset_modes()

const std::vector< const char * > & esphome::fan::FanTraits::supported_preset_modes ( ) const

Definition at line 17 of file fan.cpp.

◆ supported_speed_count()

int esphome::fan::FanTraits::supported_speed_count ( ) const
inline

Return how many speed levels the fan has.

Definition at line 31 of file fan_traits.h.

◆ supports_direction()

bool esphome::fan::FanTraits::supports_direction ( ) const
inline

Return if this fan supports changing direction.

Definition at line 35 of file fan_traits.h.

◆ supports_oscillation()

bool esphome::fan::FanTraits::supports_oscillation ( ) const
inline

Return if this fan supports oscillation.

Definition at line 23 of file fan_traits.h.

◆ supports_preset_modes()

bool esphome::fan::FanTraits::supports_preset_modes ( ) const
inline

Return if preset modes are supported.

Definition at line 57 of file fan_traits.h.

◆ supports_speed()

bool esphome::fan::FanTraits::supports_speed ( ) const
inline

Return if this fan supports speed modes.

Definition at line 27 of file fan_traits.h.

Field Documentation

◆ compat_preset_modes_

std::vector<const char *> esphome::fan::FanTraits::compat_preset_modes_
protected

Definition at line 95 of file fan_traits.h.

◆ direction_

bool esphome::fan::FanTraits::direction_ {false}
protected

Definition at line 90 of file fan_traits.h.

◆ oscillation_

bool esphome::fan::FanTraits::oscillation_ {false}
protected

Definition at line 88 of file fan_traits.h.

◆ preset_modes_

const std::vector<const char *>* esphome::fan::FanTraits::preset_modes_ {nullptr}
protected

Definition at line 92 of file fan_traits.h.

◆ speed_

bool esphome::fan::FanTraits::speed_ {false}
protected

Definition at line 89 of file fan_traits.h.

◆ speed_count_

int esphome::fan::FanTraits::speed_count_ {}
protected

Definition at line 91 of file fan_traits.h.


The documentation for this class was generated from the following files: