ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
xiaomi_mjyd02yla.cpp
Go to the documentation of this file.
1#include "xiaomi_mjyd02yla.h"
2#include "esphome/core/log.h"
3
5
6ESPHOME_LOG_TAG(TAG, "xiaomi_mjyd02yla");
7
9 ESP_LOGCONFIG(TAG, "Xiaomi MJYD02YL-A");
10 this->dump_bindkey_(TAG);
11 LOG_BINARY_SENSOR(" ", "Motion", this);
12 LOG_BINARY_SENSOR(" ", "Light", this->light_binary_sensor_);
13 LOG_SENSOR(" ", "Idle Time", this->idle_time_sensor_);
14 LOG_SENSOR(" ", "Battery Level", this->battery_level_sensor_);
15 LOG_SENSOR(" ", "Illuminance", this->illuminance_sensor_);
16}
17
19 publish_optional(this->idle_time_sensor_, res.idle_time);
20 publish_optional(this->battery_level_sensor_, res.battery_level);
21 publish_optional(this->illuminance_sensor_, res.illuminance);
22 publish_optional(this->light_binary_sensor_, res.is_light);
23 if (res.has_motion.has_value())
24 this->publish_state(*res.has_motion);
25}
26
27} // namespace esphome::xiaomi_mjyd02yla
virtual void dump_config()
void publish_state(bool new_state)
Publish a new state to the front-end.
void dump_bindkey_(const char *tag) const
void publish_result(const xiaomi_ble::XiaomiParseResult &res) override
ESPHOME_LOG_TAG(TAG, "xiaomi_mjyd02yla")
void publish_optional(E *entity, const optional< V > &value)
Publish value to entity when the entity is configured and the value is set.