ESPHome  2021.11.3
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
esphome::select::Select Class Referenceabstract

Base-class for all selects. More...

#include <select.h>

Inheritance diagram for esphome::select::Select:
esphome::EntityBase esphome::template_::TemplateSelect

Public Member Functions

void publish_state (const std::string &state)
SelectCall make_call ()
void set (const std::string &value)
void add_on_state_callback (std::function< void(std::string)> &&callback)
bool has_state () const
 Return whether this select has gotten a full state yet. More...
- Public Member Functions inherited from esphome::EntityBase
 EntityBase ()
 EntityBase (std::string name)
const std::string & get_name () const
void set_name (const std::string &name)
const std::string & get_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)
const std::string & get_icon () const
void set_icon (const std::string &name)

Data Fields

std::string state
SelectTraits traits

Protected Member Functions

virtual void control (const std::string &value)=0
 Set the value of the select, this is a virtual method that each select integration must implement. More...
uint32_t hash_base () override
- Protected Member Functions inherited from esphome::EntityBase
void calc_object_id_ ()

Protected Attributes

CallbackManager< void(std::string)> state_callback_
bool has_state_ {false}
- Protected Attributes inherited from esphome::EntityBase
std::string name_
std::string object_id_
std::string icon_
uint32_t object_id_hash_
bool internal_ {false}
bool disabled_by_default_ {false}
EntityCategory entity_category_ {ENTITY_CATEGORY_NONE}

Detailed Description

Base-class for all selects.

A select can use publish_state to send out a new value.

Definition at line 51 of file select.h.

Member Function Documentation

◆ add_on_state_callback()

void esphome::select::Select::add_on_state_callback ( std::function< void(std::string)> &&  callback)

Definition at line 36 of file select.cpp.

◆ control()

virtual void esphome::select::Select::control ( const std::string &  value)
protectedpure virtual

Set the value of the select, this is a virtual method that each select integration must implement.

This method is called by the SelectCall.

valueThe value as validated by the SelectCall.

Implemented in esphome::template_::TemplateSelect.

◆ has_state()

bool esphome::select::Select::has_state ( ) const

Return whether this select has gotten a full state yet.

Definition at line 65 of file select.h.

◆ hash_base()

uint32_t esphome::select::Select::hash_base ( )

Implements esphome::EntityBase.

Definition at line 40 of file select.cpp.

◆ make_call()

SelectCall esphome::select::Select::make_call ( )

Definition at line 57 of file select.h.

◆ publish_state()

void esphome::select::Select::publish_state ( const std::string &  state)

Definition at line 29 of file select.cpp.

◆ set()

void esphome::select::Select::set ( const std::string &  value)

Definition at line 58 of file select.h.

Field Documentation

◆ has_state_

bool esphome::select::Select::has_state_ {false}

Definition at line 81 of file select.h.

◆ state

std::string esphome::select::Select::state

Definition at line 53 of file select.h.

◆ state_callback_

CallbackManager<void(std::string)> esphome::select::Select::state_callback_

Definition at line 80 of file select.h.

◆ traits

SelectTraits esphome::select::Select::traits

Definition at line 62 of file select.h.

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