ESPHome  2022.12.8
xiaomi_cgpr1.h
Go to the documentation of this file.
1 #pragma once
2 
8 
9 #ifdef USE_ESP32
10 
11 namespace esphome {
12 namespace xiaomi_cgpr1 {
13 
14 class XiaomiCGPR1 : public Component,
17  public:
18  void set_address(uint64_t address) { address_ = address; }
19  void set_bindkey(const std::string &bindkey);
20 
21  bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override;
22 
23  void dump_config() override;
24  float get_setup_priority() const override { return setup_priority::DATA; }
25  void set_battery_level(sensor::Sensor *battery_level) { battery_level_ = battery_level; }
26  void set_illuminance(sensor::Sensor *illuminance) { illuminance_ = illuminance; }
27  void set_idle_time(sensor::Sensor *idle_time) { idle_time_ = idle_time; }
28 
29  protected:
30  uint64_t address_;
31  uint8_t bindkey_[16];
35 };
36 
37 } // namespace xiaomi_cgpr1
38 } // namespace esphome
39 
40 #endif
const float DATA
For components that import data from directly connected sensors like DHT.
Definition: component.cpp:18
void set_bindkey(const std::string &bindkey)
void set_illuminance(sensor::Sensor *illuminance)
Definition: xiaomi_cgpr1.h:26
void set_idle_time(sensor::Sensor *idle_time)
Definition: xiaomi_cgpr1.h:27
void set_address(uint64_t address)
Definition: xiaomi_cgpr1.h:18
Definition: a4988.cpp:4
float get_setup_priority() const override
Definition: xiaomi_cgpr1.h:24
bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override
Base-class for all sensors.
Definition: sensor.h:50
void set_battery_level(sensor::Sensor *battery_level)
Definition: xiaomi_cgpr1.h:25