27 lines
707 B
C++
27 lines
707 B
C++
|
#include "tw7100_switch.h"
|
||
|
#include "esphome/core/log.h"
|
||
|
#include "esphome/core/defines.h"
|
||
|
#include "esphome/core/helpers.h"
|
||
|
|
||
|
namespace esphome {
|
||
|
namespace tw7100 {
|
||
|
|
||
|
void tw7100Switch::dump_config() {
|
||
|
static const char *const TAG = "dump_config()";
|
||
|
ESP_LOGCONFIG(TAG, "TW7100:");
|
||
|
LOG_SWITCH(TAG, "tw7100Switch", this);
|
||
|
publish_state(state);
|
||
|
}
|
||
|
|
||
|
void tw7100Switch::write_state(bool state) {
|
||
|
static const char *const TAG = "write_state()";
|
||
|
ESP_LOGV(TAG, "write switch state for cmd: %s", this->cmd_.c_str());
|
||
|
parent_->push_cmd("PWR?");
|
||
|
// TODO: actually send something!
|
||
|
// TODO: check response before publishing state
|
||
|
publish_state(state);
|
||
|
}
|
||
|
|
||
|
} // namespace tw7100
|
||
|
} // namespace esphome
|