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

28 lines
780 B
C++
Raw Normal View History

2023-06-07 23:44:58 +00:00
#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()
{
2023-06-07 23:46:24 +00:00
LOG_BUTTON("", "RATGDO Button", this);
2023-06-07 23:59:49 +00:00
ESP_LOGCONFIG(TAG, " Type: %s", this->button_type_ == ButtonType::RATGDO_SYNC ? "Sync" : "Query");
2023-06-07 23:44:58 +00:00
}
2023-06-07 23:46:13 +00:00
void RATGDOButton::press_action()
2023-06-07 23:44:58 +00:00
{
ESP_LOGD(TAG, "name: %s this->type_:%d", this->get_name(), this->button_type_);
2023-06-07 23:59:49 +00:00
if (this->button_type_ == ButtonType::RATGDO_SYNC) {
this->parent_->sync();
} else if (this->button_type_ == ButtonType::RATGDO_QUERY) {
this->parent_->query();
}
2023-06-07 23:44:58 +00:00
}
} // namespace ratgdo
} // namespace esphome