ESPHome  2022.12.8
xiaomi_rtcgq02lm.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "esphome/core/defines.h"
5 #ifdef USE_BINARY_SENSOR
7 #endif
8 #ifdef USE_SENSOR
10 #endif
12 #include "esphome/core/component.h"
13 
14 #ifdef USE_ESP32
15 
16 namespace esphome {
17 namespace xiaomi_rtcgq02lm {
18 
20  public:
21  void set_address(uint64_t address) { address_ = address; };
22  void set_bindkey(const std::string &bindkey);
23 
24  bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override;
25  void dump_config() override;
26  float get_setup_priority() const override { return setup_priority::DATA; }
27 
28 #ifdef USE_BINARY_SENSOR
29  void set_motion(binary_sensor::BinarySensor *motion) { this->motion_ = motion; }
30  void set_motion_timeout(uint16_t timeout) { this->motion_timeout_ = timeout; }
31 
32  void set_light(binary_sensor::BinarySensor *light) { this->light_ = light; }
33  void set_button(binary_sensor::BinarySensor *button) { this->button_ = button; }
34  void set_button_timeout(uint16_t timeout) { this->button_timeout_ = timeout; }
35 #endif
36 
37 #ifdef USE_SENSOR
38  void set_battery_level(sensor::Sensor *battery_level) { battery_level_ = battery_level; }
39 #endif
40 
41  protected:
42  uint64_t address_;
43  uint8_t bindkey_[16];
44 
45 #ifdef USE_BINARY_SENSOR
46  uint16_t motion_timeout_;
47  uint16_t button_timeout_;
48 
52 #endif
53 #ifdef USE_SENSOR
55 #endif
56 };
57 
58 } // namespace xiaomi_rtcgq02lm
59 } // namespace esphome
60 
61 #endif
void set_button(binary_sensor::BinarySensor *button)
const float DATA
For components that import data from directly connected sensors like DHT.
Definition: component.cpp:18
binary_sensor::BinarySensor * motion_
binary_sensor::BinarySensor * button_
void set_light(binary_sensor::BinarySensor *light)
void set_bindkey(const std::string &bindkey)
void set_battery_level(sensor::Sensor *battery_level)
bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override
Definition: a4988.cpp:4
Base class for all binary_sensor-type classes.
Definition: binary_sensor.h:28
Base-class for all sensors.
Definition: sensor.h:50
void set_motion(binary_sensor::BinarySensor *motion)
binary_sensor::BinarySensor * light_