-
-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathautomation.cpp
30 lines (28 loc) · 831 Bytes
/
automation.cpp
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
#include "esphome/core/log.h"
#include "automation.h"
namespace esphome {
namespace miot_ylyk01yl {
static const char *const TAG = "miot_ylyk01yl.automation";
bool MiotYLYK01YLTrigger::process_object_(const miot::BLEObject &obj) {
switch (obj.id) {
case miot::MIID_BUTTON_EVENT: {
const auto button_event = obj.get_typed<miot::ButtonEvent>();
if (button_event != nullptr) {
if (this->type_ == button_event->type && this->index_ == button_event->button.index) {
button_event->dump(TAG);
this->trigger();
return true;
}
}
return false;
}
case miot::MIID_PAIRING_EVENT:
// skip this event
return false;
default:
return this->process_unhandled_(obj);
}
return false;
}
} // namespace miot_ylyk01yl
} // namespace esphome