Skip to content

Commit a522ab8

Browse files
authored
Enable tamper entities for Frient door/window sensors (#4246)
1 parent d5fc1c8 commit a522ab8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

zhaquirks/develco/open_close.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"""Door/Windows sensors."""
22

3-
from zigpy.quirks.v2 import QuirkBuilder
3+
from zigpy.quirks.v2 import BinarySensorDeviceClass, QuirkBuilder
44
from zigpy.zcl.clusters.general import BinaryInput
5+
from zigpy.zcl.clusters.security import IasZone
56

67
from zhaquirks import PowerConfigurationCluster
78

@@ -25,5 +26,14 @@ class DevelcoPowerConfiguration(PowerConfigurationCluster):
2526
.replaces(DevelcoPowerConfiguration, endpoint_id=35)
2627
# The binary input cluster is a duplicate
2728
.prevent_default_entity_creation(endpoint_id=35, cluster_id=BinaryInput.cluster_id)
29+
.binary_sensor(
30+
endpoint_id=35,
31+
cluster_id=IasZone.cluster_id,
32+
attribute_name=IasZone.AttributeDefs.zone_status.name,
33+
device_class=BinarySensorDeviceClass.TAMPER,
34+
attribute_converter=lambda value: bool(value & IasZone.ZoneStatus.Tamper),
35+
unique_id_suffix="tamper",
36+
fallback_name="Tamper",
37+
)
2838
.add_to_registry()
2939
)

0 commit comments

Comments
 (0)