Skip to content

Commit 0b19318

Browse files
authored
Add Sonoff SNZB-06P presence sensor support (#2895)
1 parent 729bffd commit 0b19318

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

zhaquirks/sonoff/snzb06p.py

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
from zigpy.profiles import zha
2+
from zigpy.quirks import CustomCluster, CustomDevice
3+
import zigpy.types as t
4+
from zigpy.zcl.clusters.general import Basic, Identify, Ota
5+
from zigpy.zcl.clusters.measurement import OccupancySensing
6+
from zigpy.zcl.clusters.security import IasZone
7+
8+
from zhaquirks.const import (
9+
DEVICE_TYPE,
10+
ENDPOINTS,
11+
INPUT_CLUSTERS,
12+
MODELS_INFO,
13+
OUTPUT_CLUSTERS,
14+
PROFILE_ID,
15+
)
16+
17+
SONOFF_CLUSTER_FC11_ID = 0xFC11
18+
SONOFF_CLUSTER_FC57_ID = 0xFC57
19+
ATTR_SONOFF_ILLUMINATION_STATUS = 0x2001
20+
21+
22+
class IlluminationStatus(t.enum8):
23+
"""Last measureed state of illumination enum."""
24+
25+
Dark = 0x00
26+
Light = 0x01
27+
28+
29+
class SonoffFC11Cluster(CustomCluster):
30+
"""Sonoff manufacture specific cluster that provides illuminance."""
31+
32+
cluster_id = SONOFF_CLUSTER_FC11_ID
33+
ep_attribute = "sonoff_manufacturer"
34+
attributes = {
35+
ATTR_SONOFF_ILLUMINATION_STATUS: ("last_illumination_state", IlluminationStatus)
36+
}
37+
38+
39+
class SonoffPresenceSenorSNZB06P(CustomDevice):
40+
"""Sonoff human presence senor - model SNZB-06P."""
41+
42+
signature = {
43+
# <SimpleDescriptor endpoint=1, profile=260, device_type=263
44+
# device_version=1
45+
# input_clusters=[0, 3, 1030, 1280, 64599, 64529]
46+
# output_clusters=[3, 25]>
47+
MODELS_INFO: [
48+
("SONOFF", "SNZB-06P"),
49+
],
50+
ENDPOINTS: {
51+
1: {
52+
PROFILE_ID: zha.PROFILE_ID,
53+
DEVICE_TYPE: zha.DeviceType.OCCUPANCY_SENSOR,
54+
INPUT_CLUSTERS: [
55+
Basic.cluster_id,
56+
Identify.cluster_id,
57+
OccupancySensing.cluster_id,
58+
IasZone.cluster_id,
59+
SONOFF_CLUSTER_FC11_ID,
60+
SONOFF_CLUSTER_FC57_ID,
61+
],
62+
OUTPUT_CLUSTERS: [
63+
Identify.cluster_id,
64+
Ota.cluster_id,
65+
],
66+
},
67+
},
68+
}
69+
replacement = {
70+
ENDPOINTS: {
71+
1: {
72+
PROFILE_ID: zha.PROFILE_ID,
73+
DEVICE_TYPE: zha.DeviceType.OCCUPANCY_SENSOR,
74+
INPUT_CLUSTERS: [
75+
Basic.cluster_id,
76+
Identify.cluster_id,
77+
OccupancySensing.cluster_id,
78+
SonoffFC11Cluster,
79+
SONOFF_CLUSTER_FC57_ID,
80+
],
81+
OUTPUT_CLUSTERS: [
82+
Identify.cluster_id,
83+
Ota.cluster_id,
84+
],
85+
},
86+
},
87+
}

0 commit comments

Comments
 (0)