From 42b6939e90fafcd3cc23792e914aad6907a5bf05 Mon Sep 17 00:00:00 2001 From: skyegecko Date: Tue, 15 Jul 2025 04:15:47 +0200 Subject: [PATCH] [fan] Do not save state for fan if configured as NO_RESTORE (#9472) --- esphome/components/fan/fan.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/esphome/components/fan/fan.cpp b/esphome/components/fan/fan.cpp index 25f710f893..82fc5319e0 100644 --- a/esphome/components/fan/fan.cpp +++ b/esphome/components/fan/fan.cpp @@ -177,6 +177,10 @@ optional Fan::restore_state_() { return {}; } void Fan::save_state_() { + if (this->restore_mode_ == FanRestoreMode::NO_RESTORE) { + return; + } + FanRestoreState state{}; state.state = this->state; state.oscillating = this->oscillating;