From 636ad1399f4e09d8465a0cac8693cf75907b519b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Guay-Lambert?= Date: Sat, 26 Oct 2024 18:28:55 -0400 Subject: [PATCH] Bind and set up reporting for Hue contact sensor (#238) Co-authored-by: TheJulianJES --- zha/zigbee/cluster_handlers/const.py | 1 + zha/zigbee/cluster_handlers/manufacturerspecific.py | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/zha/zigbee/cluster_handlers/const.py b/zha/zigbee/cluster_handlers/const.py index 74ed57088..6c6e746b8 100644 --- a/zha/zigbee/cluster_handlers/const.py +++ b/zha/zigbee/cluster_handlers/const.py @@ -81,6 +81,7 @@ IKEA_REMOTE_CLUSTER: Final[int] = 0xFC80 INOVELLI_CLUSTER: Final[int] = 0xFC31 OSRAM_BUTTON_CLUSTER: Final[int] = 0xFD00 +PHILIPS_CONTACT_CLUSTER: Final[int] = 0xFC06 PHILLIPS_REMOTE_CLUSTER: Final[int] = 0xFC00 SMARTTHINGS_ACCELERATION_CLUSTER: Final[int] = 0xFC02 SMARTTHINGS_HUMIDITY_CLUSTER: Final[int] = 0xFC45 diff --git a/zha/zigbee/cluster_handlers/manufacturerspecific.py b/zha/zigbee/cluster_handlers/manufacturerspecific.py index da6eb4be0..f9c54ea13 100644 --- a/zha/zigbee/cluster_handlers/manufacturerspecific.py +++ b/zha/zigbee/cluster_handlers/manufacturerspecific.py @@ -31,6 +31,7 @@ IKEA_REMOTE_CLUSTER, INOVELLI_CLUSTER, OSRAM_BUTTON_CLUSTER, + PHILIPS_CONTACT_CLUSTER, PHILLIPS_REMOTE_CLUSTER, REPORT_CONFIG_ASAP, REPORT_CONFIG_DEFAULT, @@ -78,6 +79,17 @@ class OsramButtonClusterHandler(ClusterHandler): REPORT_CONFIG = () +@registries.CLUSTER_HANDLER_ONLY_CLUSTERS.register(PHILIPS_CONTACT_CLUSTER) +@registries.CLUSTER_HANDLER_REGISTRY.register(PHILIPS_CONTACT_CLUSTER) +class PhillipsContactClusterHandler(ClusterHandler): + """Phillips contact cluster handler.""" + + REPORT_CONFIG = ( + AttrReportConfig(attr="contact", config=REPORT_CONFIG_IMMEDIATE), + AttrReportConfig(attr="tamper", config=REPORT_CONFIG_IMMEDIATE), + ) + + @registries.CLUSTER_HANDLER_ONLY_CLUSTERS.register(PHILLIPS_REMOTE_CLUSTER) @registries.CLUSTER_HANDLER_REGISTRY.register(PHILLIPS_REMOTE_CLUSTER) class PhillipsRemoteClusterHandler(ClusterHandler):