ESPHome 2025.5.0
Loading...
Searching...
No Matches
logger_level_select.cpp
Go to the documentation of this file.
2
3namespace esphome {
4namespace logger {
5
7 auto value = this->at(level);
8 if (!value) {
9 return;
10 }
11 Select::publish_state(value.value());
12}
13
15 this->parent_->add_listener([this](int level) { this->publish_state(level); });
16 this->publish_state(this->parent_->get_log_level());
17}
18
19void LoggerLevelSelect::control(const std::string &value) {
20 auto level = this->index_of(value);
21 if (!level)
22 return;
23 this->parent_->set_log_level(level.value());
24}
25
26} // namespace logger
27} // namespace esphome
void control(const std::string &value) override
optional< size_t > index_of(const std::string &option) const
Find the (optional) index offset of the provided option value.
Definition select.cpp:35
optional< std::string > at(size_t index) const
Return the (optional) option value at the provided index offset.
Definition select.cpp:52
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7