From fe6f87718581a78f2608c0cd82e071e9b7a0fe94 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 22 Oct 2025 12:28:51 -1000 Subject: [PATCH] manual copy --- esphome/components/fan/automation.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/esphome/components/fan/automation.h b/esphome/components/fan/automation.h index 90661c307c5..cf043624772 100644 --- a/esphome/components/fan/automation.h +++ b/esphome/components/fan/automation.h @@ -58,10 +58,11 @@ template class CycleSpeedAction : public Action { void play(Ts... x) override { // check to see if fan supports speeds and is on - if (this->state_->get_traits().supported_speed_count()) { + auto traits = this->state_->get_traits(); + if (traits.supported_speed_count()) { if (this->state_->state) { int speed = this->state_->speed + 1; - int supported_speed_count = this->state_->get_traits().supported_speed_count(); + int supported_speed_count = traits.supported_speed_count(); bool off_speed_cycle = no_off_cycle_.value(x...); if (speed > supported_speed_count && off_speed_cycle) { // was running at max speed, off speed cycle enabled, so turn off