From 5c30c1b6916920a406157aeff74d9ad60b981850 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 13 Oct 2025 17:49:07 -1000 Subject: [PATCH] core.data --- esphome/components/wifi/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/esphome/components/wifi/__init__.py b/esphome/components/wifi/__init__.py index ae85e40357..ad5698519b 100644 --- a/esphome/components/wifi/__init__.py +++ b/esphome/components/wifi/__init__.py @@ -470,7 +470,7 @@ async def wifi_disable_to_code(config, action_id, template_arg, args): return cg.new_Pvariable(action_id, template_arg) -_FLAGS = {"keep_scan_results": False} +KEEP_SCAN_RESULTS_KEY = "wifi_keep_scan_results" def request_wifi_scan_results(): @@ -480,13 +480,13 @@ def request_wifi_scan_results(): call this function during their code generation. This prevents the WiFi component from freeing scan result memory after successful connection. """ - _FLAGS["keep_scan_results"] = True + CORE.data[KEEP_SCAN_RESULTS_KEY] = True @coroutine_with_priority(CoroPriority.FINAL) async def final_step(): """Final code generation step to configure scan result retention.""" - if _FLAGS["keep_scan_results"]: + if CORE.data.get(KEEP_SCAN_RESULTS_KEY, False): cg.add( cg.RawExpression("wifi::global_wifi_component->set_keep_scan_results(true)") )