mirror of
https://github.com/esphome/esphome.git
synced 2025-02-22 12:58:15 +00:00
Handle enum type in tuya text_sensor (#5626)
This commit is contained in:
parent
f36ec7c726
commit
0c46403eaf
@ -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…
x
Reference in New Issue
Block a user