From 0e7d4d8301e8b8529a6e539fd3d896d9c8ef002f Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 6 Mar 2026 22:04:43 -1000 Subject: [PATCH] Fix line callbacks not firing when no filter_lines set The line buffering and callback processing only ran when a filter pattern was configured. Enter the line processing branch whenever line_callbacks are registered too. --- esphome/util.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/esphome/util.py b/esphome/util.py index f9ef9bbbc3..066f6848ad 100644 --- a/esphome/util.py +++ b/esphome/util.py @@ -162,7 +162,7 @@ class RedirectText: if not isinstance(s, str): s = s.decode() - if self._filter_pattern is not None: + if self._filter_pattern is not None or self._line_callbacks: self._line_buffer += s lines = self._line_buffer.splitlines(True) for line in lines: @@ -174,7 +174,10 @@ class RedirectText: line_without_ansi = ANSI_ESCAPE.sub("", line) line_without_end = line_without_ansi.rstrip() - if self._filter_pattern.match(line_without_end) is not None: + if ( + self._filter_pattern is not None + and self._filter_pattern.match(line_without_end) is not None + ): # Filter pattern matched, ignore the line continue