-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
miot_sjws01lm.cpp
34 lines (27 loc) · 756 Bytes
/
miot_sjws01lm.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
31
32
33
34
#include "esphome/core/log.h"
#include "miot_sjws01lm.h"
namespace esphome {
namespace miot_sjws01lm {
static const char *const TAG = "miot_sjws01lm";
void MiotSJWS01LM::dump_config() {
this->dump_config_(TAG, "SJWS01LM");
LOG_BINARY_SENSOR(" ", "Flooding", this);
}
void MiotSJWS01LM::process_flooding_(const miot::BLEObject &obj) {
const auto flooding = obj.get_flooding();
if (flooding.has_value()) {
this->publish_state(*flooding);
}
}
bool MiotSJWS01LM::process_object_(const miot::BLEObject &obj) {
switch (obj.id) {
case miot::MIID_FLOODING:
this->process_flooding_(obj);
break;
default:
return this->process_default_(obj);
}
return true;
}
} // namespace miot_sjws01lm
} // namespace esphome