Files
esphome-lsm6ds/esphome/components/tt21100/binary_sensor/tt21100_button.cpp
T

26 lines
584 B
C++

#include "tt21100_button.h"
#include "esphome/core/log.h"
namespace esphome::tt21100 {
static const char *const TAG = "tt21100.binary_sensor";
void TT21100Button::setup() {
this->parent_->register_button_listener(this);
this->publish_initial_state(false);
}
void TT21100Button::dump_config() {
LOG_BINARY_SENSOR("", "TT21100 Button", this);
ESP_LOGCONFIG(TAG, " Index: %u", this->index_);
}
void TT21100Button::update_button(uint8_t index, uint16_t state) {
if (index != this->index_)
return;
this->publish_state(state > 0);
}
} // namespace esphome::tt21100