Skip to content

Commit

Permalink
Ensure switches exist before publishing state
Browse files Browse the repository at this point in the history
  • Loading branch information
mill1000 committed Nov 7, 2023
1 parent 622a9a3 commit f3d3781
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions components/winix_c545/winix_c545.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit f3d3781

Please sign in to comment.