esphome-ratgdo/components/ratgdo/button/ratgdo_button.cpp

27 lines
692 B
C++

#include "ratgdo_button.h"
#include "../ratgdo_state.h"
#include "esphome/core/log.h"
namespace esphome {
namespace ratgdo {
static const char* const TAG = "ratgdo.button";
void RATGDOButton::dump_config()
{
LOG_BUTTON("", "RATGDO Button", this);
ESP_LOGCONFIG(TAG, " Type: %s", this->button_type_ == ButtonType::RATGDO_SYNC ? "Sync" : "Query");
}
void RATGDOButton::press_action()
{
if (this->button_type_ == ButtonType::RATGDO_SYNC) {
this->parent_->sync();
} else if (this->button_type_ == ButtonType::RATGDO_QUERY) {
this->parent_->query();
}
}
} // namespace ratgdo
} // namespace esphome