From 533d3e518464fdcb23a20c61b594108709410e97 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 17 Jan 2026 14:17:15 -1000 Subject: [PATCH] [pipsolar] Store command strings in flash --- .../components/pipsolar/switch/pipsolar_switch.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/esphome/components/pipsolar/switch/pipsolar_switch.cpp b/esphome/components/pipsolar/switch/pipsolar_switch.cpp index 58dee852eb..512587511b 100644 --- a/esphome/components/pipsolar/switch/pipsolar_switch.cpp +++ b/esphome/components/pipsolar/switch/pipsolar_switch.cpp @@ -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); } }