From f3d37819a2e7264cb18842ec40cbe9508fdcaa9f Mon Sep 17 00:00:00 2001 From: Tucker Kern Date: Tue, 7 Nov 2023 12:26:09 -0700 Subject: [PATCH] Ensure switches exist before publishing state --- components/winix_c545/winix_c545.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/winix_c545/winix_c545.cpp b/components/winix_c545/winix_c545.cpp index 25026b0..5af2f5f 100644 --- a/components/winix_c545/winix_c545.cpp +++ b/components/winix_c545/winix_c545.cpp @@ -72,13 +72,13 @@ void WinixC545Component::update_state_(const WinixStateMap &states) { } else if (key == KEY_FILTER_AGE && this->filter_age_sensor_ != nullptr) { // Filter age this->filter_age_sensor_->publish_state(value); - } else if (key == KEY_PLASMAWAVE) { + } else if (key == KEY_PLASMAWAVE && this->plasmawave_switch_ != nullptr) { // Plasmawave this->plasmawave_switch_->publish_state(value == 1); - } else if (key == KEY_AUTO) { + } else if (key == KEY_AUTO && this->auto_switch_ != nullptr) { // Auto this->auto_switch_->publish_state(value == 1); - } else if (key == KEY_SPEED) { + } else if (key == KEY_SPEED && this->sleep_switch_ != nullptr) { // Sleep is a speed value this->sleep_switch_->publish_state(value == 6); }