[pipsolar] Store command strings in flash

This commit is contained in:
J. Nick Koston
2026-01-17 14:17:15 -10:00
parent 48dc1331a4
commit 533d3e5184

View File

@@ -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);
}
}