Skip to content

Commit b7f2bc7

Browse files
Add tamper sensor to Tuya smoke detector (#3726)
Co-authored-by: TheJulianJES <[email protected]>
1 parent b20b82b commit b7f2bc7

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

tests/test_tuya_smoke.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,19 @@
1616
[
1717
("_TZE200_dq1mfjug", "TS0601", []),
1818
("_TZE200_m9skfctm", "TS0601", []),
19-
("_TZE200_ntcy3xu1", "TS0601", []),
2019
("_TZE200_rccxox8p", "TS0601", []),
2120
("_TZE284_rccxox8p", "TS0601", []),
2221
("_TZE200_vzekyi4c", "TS0601", []),
2322
("_TZE204_vawy74yh", "TS0601", []),
23+
(
24+
"_TZE200_ntcy3xu1",
25+
"TS0601",
26+
(
27+
(b"\x09\x3a\x02\x00\x12\x0e\x04\x00\x01\x02", 200),
28+
(b"\x09\x3a\x02\x00\x12\x0e\x04\x00\x01\x01", 80),
29+
(b"\x09\x3a\x02\x00\x12\x0e\x04\x00\x01\x00", 10),
30+
),
31+
),
2432
(
2533
"_TZE204_ntcy3xu1",
2634
"TS0601",

zhaquirks/tuya/tuya_smoke.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Smoke Sensor."""
22

3-
from zigpy.quirks.v2 import QuirkBuilder
3+
from zigpy.quirks.v2 import EntityType, QuirkBuilder
4+
from zigpy.quirks.v2.homeassistant.binary_sensor import BinarySensorDeviceClass
45
import zigpy.types as t
56
from zigpy.zcl.clusters.general import OnOff, Time
67
from zigpy.zcl.clusters.lightlink import LightLink
@@ -55,7 +56,6 @@ def _update_attribute(self, attrid, value):
5556
TuyaQuirkBuilder("_TZE200_aycxwiau", "TS0601")
5657
.applies_to("_TZE200_dq1mfjug", "TS0601")
5758
.applies_to("_TZE200_m9skfctm", "TS0601")
58-
.applies_to("_TZE200_ntcy3xu1", "TS0601")
5959
.applies_to("_TZE200_rccxox8p", "TS0601")
6060
.applies_to("_TZE284_rccxox8p", "TS0601")
6161
.applies_to("_TZE200_vzekyi4c", "TS0601")
@@ -68,7 +68,15 @@ def _update_attribute(self, attrid, value):
6868

6969
(
7070
TuyaQuirkBuilder("_TZE204_ntcy3xu1", "TS0601")
71+
.applies_to("_TZE200_ntcy3xu1", "TS0601")
7172
.tuya_smoke(dp_id=1)
73+
.tuya_binary_sensor(
74+
dp_id=4,
75+
attribute_name="tamper",
76+
device_class=BinarySensorDeviceClass.TAMPER,
77+
entity_type=EntityType.DIAGNOSTIC,
78+
fallback_name="Tamper",
79+
)
7280
.tuya_dp(
7381
dp_id=14,
7482
ep_attribute=TuyaPowerConfigurationCluster2AAA.ep_attribute,

0 commit comments

Comments
 (0)