-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathmiot_rtcgq2lm.h
37 lines (28 loc) · 1.27 KB
/
miot_rtcgq2lm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once
#include "esphome/core/component.h"
#include "esphome/components/sensor/sensor.h"
#include "esphome/components/binary_sensor/binary_sensor.h"
#include "../miot/miot.h"
namespace esphome {
namespace miot_rtcgq02lm {
class MiotRTCGQ02LM : public miot::MiotComponent, public binary_sensor::BinarySensor {
public:
MiotRTCGQ02LM() { this->product_id_ = 0x0A8D; }
void dump_config() override;
void set_light(binary_sensor::BinarySensor *light) { this->light_ = light; }
void set_timeout(binary_sensor::BinarySensor *timeout) { this->timeout_ = timeout; }
void set_idle_time(sensor::Sensor *idle_time) { this->idle_time_ = idle_time; }
// void set_illuminance(sensor::Sensor *illuminance) { this->illuminance_ = illuminance; }
protected:
binary_sensor::BinarySensor *light_{nullptr};
binary_sensor::BinarySensor *timeout_{nullptr};
sensor::Sensor *idle_time_{nullptr};
// sensor::Sensor *illuminance_{nullptr};
bool process_object_(const miot::BLEObject &obj) override;
void process_idle_time_(const miot::BLEObject &obj);
void process_motion_with_light_event_(const miot::BLEObject &obj);
void process_timeout_(const miot::BLEObject &obj);
void process_light_intensity_(const miot::BLEObject &obj);
};
} // namespace miot_rtcgq02lm
} // namespace esphome