-
Notifications
You must be signed in to change notification settings - Fork 741
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Philips Hue contact sensor quirk (#3432)
Co-authored-by: TheJulianJES <TheJulianJES@users.noreply.github.com>
- Loading branch information
1 parent
9366c42
commit 8a68d5f
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
) |