ESPHome  2022.5.1
pipsolar_switch.cpp
Go to the documentation of this file.
1 #include "pipsolar_switch.h"
2 #include "esphome/core/log.h"
4 
5 namespace esphome {
6 namespace pipsolar {
7 
8 static const char *const TAG = "pipsolar.switch";
9 
10 void PipsolarSwitch::dump_config() { LOG_SWITCH("", "Pipsolar Switch", this); }
12  if (state) {
13  if (this->on_command_.length() > 0) {
14  this->parent_->switch_command(this->on_command_);
15  }
16  } else {
17  if (this->off_command_.length() > 0) {
18  this->parent_->switch_command(this->off_command_);
19  }
20  }
21 }
22 
23 } // namespace pipsolar
24 } // namespace esphome
Definition: a4988.cpp:4
void write_state(bool state) override
bool state
The current reported state of the binary sensor.
Definition: switch.h:48