mirror of
https://github.com/esphome/esphome.git
synced 2024-11-25 08:28:12 +01:00
Handle enum type in tuya text_sensor (#5626)
This commit is contained in:
parent
f36ec7c726
commit
0c46403eaf
1 changed files with 7 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
#include "esphome/core/log.h"
|
||||
#include "tuya_text_sensor.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace tuya {
|
||||
|
@ -19,6 +19,12 @@ void TuyaTextSensor::setup() {
|
|||
this->publish_state(data);
|
||||
break;
|
||||
}
|
||||
case TuyaDatapointType::ENUM: {
|
||||
std::string data = to_string(datapoint.value_enum);
|
||||
ESP_LOGD(TAG, "MCU reported text sensor %u is: %s", datapoint.id, data.c_str());
|
||||
this->publish_state(data);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ESP_LOGW(TAG, "Unsupported data type for tuya text sensor %u: %#02hhX", datapoint.id, (uint8_t) datapoint.type);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue