Skip to content

Commit 538d346

Browse files
authored
Replace NodOn SIN-4-2-20 quirk with v2 quirk (#3552)
1 parent a5a00d9 commit 538d346

File tree

1 file changed

+10
-130
lines changed

1 file changed

+10
-130
lines changed

zhaquirks/nodon/switch.py

Lines changed: 10 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -1,134 +1,14 @@
11
"""NodOn on/off switch two channels."""
22

3-
from zigpy.profiles import zgp, zha
4-
from zigpy.quirks import CustomDevice
5-
from zigpy.zcl.clusters.general import (
6-
Basic,
7-
GreenPowerProxy,
8-
Groups,
9-
Identify,
10-
LevelControl,
11-
OnOff,
12-
OnOffConfiguration,
13-
Ota,
14-
Scenes,
15-
)
16-
from zigpy.zcl.clusters.lightlink import LightLink
17-
18-
from zhaquirks.const import (
19-
DEVICE_TYPE,
20-
ENDPOINTS,
21-
INPUT_CLUSTERS,
22-
MODELS_INFO,
23-
OUTPUT_CLUSTERS,
24-
PROFILE_ID,
25-
)
3+
from zigpy.quirks.v2 import QuirkBuilder
4+
from zigpy.zcl.clusters.general import LevelControl
265

27-
WWAH_CLUSTER_ID = 0xFC57
6+
NODON = "NodOn"
287

29-
30-
class NodOnSIN4220(CustomDevice):
31-
"""NodOn on/off switch two channels."""
32-
33-
signature = {
34-
MODELS_INFO: [("NodOn", "SIN-4-2-20")],
35-
ENDPOINTS: {
36-
# <SimpleDescriptor endpoint=1 profile=260 device_type=256
37-
# input_clusters=[0, 3, 4, 5, 6, 7, 8, 4096, 64599]
38-
# output_clusters=[3, 6, 25]>
39-
1: {
40-
PROFILE_ID: zha.PROFILE_ID,
41-
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT,
42-
INPUT_CLUSTERS: [
43-
Basic.cluster_id,
44-
Identify.cluster_id,
45-
Groups.cluster_id,
46-
Scenes.cluster_id,
47-
OnOff.cluster_id,
48-
OnOffConfiguration.cluster_id,
49-
LevelControl.cluster_id,
50-
LightLink.cluster_id,
51-
WWAH_CLUSTER_ID,
52-
],
53-
OUTPUT_CLUSTERS: [
54-
Identify.cluster_id,
55-
OnOff.cluster_id,
56-
Ota.cluster_id,
57-
],
58-
},
59-
# <SimpleDescriptor endpoint=1 profile=260 device_type=256
60-
# input_clusters=[0, 3, 4, 5, 6, 7, 8]
61-
# output_clusters=[3, 6]>
62-
2: {
63-
PROFILE_ID: zha.PROFILE_ID,
64-
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT,
65-
INPUT_CLUSTERS: [
66-
Basic.cluster_id,
67-
Identify.cluster_id,
68-
Groups.cluster_id,
69-
Scenes.cluster_id,
70-
OnOff.cluster_id,
71-
OnOffConfiguration.cluster_id,
72-
LevelControl.cluster_id,
73-
],
74-
OUTPUT_CLUSTERS: [
75-
Identify.cluster_id,
76-
OnOff.cluster_id,
77-
],
78-
},
79-
# <SimpleDescriptor endpoint=242 profile=41440 device_type=102
80-
# input_clusters=[33]
81-
# output_clusters=[33]
82-
242: {
83-
PROFILE_ID: zgp.PROFILE_ID,
84-
DEVICE_TYPE: zgp.DeviceType.COMBO_BASIC,
85-
INPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
86-
OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
87-
},
88-
},
89-
}
90-
replacement = {
91-
ENDPOINTS: {
92-
1: {
93-
PROFILE_ID: zha.PROFILE_ID,
94-
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT,
95-
INPUT_CLUSTERS: [
96-
Basic.cluster_id,
97-
Identify.cluster_id,
98-
Groups.cluster_id,
99-
Scenes.cluster_id,
100-
OnOff.cluster_id,
101-
OnOffConfiguration.cluster_id,
102-
LightLink.cluster_id,
103-
WWAH_CLUSTER_ID,
104-
],
105-
OUTPUT_CLUSTERS: [
106-
Identify.cluster_id,
107-
OnOff.cluster_id,
108-
Ota.cluster_id,
109-
],
110-
},
111-
2: {
112-
PROFILE_ID: zha.PROFILE_ID,
113-
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT,
114-
INPUT_CLUSTERS: [
115-
Basic.cluster_id,
116-
Identify.cluster_id,
117-
Groups.cluster_id,
118-
Scenes.cluster_id,
119-
OnOff.cluster_id,
120-
OnOffConfiguration.cluster_id,
121-
],
122-
OUTPUT_CLUSTERS: [
123-
Identify.cluster_id,
124-
OnOff.cluster_id,
125-
],
126-
},
127-
242: {
128-
PROFILE_ID: zgp.PROFILE_ID,
129-
DEVICE_TYPE: zgp.DeviceType.COMBO_BASIC,
130-
INPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
131-
OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
132-
},
133-
},
134-
}
8+
(
9+
# this quirk is a v2 version of 7397b6a
10+
QuirkBuilder(NODON, "SIN-4-2-20")
11+
.removes(cluster_id=LevelControl.cluster_id, endpoint_id=1)
12+
.removes(cluster_id=LevelControl.cluster_id, endpoint_id=2)
13+
.add_to_registry()
14+
)

0 commit comments

Comments
 (0)