7namespace xiaomi_hhccjcy01 {
9static const char *
const TAG =
"xiaomi_hhccjcy01";
12 ESP_LOGCONFIG(TAG,
"Xiaomi HHCCJCY01");
14 LOG_SENSOR(
" ",
"Moisture", this->
moisture_);
22 ESP_LOGVV(TAG,
"parse_device(): unknown MAC address.");
25 ESP_LOGVV(TAG,
"parse_device(): MAC address %s found.", device.
address_str().c_str());
30 if (!res.has_value()) {
33 if (res->is_duplicate) {
36 if (res->has_encryption) {
37 ESP_LOGVV(TAG,
"parse_device(): payload decryption is currently not supported on this device.");
46 if (res->temperature.has_value() && this->temperature_ !=
nullptr)
48 if (res->moisture.has_value() && this->moisture_ !=
nullptr)
50 if (res->conductivity.has_value() && this->conductivity_ !=
nullptr)
52 if (res->illuminance.has_value() && this->illuminance_ !=
nullptr)
54 if (res->battery_level.has_value() && this->battery_level_ !=
nullptr)
uint64_t address_uint64() const
const std::vector< ServiceData > & get_service_datas() const
std::string address_str() const
void publish_state(float state)
Publish a new state to the front-end.
sensor::Sensor * temperature_
sensor::Sensor * battery_level_
sensor::Sensor * moisture_
sensor::Sensor * illuminance_
sensor::Sensor * conductivity_
bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override
void dump_config() override
optional< XiaomiParseResult > parse_xiaomi_header(const esp32_ble_tracker::ServiceData &service_data)
bool parse_xiaomi_message(const std::vector< uint8_t > &message, XiaomiParseResult &result)
bool report_xiaomi_results(const optional< XiaomiParseResult > &result, const std::string &address)
Providing packet encoding functions for exchanging data with a remote host.