7static const char *
const TAG =
"tuya.select";
12 ESP_LOGV(TAG,
"MCU reported select %u value %u", this->
select_id_, enum_value);
14 auto it = std::find(mappings.cbegin(), mappings.cend(), enum_value);
15 if (it == mappings.end()) {
16 ESP_LOGW(TAG,
"Invalid value %u", enum_value);
19 size_t mapping_idx = std::distance(mappings.cbegin(), it);
28 uint8_t mapping = this->
mappings_.at(index);
29 ESP_LOGV(TAG,
"Setting %u datapoint value to %u:%s", this->
select_id_, mapping, this->
option_at(index));
38 LOG_SELECT(
"",
"Tuya Select",
this);
40 " Select has datapoint ID %u\n"
45 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_
Providing packet encoding functions for exchanging data with a remote host.