9static const char *
const TAG =
"select";
13 if (index.has_value()) {
16 ESP_LOGE(TAG,
"'%s': Invalid option %s", this->
get_name().c_str(),
state);
22 ESP_LOGE(TAG,
"'%s': Invalid index %zu", this->
get_name().c_str(), index);
25 const char *option = this->
option_at(index);
28 ESP_LOGV(TAG,
"'%s' >> %s (%zu)", this->
get_name().c_str(), option, index);
30#if defined(USE_SELECT) && defined(USE_CONTROLLER_REGISTRY)
31 ControllerRegistry::notify_select_update(
this);
37 for (
size_t i = 0; i <
options.size(); i++) {
55 return std::string(
options.at(index));
const StringRef & get_name() const
void set_has_state(bool state)
T & at(size_t i)
Access element with bounds checking (matches std::vector behavior) Note: No exception thrown on out o...
const char * option_at(size_t index) const
Return the option value at the provided index offset (as const char* from flash).
optional< size_t > active_index() const
Return the (optional) index offset of the currently active option.
LazyCallbackManager< void(size_t)> state_callback_
optional< std::string > at(size_t index) const
Return the (optional) option value at the provided index offset.
optional< size_t > index_of(const char *option, size_t len) const
Find the (optional) index offset of the provided option value.
bool has_index(size_t index) const
Return whether this select component contains the provided index offset.
void publish_state(const std::string &state)
const FixedVector< const char * > & get_options() const