From 5c4e08d94091a4c5f37cea7b21fd918474e98f82 Mon Sep 17 00:00:00 2001 From: puddly <32534428+puddly@users.noreply.github.com> Date: Wed, 28 Aug 2024 11:16:16 -0400 Subject: [PATCH] Purge quirks on reload (#3328) --- zhaquirks/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zhaquirks/__init__.py b/zhaquirks/__init__.py index 3aca7f8f58..fd419f7893 100644 --- a/zhaquirks/__init__.py +++ b/zhaquirks/__init__.py @@ -13,7 +13,7 @@ import zigpy.device import zigpy.endpoint -from zigpy.quirks import CustomCluster, CustomDevice +from zigpy.quirks import DEVICE_REGISTRY, CustomCluster, CustomDevice import zigpy.types as t from zigpy.util import ListenableMixin from zigpy.zcl import foundation @@ -432,6 +432,9 @@ async def command(self, command, *args, expect_reply=None, **kwargs): def setup(custom_quirks_path: str | None = None) -> None: """Register all quirks with zigpy, including optional custom quirks.""" + if custom_quirks_path is not None: + DEVICE_REGISTRY.purge_custom_quirks(custom_quirks_path) + # Import all quirks in the `zhaquirks` package first for _importer, modname, _ispkg in pkgutil.walk_packages( path=__path__,