1
- """Xiaomi aqara single key wall switch devices."""
1
+ """Xiaomi Aqara wall switch devices. Also see switch_h1 files similar H1 rocker switches ."""
2
2
import copy
3
3
from enum import Enum
4
4
33
33
ENDPOINT_ID ,
34
34
ENDPOINTS ,
35
35
INPUT_CLUSTERS ,
36
+ MODELS_INFO ,
36
37
OUTPUT_CLUSTERS ,
37
38
PRESS_TYPE ,
38
39
PROFILE_ID ,
39
40
VALUE ,
40
41
ZHA_SEND_EVENT ,
41
42
)
42
43
from zhaquirks .xiaomi import (
44
+ LUMI ,
45
+ AnalogInputCluster ,
43
46
BasicCluster ,
44
47
DeviceTemperatureCluster ,
48
+ ElectricalMeasurementCluster ,
49
+ MeteringCluster ,
45
50
OnOffCluster ,
46
51
XiaomiCustomDevice ,
47
- XiaomiMeteringCluster ,
48
52
)
49
53
50
54
from .opple_remote import MultistateInputCluster , OppleCluster
@@ -85,7 +89,6 @@ class OppleSwitchCluster(OppleCluster):
85
89
"""Xiaomi mfg cluster implementation."""
86
90
87
91
attributes = copy .deepcopy (OppleCluster .attributes )
88
-
89
92
attributes .update (
90
93
{
91
94
0x0002 : ("power_outage_count" , t .uint8_t , True ),
@@ -124,28 +127,29 @@ class XiaomiOpple2ButtonSwitchBase(XiaomiCustomDevice):
124
127
DEVICE_TYPE : zha .DeviceType .ON_OFF_SWITCH ,
125
128
INPUT_CLUSTERS : [
126
129
BasicCluster ,
127
- DeviceTemperatureCluster , # 2
128
- Identify .cluster_id , # 3
129
- Groups .cluster_id , # 4
130
- Scenes .cluster_id , # 5
131
- OnOffCluster , # 6
132
- Alarms .cluster_id , # 9
133
- MultistateInputCluster , # 18
134
- XiaomiMeteringCluster , # 0x0702
135
- OppleSwitchCluster , # 0xFCC0 / 64704
130
+ DeviceTemperatureCluster ,
131
+ Identify .cluster_id ,
132
+ Groups .cluster_id ,
133
+ Scenes .cluster_id ,
134
+ OnOffCluster ,
135
+ Alarms .cluster_id ,
136
+ MultistateInputCluster ,
137
+ MeteringCluster ,
138
+ ElectricalMeasurementCluster ,
139
+ OppleSwitchCluster ,
136
140
],
137
141
OUTPUT_CLUSTERS : [Time .cluster_id , Ota .cluster_id ],
138
142
},
139
143
2 : {
140
144
DEVICE_TYPE : zha .DeviceType .ON_OFF_SWITCH ,
141
145
INPUT_CLUSTERS : [
142
146
BasicCluster ,
143
- Identify .cluster_id , # 3
144
- Groups .cluster_id , # 4
145
- Scenes .cluster_id , # 5
146
- OnOffCluster , # 6
147
- MultistateInputCluster , # 18
148
- OppleSwitchCluster , # 0xFCC0 / 64704
147
+ Identify .cluster_id ,
148
+ Groups .cluster_id ,
149
+ Scenes .cluster_id ,
150
+ OnOffCluster ,
151
+ MultistateInputCluster ,
152
+ OppleSwitchCluster ,
149
153
],
150
154
OUTPUT_CLUSTERS : [],
151
155
},
@@ -154,7 +158,7 @@ class XiaomiOpple2ButtonSwitchBase(XiaomiCustomDevice):
154
158
PROFILE_ID : zha .PROFILE_ID ,
155
159
DEVICE_TYPE : zha .DeviceType .ON_OFF_LIGHT ,
156
160
INPUT_CLUSTERS : [
157
- AnalogInput . cluster_id , # 12
161
+ AnalogInputCluster ,
158
162
],
159
163
OUTPUT_CLUSTERS : [],
160
164
},
@@ -163,7 +167,7 @@ class XiaomiOpple2ButtonSwitchBase(XiaomiCustomDevice):
163
167
PROFILE_ID : zha .PROFILE_ID ,
164
168
DEVICE_TYPE : zha .DeviceType .ON_OFF_LIGHT ,
165
169
INPUT_CLUSTERS : [
166
- AnalogInput .cluster_id , # 12
170
+ AnalogInput .cluster_id ,
167
171
],
168
172
OUTPUT_CLUSTERS : [],
169
173
},
@@ -172,7 +176,7 @@ class XiaomiOpple2ButtonSwitchBase(XiaomiCustomDevice):
172
176
PROFILE_ID : zha .PROFILE_ID ,
173
177
DEVICE_TYPE : zha .DeviceType .ON_OFF_LIGHT ,
174
178
INPUT_CLUSTERS : [
175
- MultistateInputCluster , # 18
179
+ MultistateInputCluster ,
176
180
],
177
181
OUTPUT_CLUSTERS : [],
178
182
},
@@ -181,7 +185,7 @@ class XiaomiOpple2ButtonSwitchBase(XiaomiCustomDevice):
181
185
PROFILE_ID : zha .PROFILE_ID ,
182
186
DEVICE_TYPE : zha .DeviceType .ON_OFF_LIGHT ,
183
187
INPUT_CLUSTERS : [
184
- MultistateInputCluster , # 18
188
+ MultistateInputCluster ,
185
189
],
186
190
OUTPUT_CLUSTERS : [],
187
191
},
@@ -190,7 +194,7 @@ class XiaomiOpple2ButtonSwitchBase(XiaomiCustomDevice):
190
194
PROFILE_ID : zha .PROFILE_ID ,
191
195
DEVICE_TYPE : zha .DeviceType .ON_OFF_LIGHT ,
192
196
INPUT_CLUSTERS : [
193
- MultistateInputCluster , # 18
197
+ MultistateInputCluster ,
194
198
],
195
199
OUTPUT_CLUSTERS : [],
196
200
},
@@ -199,7 +203,7 @@ class XiaomiOpple2ButtonSwitchBase(XiaomiCustomDevice):
199
203
PROFILE_ID : zha .PROFILE_ID ,
200
204
DEVICE_TYPE : zha .DeviceType .ON_OFF_LIGHT ,
201
205
INPUT_CLUSTERS : [
202
- MultistateInputCluster , # 18
206
+ MultistateInputCluster ,
203
207
],
204
208
OUTPUT_CLUSTERS : [],
205
209
},
@@ -273,23 +277,22 @@ class XiaomiOpple2ButtonSwitchBase(XiaomiCustomDevice):
273
277
class XiaomiOpple2ButtonSwitchFace1 (XiaomiOpple2ButtonSwitchBase ):
274
278
"""Xiaomi Opple 2 Button Switch. Face 1."""
275
279
276
- device_automation_triggers = XiaomiOpple2ButtonSwitchBase .device_automation_triggers
277
-
278
280
signature = {
281
+ MODELS_INFO : [(LUMI , "lumi.switch.b2naus01" )],
279
282
ENDPOINTS : {
280
283
# input_clusters=[0, 2, 3, 4, 5, 6, 18, 64704], output_clusters=[10, 25]
281
284
1 : {
282
285
PROFILE_ID : zha .PROFILE_ID ,
283
286
DEVICE_TYPE : zha .DeviceType .ON_OFF_LIGHT ,
284
287
INPUT_CLUSTERS : [
285
- Basic .cluster_id , # 0
286
- DeviceTemperatureCluster .cluster_id , # 2
287
- Identify .cluster_id , # 3
288
- Groups .cluster_id , # 4
289
- Scenes .cluster_id , # 5
290
- OnOff .cluster_id , # 6
291
- MultistateInputCluster .cluster_id , # 18
292
- OppleSwitchCluster .cluster_id , # 0xFCC0 / 64704
288
+ Basic .cluster_id ,
289
+ DeviceTemperatureCluster .cluster_id ,
290
+ Identify .cluster_id ,
291
+ Groups .cluster_id ,
292
+ Scenes .cluster_id ,
293
+ OnOff .cluster_id ,
294
+ MultistateInputCluster .cluster_id ,
295
+ OppleSwitchCluster .cluster_id ,
293
296
],
294
297
OUTPUT_CLUSTERS : [Time .cluster_id , Ota .cluster_id ],
295
298
},
@@ -298,13 +301,13 @@ class XiaomiOpple2ButtonSwitchFace1(XiaomiOpple2ButtonSwitchBase):
298
301
PROFILE_ID : zha .PROFILE_ID ,
299
302
DEVICE_TYPE : zha .DeviceType .ON_OFF_LIGHT ,
300
303
INPUT_CLUSTERS : [
301
- Basic .cluster_id , # 0
302
- Identify .cluster_id , # 3
303
- Groups .cluster_id , # 4
304
- Scenes .cluster_id , # 5
305
- OnOff .cluster_id , # 6
306
- MultistateInputCluster .cluster_id , # 18
307
- OppleSwitchCluster .cluster_id , # 0xFCC0 / 64704
304
+ Basic .cluster_id ,
305
+ Identify .cluster_id ,
306
+ Groups .cluster_id ,
307
+ Scenes .cluster_id ,
308
+ OnOff .cluster_id ,
309
+ MultistateInputCluster .cluster_id ,
310
+ OppleSwitchCluster .cluster_id ,
308
311
],
309
312
OUTPUT_CLUSTERS : [],
310
313
},
@@ -313,7 +316,7 @@ class XiaomiOpple2ButtonSwitchFace1(XiaomiOpple2ButtonSwitchBase):
313
316
PROFILE_ID : zha .PROFILE_ID ,
314
317
DEVICE_TYPE : zha .DeviceType .ON_OFF_LIGHT ,
315
318
INPUT_CLUSTERS : [
316
- AnalogInput .cluster_id , # 12
319
+ AnalogInput .cluster_id ,
317
320
],
318
321
OUTPUT_CLUSTERS : [],
319
322
},
@@ -322,7 +325,7 @@ class XiaomiOpple2ButtonSwitchFace1(XiaomiOpple2ButtonSwitchBase):
322
325
PROFILE_ID : zha .PROFILE_ID ,
323
326
DEVICE_TYPE : zha .DeviceType .ON_OFF_LIGHT ,
324
327
INPUT_CLUSTERS : [
325
- AnalogInput .cluster_id , # 12
328
+ AnalogInput .cluster_id ,
326
329
],
327
330
OUTPUT_CLUSTERS : [],
328
331
},
@@ -331,7 +334,7 @@ class XiaomiOpple2ButtonSwitchFace1(XiaomiOpple2ButtonSwitchBase):
331
334
PROFILE_ID : zha .PROFILE_ID ,
332
335
DEVICE_TYPE : zha .DeviceType .ON_OFF_LIGHT ,
333
336
INPUT_CLUSTERS : [
334
- MultistateInputCluster .cluster_id , # 18
337
+ MultistateInputCluster .cluster_id ,
335
338
],
336
339
OUTPUT_CLUSTERS : [],
337
340
},
@@ -340,7 +343,7 @@ class XiaomiOpple2ButtonSwitchFace1(XiaomiOpple2ButtonSwitchBase):
340
343
PROFILE_ID : zha .PROFILE_ID ,
341
344
DEVICE_TYPE : zha .DeviceType .ON_OFF_LIGHT ,
342
345
INPUT_CLUSTERS : [
343
- MultistateInputCluster .cluster_id , # 18
346
+ MultistateInputCluster .cluster_id ,
344
347
],
345
348
OUTPUT_CLUSTERS : [],
346
349
},
@@ -349,54 +352,7 @@ class XiaomiOpple2ButtonSwitchFace1(XiaomiOpple2ButtonSwitchBase):
349
352
PROFILE_ID : zha .PROFILE_ID ,
350
353
DEVICE_TYPE : zha .DeviceType .ON_OFF_LIGHT ,
351
354
INPUT_CLUSTERS : [
352
- MultistateInputCluster .cluster_id , # 18
353
- ],
354
- OUTPUT_CLUSTERS : [],
355
- },
356
- 242 : {
357
- PROFILE_ID : zgp .PROFILE_ID ,
358
- DEVICE_TYPE : zgp .DeviceType .PROXY_BASIC ,
359
- INPUT_CLUSTERS : [],
360
- OUTPUT_CLUSTERS : [GreenPowerProxy .cluster_id ],
361
- },
362
- },
363
- }
364
-
365
-
366
- class XiaomiOpple2ButtonSwitchFace2 (XiaomiOpple2ButtonSwitchBase ):
367
- """Xiaomi Opple 2 Button Switch. Face 2."""
368
-
369
- device_automation_triggers = XiaomiOpple2ButtonSwitchBase .device_automation_triggers
370
-
371
- signature = {
372
- ENDPOINTS : {
373
- # input_clusters=[0, 2, 3, 4, 5, 6, 18, 64704], output_clusters=[10, 25]
374
- 1 : {
375
- PROFILE_ID : zha .PROFILE_ID ,
376
- DEVICE_TYPE : zha .DeviceType .ON_OFF_LIGHT ,
377
- INPUT_CLUSTERS : [
378
- Basic .cluster_id , # 0
379
- DeviceTemperatureCluster .cluster_id , # 2
380
- Identify .cluster_id , # 3
381
- Groups .cluster_id , # 4
382
- Scenes .cluster_id , # 5
383
- OnOff .cluster_id , # 6
384
- Alarms .cluster_id , # 9
385
- XiaomiMeteringCluster .cluster_id , # 0x0702
386
- 0x0B04 ,
387
- ],
388
- OUTPUT_CLUSTERS : [Time .cluster_id , Ota .cluster_id ],
389
- },
390
- # input_clusters=[0, 3, 4, 5, 6, 18, 64704], output_clusters=[]
391
- 2 : {
392
- PROFILE_ID : zha .PROFILE_ID ,
393
- DEVICE_TYPE : zha .DeviceType .ON_OFF_LIGHT ,
394
- INPUT_CLUSTERS : [
395
- Basic .cluster_id , # 0
396
- Identify .cluster_id , # 3
397
- Groups .cluster_id , # 4
398
- Scenes .cluster_id , # 5
399
- OnOff .cluster_id , # 6
355
+ MultistateInputCluster .cluster_id ,
400
356
],
401
357
OUTPUT_CLUSTERS : [],
402
358
},
0 commit comments