6static const char *
const TAG =
"tuya.select";
11 ESP_LOGV(TAG,
"MCU reported select %u value %u", this->
select_id_, enum_value);
13 auto it = std::find(mappings.cbegin(), mappings.cend(), enum_value);
14 if (it == mappings.end()) {
15 ESP_LOGW(TAG,
"Invalid value %u", enum_value);
18 size_t mapping_idx = std::distance(mappings.cbegin(), it);
27 uint8_t mapping = this->
mappings_.at(index);
28 ESP_LOGV(TAG,
"Setting %u datapoint value to %u:%s", this->
select_id_, mapping, this->
option_at(index));
37 LOG_SELECT(
"",
"Tuya Select",
this);
39 " Select has datapoint ID %u\n"
44 for (
size_t i = 0; i < this->
mappings_.size(); i++) {
const char * option_at(size_t index) const
Return the option value at the provided index offset (as const char* from flash).
void publish_state(const std::string &state)
const FixedVector< const char * > & get_options() const
void set_enum_datapoint_value(uint8_t datapoint_id, uint8_t value)
void register_listener(uint8_t datapoint_id, const std::function< void(TuyaDatapoint)> &func)
void set_integer_datapoint_value(uint8_t datapoint_id, uint32_t value)
void dump_config() override
void control(size_t index) override
std::vector< uint8_t > mappings_