8 namespace xiaomi_hhccjcy10 {
10 static const char *
const TAG =
"xiaomi_hhccjcy10";
13 ESP_LOGCONFIG(TAG,
"Xiaomi HHCCJCY10");
15 LOG_SENSOR(
" ",
"Moisture", this->
moisture_);
23 ESP_LOGVV(TAG,
"parse_device(): unknown MAC address.");
26 ESP_LOGVV(TAG,
"parse_device(): MAC address %s found.", device.
address_str().c_str());
30 if (!service_data.uuid.contains(0x50, 0xFD)) {
31 ESP_LOGVV(TAG,
"no tuya service data UUID.");
34 if (service_data.data.size() != 9) {
37 const uint8_t *data = service_data.data.data();
48 const uint16_t conductivity =
encode_uint16(data[7], data[8]);
53 const uint32_t illuminance =
encode_uint24(data[3], data[4], data[5]);
bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override
std::string address_str() const
void publish_state(float state)
Publish a new state to the front-end.
constexpr uint32_t encode_uint24(uint8_t byte1, uint8_t byte2, uint8_t byte3)
Encode a 24-bit value given three bytes in most to least significant byte order.
void dump_config() override
sensor::Sensor * illuminance_
constexpr uint16_t encode_uint16(uint8_t msb, uint8_t lsb)
Encode a 16-bit value given the most and least significant byte.
const std::vector< ServiceData > & get_service_datas() const
sensor::Sensor * temperature_
uint64_t address_uint64() const
Implementation of SPI Controller mode.
sensor::Sensor * battery_level_
sensor::Sensor * moisture_
sensor::Sensor * conductivity_