-
-
Notifications
You must be signed in to change notification settings - Fork 24
/
miot_mjyd02yla.h
32 lines (23 loc) · 974 Bytes
/
miot_mjyd02yla.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
#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_mjyd02yla {
class MiotMJYD02YLA : public miot::MiotComponent, public binary_sensor::BinarySensor {
public:
MiotMJYD02YLA() { this->product_id_ = 0x07F6; }
void dump_config() override;
void set_light(binary_sensor::BinarySensor *light) { this->light_ = light; }
void set_idle_time(sensor::Sensor *idle_time) { this->idle_time_ = idle_time; }
protected:
binary_sensor::BinarySensor *light_{nullptr};
sensor::Sensor *idle_time_{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_illuminance_(const miot::BLEObject &obj);
};
} // namespace miot_mjyd02yla
} // namespace esphome