ESPHome 2026.5.1
Loading...
Searching...
No Matches
tt21100_button.cpp
Go to the documentation of this file.
1#include "tt21100_button.h"
2#include "esphome/core/log.h"
3
4namespace esphome::tt21100 {
5
6static const char *const TAG = "tt21100.binary_sensor";
7
9 this->parent_->register_button_listener(this);
10 this->publish_initial_state(false);
11}
12
14 LOG_BINARY_SENSOR("", "TT21100 Button", this);
15 ESP_LOGCONFIG(TAG, " Index: %u", this->index_);
16}
17
18void TT21100Button::update_button(uint8_t index, uint16_t state) {
19 if (index != this->index_)
20 return;
21
22 this->publish_state(state > 0);
23}
24
25} // namespace esphome::tt21100
void publish_state(bool new_state)
Publish a new state to the front-end.
void publish_initial_state(bool new_state)
Publish the initial state, this will not make the callback manager send callbacks and is meant only f...
void update_button(uint8_t index, uint16_t state) override
bool state
Definition fan.h:2