1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-29 08:32:26 +01:00

Merge branch 'integration' into memory_api

This commit is contained in:
J. Nick Koston
2025-09-25 14:20:58 -05:00
2 changed files with 6 additions and 5 deletions

View File

@@ -34,11 +34,12 @@ size_t Select::size() const {
optional<size_t> Select::index_of(const std::string &option) const { optional<size_t> Select::index_of(const std::string &option) const {
const auto &options = traits.get_options(); const auto &options = traits.get_options();
auto it = std::find(options.begin(), options.end(), option); for (size_t i = 0; i < options.size(); i++) {
if (it == options.end()) { if (options[i] == option) {
return {}; return i;
} }
return std::distance(options.begin(), it); }
return {};
} }
optional<size_t> Select::active_index() const { optional<size_t> Select::active_index() const {

View File

@@ -107,7 +107,7 @@ void SelectCall::perform() {
} }
} }
if (std::find(options.begin(), options.end(), target_value) == options.end()) { if (!parent->has_option(target_value)) {
ESP_LOGW(TAG, "'%s' - Option %s is not a valid option", name, target_value.c_str()); ESP_LOGW(TAG, "'%s' - Option %s is not a valid option", name, target_value.c_str());
return; return;
} }