mirror of
https://github.com/esphome/esphome.git
synced 2026-02-18 15:35:59 -07:00
[pipsolar] Store command strings in flash
This commit is contained in:
@@ -9,14 +9,9 @@ static const char *const TAG = "pipsolar.switch";
|
||||
|
||||
void PipsolarSwitch::dump_config() { LOG_SWITCH("", "Pipsolar Switch", this); }
|
||||
void PipsolarSwitch::write_state(bool state) {
|
||||
if (state) {
|
||||
if (this->on_command_ != nullptr) {
|
||||
this->parent_->queue_command(this->on_command_);
|
||||
}
|
||||
} else {
|
||||
if (this->off_command_ != nullptr) {
|
||||
this->parent_->queue_command(this->off_command_);
|
||||
}
|
||||
const char *command = state ? this->on_command_ : this->off_command_;
|
||||
if (command != nullptr) {
|
||||
this->parent_->queue_command(command);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user