mirror of
https://github.com/esphome/esphome.git
synced 2025-01-08 13:51:43 +01:00
33 lines
988 B
C++
33 lines
988 B
C++
#pragma once
|
|
|
|
#include "esphome/core/component.h"
|
|
#include "esphome/components/sensor/sensor.h"
|
|
#include "esphome/components/esp32_ble_tracker/esp32_ble_tracker.h"
|
|
#include "esphome/components/xiaomi_ble/xiaomi_ble.h"
|
|
|
|
#ifdef ARDUINO_ARCH_ESP32
|
|
|
|
namespace esphome {
|
|
namespace xiaomi_hhccpot002 {
|
|
|
|
class XiaomiHHCCPOT002 : public Component, public esp32_ble_tracker::ESPBTDeviceListener {
|
|
public:
|
|
void set_address(uint64_t address) { address_ = address; }
|
|
|
|
bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override;
|
|
|
|
void dump_config() override;
|
|
float get_setup_priority() const override { return setup_priority::DATA; }
|
|
void set_moisture(sensor::Sensor *moisture) { moisture_ = moisture; }
|
|
void set_conductivity(sensor::Sensor *conductivity) { conductivity_ = conductivity; }
|
|
|
|
protected:
|
|
uint64_t address_;
|
|
sensor::Sensor *moisture_{nullptr};
|
|
sensor::Sensor *conductivity_{nullptr};
|
|
};
|
|
|
|
} // namespace xiaomi_hhccpot002
|
|
} // namespace esphome
|
|
|
|
#endif
|