ESPHome  2024.11.0
gt911_button.cpp
Go to the documentation of this file.
1 #include "gt911_button.h"
2 #include "esphome/core/log.h"
3 
4 namespace esphome {
5 namespace gt911 {
6 
7 static const char *const TAG = "GT911.binary_sensor";
8 
10  this->parent_->register_button_listener(this);
11  this->publish_initial_state(false);
12 }
13 
15  LOG_BINARY_SENSOR("", "GT911 Button", this);
16  ESP_LOGCONFIG(TAG, " Index: %u", this->index_);
17 }
18 
19 void GT911Button::update_button(uint8_t index, bool state) {
20  if (index != this->index_)
21  return;
22 
23  this->publish_state(state);
24 }
25 
26 } // namespace gt911
27 } // namespace esphome
void publish_initial_state(bool 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, bool state) override
bool state
The current reported state of the binary sensor.
Definition: binary_sensor.h:61
void publish_state(bool state)
Publish a new state to the front-end.
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7