Readds the battery level for xiaomi_hhccjcy01 (#1288)

This commit is contained in:
Jesse Hills
2020-09-20 14:37:34 +12:00
committed by GitHub
parent b5df50893b
commit 99598d87a9
4 changed files with 13 additions and 2 deletions
@@ -14,6 +14,7 @@ void XiaomiHHCCJCY01::dump_config() {
LOG_SENSOR(" ", "Moisture", this->moisture_);
LOG_SENSOR(" ", "Conductivity", this->conductivity_);
LOG_SENSOR(" ", "Illuminance", this->illuminance_);
LOG_SENSOR(" ", "Battery Level", this->battery_level_);
}
bool XiaomiHHCCJCY01::parse_device(const esp32_ble_tracker::ESPBTDevice &device) {
@@ -50,6 +51,8 @@ bool XiaomiHHCCJCY01::parse_device(const esp32_ble_tracker::ESPBTDevice &device)
this->conductivity_->publish_state(*res->conductivity);
if (res->illuminance.has_value() && this->illuminance_ != nullptr)
this->illuminance_->publish_state(*res->illuminance);
if (res->battery_level.has_value() && this->battery_level_ != nullptr)
this->battery_level_->publish_state(*res->battery_level);
success = true;
}