Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Philips Hue contact sensor quirk #3432

Merged
merged 14 commits into from
Oct 20, 2024
Merged
58 changes: 58 additions & 0 deletions zhaquirks/philips/soc001.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
"""Signify SOC001 device."""

from zigpy import types
from zigpy.quirks import CustomCluster
from zigpy.quirks.v2 import BinarySensorDeviceClass, EntityType, QuirkBuilder
from zigpy.zcl.foundation import BaseAttributeDefs, ZCLAttributeDef


class PhilipsContactCluster(CustomCluster):
"""Philips manufacturer specific cluster for contact sensor."""

cluster_id = 64518 # 0xfc06
name = "Philips contact cluster"
ep_attribute = "philips_contact_cluster"

class AttributeDefs(BaseAttributeDefs):
"""Attribute definitions."""

contact = ZCLAttributeDef(
id=0x0100,
type=types.enum8,
is_manufacturer_specific=True,
)
last_contact_change = ZCLAttributeDef(
id=0x0101,
type=types.uint32_t,
is_manufacturer_specific=True,
)
tamper = ZCLAttributeDef(
id=0x0102,
type=types.enum8,
is_manufacturer_specific=True,
)
last_tamper_change = ZCLAttributeDef(
id=0x0103,
type=types.uint32_t,
is_manufacturer_specific=True,
)


(
# <SimpleDescriptor endpoint=2 profile=260 device_type=1026
# device_version=0
# input_clusters=[0, 1, 3, 64518]
# output_clusters=[0, 3, 6, 25]>
QuirkBuilder("Signify Netherlands B.V.", "SOC001")
.replaces(PhilipsContactCluster, endpoint_id=2)
.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()
)