From 0f72491a784c664b9d50fa4016164b04bde1ab24 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 8 Apr 2026 09:31:59 -1000 Subject: [PATCH] Keep s_crash_data_valid after clearing magic Don't reset s_crash_data_valid in crash_handler_clear() so that additional API clients connecting during the same boot session can still receive the crash log. --- esphome/components/esp32/crash_handler.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/esphome/components/esp32/crash_handler.cpp b/esphome/components/esp32/crash_handler.cpp index 05be0e1408e..55cf92a703b 100644 --- a/esphome/components/esp32/crash_handler.cpp +++ b/esphome/components/esp32/crash_handler.cpp @@ -108,8 +108,10 @@ void crash_handler_read_and_clear() { bool crash_handler_has_data() { return s_crash_data_valid; } void crash_handler_clear() { + // Only clear the magic so data doesn't survive the next reboot. + // Keep s_crash_data_valid so crash_handler_log() still works for + // additional API clients connecting during this boot session. s_raw_crash_data.magic = 0; - s_crash_data_valid = false; } // Look up the exception cause as a human-readable string.