From 2d77e8b35989fa2f55f224f2c829ddb9d4847a8b Mon Sep 17 00:00:00 2001 From: Dmitrii Amelin Date: Fri, 11 Sep 2026 19:20:35 +0200 Subject: [PATCH] fix: check dest_path when filtering watchdog reload events --- custom_components/pyscript/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/custom_components/pyscript/__init__.py b/custom_components/pyscript/__init__.py index be04076..590e3d0 100644 --- a/custom_components/pyscript/__init__.py +++ b/custom_components/pyscript/__init__.py @@ -217,8 +217,11 @@ def check_event(event: FileSystemEvent, do_reload: bool) -> bool: return do_reload return True # only reload if it's a script, yaml, or requirements.txt file + # also check dest_path: atomic saves (tempfile + os.replace) surface + # as a moved event whose src_path is an unrelated temp name + paths = (event.src_path, event.dest_path) for valid_suffix in [".py", ".yaml", "/" + REQUIREMENTS_FILE]: - if event.src_path.endswith(valid_suffix): + if any(path.endswith(valid_suffix) for path in paths): return True return do_reload