ESPHome  2024.11.1
scene_mode_select.cpp
Go to the documentation of this file.
1 #include "scene_mode_select.h"
2 
3 namespace esphome {
4 namespace seeed_mr24hpc1 {
5 
6 void SceneModeSelect::control(const std::string &value) {
7  this->publish_state(value);
8  auto index = this->index_of(value);
9  if (index.has_value()) {
10  this->parent_->set_scene_mode(index.value());
11  }
12 }
13 
14 } // namespace seeed_mr24hpc1
15 } // namespace esphome
void control(const std::string &value) override
void publish_state(const std::string &state)
Definition: select.cpp:9
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
optional< size_t > index_of(const std::string &option) const
Find the (optional) index offset of the provided option value.
Definition: select.cpp:35