From 96248f940c1a69a878dc0bbdeb06ba12ae832e47 Mon Sep 17 00:00:00 2001 From: TheJulianJES Date: Fri, 27 Feb 2026 08:52:37 +0100 Subject: [PATCH] Disable device availability checker during diagnostics regeneration --- tools/regenerate_diagnostics.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/regenerate_diagnostics.py b/tools/regenerate_diagnostics.py index cc49816ea..413aae4bc 100644 --- a/tools/regenerate_diagnostics.py +++ b/tools/regenerate_diagnostics.py @@ -38,6 +38,12 @@ async def main(files: list[str] | None = None) -> None: paths = [pathlib.Path(f) for f in files] async with create_zha_gateway() as zha_gateway: + # Regeneration should be deterministic: disable background tasks that can + # asynchronously mutate device availability while fixtures are being written. + zha_gateway.global_updater.stop() + zha_gateway._device_availability_checker.stop() # noqa: SLF001 + zha_gateway.config.allow_polling = False + for device_json in paths: _LOGGER.info("Migrating %s", device_json) zigpy_device = await zigpy_device_from_json(