1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-31 15:12:06 +00:00
This commit is contained in:
J. Nick Koston
2025-10-21 12:34:02 -10:00
parent 65c88e3ec4
commit cc6ee15e99

View File

@@ -9,12 +9,7 @@ static const char *const TAG = "copy.select";
void CopySelect::setup() { void CopySelect::setup() {
source_->add_on_state_callback([this](const std::string &value, size_t index) { this->publish_state(value); }); source_->add_on_state_callback([this](const std::string &value, size_t index) { this->publish_state(value); });
// Copy options from source select this->traits.copy_options(source_->traits.get_options());
const auto &source_options = source_->traits.get_options();
this->traits.options_.init(source_options.size());
for (const auto &option : source_options) {
this->traits.options_.push_back(option);
}
if (source_->has_state()) if (source_->has_state())
this->publish_state(source_->state); this->publish_state(source_->state);