1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-31 23:21:54 +00:00

Merge branch 'select_options_in_flash' into integration

This commit is contained in:
J. Nick Koston
2025-10-25 00:25:41 -07:00
3 changed files with 2 additions and 3 deletions

View File

@@ -3,7 +3,7 @@
namespace esphome { namespace esphome {
namespace select { namespace select {
void SelectTraits::set_options(std::initializer_list<const char *> options) { this->options_ = options; } void SelectTraits::set_options(const std::initializer_list<const char *> &options) { this->options_ = options; }
void SelectTraits::set_options(const FixedVector<const char *> &options) { void SelectTraits::set_options(const FixedVector<const char *> &options) {
this->options_.init(options.size()); this->options_.init(options.size());

View File

@@ -8,7 +8,7 @@ namespace select {
class SelectTraits { class SelectTraits {
public: public:
void set_options(std::initializer_list<const char *> options); void set_options(const std::initializer_list<const char *> &options);
void set_options(const FixedVector<const char *> &options); void set_options(const FixedVector<const char *> &options);
const FixedVector<const char *> &get_options() const; const FixedVector<const char *> &get_options() const;

View File

@@ -10,7 +10,6 @@ void TuyaSelect::setup() {
this->parent_->register_listener(this->select_id_, [this](const TuyaDatapoint &datapoint) { this->parent_->register_listener(this->select_id_, [this](const TuyaDatapoint &datapoint) {
uint8_t enum_value = datapoint.value_enum; uint8_t enum_value = datapoint.value_enum;
ESP_LOGV(TAG, "MCU reported select %u value %u", this->select_id_, enum_value); ESP_LOGV(TAG, "MCU reported select %u value %u", this->select_id_, enum_value);
const auto &options = this->traits.get_options();
auto mappings = this->mappings_; auto mappings = this->mappings_;
auto it = std::find(mappings.cbegin(), mappings.cend(), enum_value); auto it = std::find(mappings.cbegin(), mappings.cend(), enum_value);
if (it == mappings.end()) { if (it == mappings.end()) {