refactored xiaomi sensors (#755)

* refactored xiaomi sensors

* fix lint

* fixed and added tests

* fix namespace

* LYWSD02 has no battery level

* fixed enum

* fix

* fix case

* fix spaces in empty line...

* inform users of old sensors about the change
This commit is contained in:
Alexander Leisentritt
2019-10-16 13:29:56 +02:00
committed by Otto Winter
parent cdb9c59662
commit cdfbe5b523
17 changed files with 159 additions and 139 deletions
@@ -0,0 +1,21 @@
#include "xiaomi_lywsdcgq.h"
#include "esphome/core/log.h"
#ifdef ARDUINO_ARCH_ESP32
namespace esphome {
namespace xiaomi_lywsdcgq {
static const char *TAG = "xiaomi_lywsdcgq";
void XiaomiLYWSDCGQ::dump_config() {
ESP_LOGCONFIG(TAG, "Xiaomi LYWSDCGQ");
LOG_SENSOR(" ", "Temperature", this->temperature_);
LOG_SENSOR(" ", "Humidity", this->humidity_);
LOG_SENSOR(" ", "Battery Level", this->battery_level_);
}
} // namespace xiaomi_lywsdcgq
} // namespace esphome
#endif