diff --git a/homeassistant/components/zha/core/registries.py b/homeassistant/components/zha/core/registries.py index 0c7369f15e7..03fdc7e37c1 100644 --- a/homeassistant/components/zha/core/registries.py +++ b/homeassistant/components/zha/core/registries.py @@ -244,7 +244,10 @@ class MatchRule: if callable(self.quirk_classes): matches.append(self.quirk_classes(quirk_class)) else: - matches.append(quirk_class in self.quirk_classes) + matches.append( + quirk_class.split(".")[-2:] + in [x.split(".")[-2:] for x in self.quirk_classes] + ) return matches diff --git a/tests/components/zha/test_registries.py b/tests/components/zha/test_registries.py index 057921f80a9..6f36ee624e9 100644 --- a/tests/components/zha/test_registries.py +++ b/tests/components/zha/test_registries.py @@ -18,7 +18,8 @@ if typing.TYPE_CHECKING: MANUFACTURER = "mock manufacturer" MODEL = "mock model" -QUIRK_CLASS = "mock.class" +QUIRK_CLASS = "mock.test.quirk.class" +QUIRK_CLASS_SHORT = "quirk.class" @pytest.fixture @@ -209,6 +210,12 @@ def cluster_handlers(cluster_handler): ), False, ), + ( + registries.MatchRule( + cluster_handler_names="on_off", quirk_classes=QUIRK_CLASS_SHORT + ), + True, + ), ], ) def test_registry_matching(rule, matched, cluster_handlers) -> None: