mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 05:24:53 +01:00
Handle enum type in tuya text_sensor (#5626)
This commit is contained in:
parent
f96a839bcf
commit
a1845e1e72
1 changed files with 7 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
||||||
#include "esphome/core/log.h"
|
|
||||||
#include "tuya_text_sensor.h"
|
#include "tuya_text_sensor.h"
|
||||||
|
#include "esphome/core/log.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace tuya {
|
namespace tuya {
|
||||||
|
@ -19,6 +19,12 @@ void TuyaTextSensor::setup() {
|
||||||
this->publish_state(data);
|
this->publish_state(data);
|
||||||
break;
|
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:
|
default:
|
||||||
ESP_LOGW(TAG, "Unsupported data type for tuya text sensor %u: %#02hhX", datapoint.id, (uint8_t) datapoint.type);
|
ESP_LOGW(TAG, "Unsupported data type for tuya text sensor %u: %#02hhX", datapoint.id, (uint8_t) datapoint.type);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue