diff --git a/zhaquirks/philips/soc001.py b/zhaquirks/philips/soc001.py index 66ef3a1fa6..1a922dad14 100644 --- a/zhaquirks/philips/soc001.py +++ b/zhaquirks/philips/soc001.py @@ -2,10 +2,27 @@ from zigpy import types from zigpy.quirks import CustomCluster -from zigpy.quirks.v2 import BinarySensorDeviceClass, EntityType, QuirkBuilder +from zigpy.quirks.v2 import ( + BinarySensorDeviceClass, + ClusterType, + EntityType, + QuirkBuilder, +) +from zigpy.zcl.clusters.general import OnOff from zigpy.zcl.foundation import BaseAttributeDefs, ZCLAttributeDef +class PhilipsOnOffCluster(CustomCluster, OnOff): + """Philips OnOff cluster for contact sensor.""" + + """Prevents the creation of the on_off entity.""" + + cluster_id = 6 # 0x0006 + name = "Philips OnOff cluster" + ep_attribute = "philips_onoff_cluster" + SKIP_CONFIGURATION = True + + class PhilipsContactCluster(CustomCluster): """Philips manufacturer specific cluster for contact sensor.""" @@ -44,14 +61,26 @@ class AttributeDefs(BaseAttributeDefs): # input_clusters=[0, 1, 3, 64518] # output_clusters=[0, 3, 6, 25]> QuirkBuilder("Signify Netherlands B.V.", "SOC001") + .replaces( + PhilipsOnOffCluster, + cluster_type=ClusterType.Client, + endpoint_id=2, + ) .replaces(PhilipsContactCluster, endpoint_id=2) + .binary_sensor( + "contact", + PhilipsContactCluster.cluster_id, + endpoint_id=2, + device_class=BinarySensorDeviceClass.OPENING, + entity_type=EntityType.STANDARD, + fallback_name="Contact", + ) .binary_sensor( "tamper", PhilipsContactCluster.cluster_id, endpoint_id=2, device_class=BinarySensorDeviceClass.TAMPER, entity_type=EntityType.DIAGNOSTIC, - translation_key="tamper", fallback_name="Tamper", ) .add_to_registry()