1
1
"""Module for Schneider Electric devices quirks."""
2
2
import logging
3
+ from operator import is_
3
4
4
5
from zigpy .quirks import CustomCluster
5
6
import zigpy .types as t
6
7
from zigpy .zcl .clusters .closures import WindowCovering
7
8
from zigpy .zcl .clusters .general import Basic
8
9
from zigpy .zcl .clusters .homeautomation import Diagnostic
10
+ from zigpy .zcl .foundation import ZCLAttributeDef
9
11
10
12
_LOGGER = logging .getLogger (__name__ )
11
13
12
- SE = "Schneider Electric"
14
+ SE_MANUF_NAME = "Schneider Electric"
15
+ SE_MANUF_ID = 4190
13
16
14
17
15
18
class SEManufCluster (CustomCluster ):
@@ -20,101 +23,259 @@ class SEManufCluster(CustomCluster):
20
23
21
24
22
25
class SEBasicCluster (SEManufCluster , Basic ):
23
- ATT_ID_E001 = 0xE001
24
- ATT_ID_E002 = 0xE002
25
- ATT_ID_E004 = 0xE004
26
- ATT_ID_E007 = 0xE007
27
- ATT_ID_E008 = 0xE008
28
- ATT_ID_E009 = 0xE009
29
- ATT_ID_E00A = 0xE00A
30
- ATT_ID_E00B = 0xE00B
31
26
32
- attributes = Basic .attributes .copy ()
27
+ attributes : dict [ int , ZCLAttributeDef ] = Basic .attributes .copy ()
33
28
34
29
attributes .update (
35
30
{
36
- ATT_ID_E001 : ("57345" , t .CharacterString )
31
+ 0xE001 : ZCLAttributeDef (
32
+ id = 0xE001 ,
33
+ name = "57345" ,
34
+ type = t .CharacterString ,
35
+ access = "r" ,
36
+ is_manufacturer_specific = True ,
37
+ )
37
38
}, # attribute_name:"57345" # ex: "002.004.016 R
38
39
{
39
- ATT_ID_E002 : ("57346" , t .CharacterString )
40
+ 0xE002 : ZCLAttributeDef (
41
+ id = 0xE002 ,
42
+ name = "57346" ,
43
+ type = t .CharacterString ,
44
+ is_manufacturer_specific = True ,
45
+ )
40
46
}, # attribute_name:"57346" # ex: "001.000.000"
41
47
{
42
- ATT_ID_E004 : ("57348" , t .CharacterString )
48
+ 0xE004 : ZCLAttributeDef (
49
+ id = 0xE004 ,
50
+ name = "57348" ,
51
+ type = t .CharacterString ,
52
+ access = "r" ,
53
+ is_manufacturer_specific = True ,
54
+ )
43
55
}, # attribute_name:"57348" # ex: "213249FEFF5ECFD"
44
- {ATT_ID_E007 : ("57351" , t .enum16 )}, # attribute_name:"57351"
45
56
{
46
- ATT_ID_E008 : ("57352" , t .CharacterString )
57
+ 0xE007 : ZCLAttributeDef (
58
+ id = 0xE007 ,
59
+ name = "57351" ,
60
+ type = t .enum16 ,
61
+ access = "r" ,
62
+ is_manufacturer_specific = True ,
63
+ )
64
+ }, # attribute_name:"57351"
65
+ {
66
+ 0xE008 : ZCLAttributeDef (
67
+ id = 0xE008 ,
68
+ name = "57352" ,
69
+ type = t .CharacterString ,
70
+ access = "r" ,
71
+ is_manufacturer_specific = True ,
72
+ )
47
73
}, # attribute_name:"57352" # ex: "Wiser Light"
48
74
{
49
- ATT_ID_E009 : ("57353" , t .CharacterString )
75
+ 0xE009 : ZCLAttributeDef (
76
+ id = 0xE009 ,
77
+ name = "57353" ,
78
+ type = t .CharacterString ,
79
+ access = "r" ,
80
+ is_manufacturer_specific = True ,
81
+ )
50
82
}, # attribute_name:"57353" # ex: "NHPB/SHUTTER/1"
51
83
{
52
- ATT_ID_E00A : ("57354" , t .CharacterString )
84
+ 0xE00A : ZCLAttributeDef (
85
+ id = 0xE00A ,
86
+ name = "57354" ,
87
+ type = t .CharacterString ,
88
+ access = "r" ,
89
+ is_manufacturer_specific = True ,
90
+ )
53
91
}, # attribute_name:"57354" # ex: "Wiser Home"
54
- {ATT_ID_E00B : ("57355" , t .CharacterString )}, # attribute_name:"57355"
92
+ {
93
+ 0xE00B : ZCLAttributeDef (
94
+ id = 0xE00B ,
95
+ name = "57355" ,
96
+ type = t .CharacterString ,
97
+ access = "r" ,
98
+ is_manufacturer_specific = True ,
99
+ )
100
+ }, # attribute_name:"57355"
55
101
)
56
102
57
103
58
- class SEManufSwitchCluster (SEManufCluster ):
59
- name = "Schneider Electric Manufacturer Specicific"
104
+ class SESpecificCluster (SEManufCluster ):
60
105
cluster_id = 0xFF17
61
106
62
- ATT_ID_0000 = 0x0000
63
- ATT_ID_0001 = 0x0001
64
- ATT_ID_0010 = 0x0010
65
- ATT_ID_0011 = 0x0011
66
- ATT_ID_0020 = 0x0020
67
- ATT_ID_0021 = 0x0021
68
- ATT_ID_FFFD = 0xFFFD
69
-
70
107
attributes = {
71
- {ATT_ID_0000 : ("0" , t .enum8 )}, # attribute_name:"0"
72
- {ATT_ID_0001 : ("1" , t .enum8 )}, # attribute_name:"1"
73
- {ATT_ID_0010 : ("16" , t .uint8_t )}, # attribute_name:"16"
74
- {ATT_ID_0011 : ("17" , t .uint16_t )}, # attribute_name:"17"
75
- {ATT_ID_0020 : ("32" , t .uint8_t )}, # attribute_name:"32"
76
- {ATT_ID_0021 : ("33" , t .uint16_t )}, # attribute_name:"33"
77
- {ATT_ID_FFFD : ("65533" , t .uint16_t )}, # attribute_name:"65533"
108
+ {
109
+ 0x0000 : ZCLAttributeDef (
110
+ id = 0x0000 ,
111
+ name = "0" ,
112
+ type = t .enum8 ,
113
+ access = "rw" ,
114
+ is_manufacturer_specific = True ,
115
+ )
116
+ }, # attribute_name:"0"
117
+ {
118
+ 0x0001 : ZCLAttributeDef (
119
+ id = 0x0001 ,
120
+ name = "1" ,
121
+ type = t .enum8 ,
122
+ access = "rw" ,
123
+ is_manufacturer_specific = True ,
124
+ )
125
+ }, # attribute_name:"1"
126
+ {
127
+ 0x0010 : ZCLAttributeDef (
128
+ id = 0x0010 ,
129
+ name = "16" ,
130
+ type = t .uint8_t ,
131
+ access = "rw" ,
132
+ is_manufacturer_specific = True ,
133
+ )
134
+ }, # attribute_name:"16"
135
+ {
136
+ 0x0011 : ZCLAttributeDef (
137
+ id = 0x0011 ,
138
+ name = "17" ,
139
+ type = t .uint16_t ,
140
+ access = "rw" ,
141
+ is_manufacturer_specific = True ,
142
+ )
143
+ }, # attribute_name:"17"
144
+ {
145
+ 0x0020 : ZCLAttributeDef (
146
+ id = 0x0020 ,
147
+ name = "32" ,
148
+ type = t .uint8_t ,
149
+ access = "rw" ,
150
+ is_manufacturer_specific = True ,
151
+ )
152
+ }, # attribute_name:"32"
153
+ {
154
+ 0x0021 : ZCLAttributeDef (
155
+ id = 0x0021 ,
156
+ name = "33" ,
157
+ type = t .uint16_t ,
158
+ access = "rw" ,
159
+ is_manufacturer_specific = True ,
160
+ )
161
+ }, # attribute_name:"33"
162
+ {
163
+ 0xFFFD : ZCLAttributeDef (
164
+ id = 0xFFFD ,
165
+ name = "65533" ,
166
+ type = t .uint16_t ,
167
+ access = "r" ,
168
+ is_manufacturer_specific = True ,
169
+ )
170
+ }, # attribute_name:"65533"
78
171
}
79
172
80
173
81
174
class SEWindowCover (CustomCluster , WindowCovering ):
82
175
"""Manufacturer Specific Cluster of Device cover."""
83
176
84
- ATT_ID_FFFD = 0xFFFD
85
- ATT_ID_E000 = 0xE000
86
- ATT_ID_E010 = 0xE010
87
- ATT_ID_E012 = 0xE012
88
- ATT_ID_E013 = 0xE013
89
- ATT_ID_E014 = 0xE014
90
- ATT_ID_E015 = 0xE015
91
- ATT_ID_E016 = 0xE016
92
- ATT_ID_E017 = 0xE017
177
+ # TODO: Reverse lift percentage
93
178
94
- attributes = WindowCovering .attributes .copy ()
179
+ attributes : dict [ int , ZCLAttributeDef ] = WindowCovering .attributes .copy ()
95
180
96
181
attributes .update (
97
182
{
98
- ATT_ID_FFFD : ("57344" , t .uint16_t )
99
- }, # attribute_name:"57344" # seems to be lift_duration
100
- {ATT_ID_E000 : ("65533" , t .uint16_t )}, # attribute_name:"65533"
101
- {ATT_ID_E010 : ("57360" , t .bitmap8 )}, # attribute_name:"57360"
102
- {ATT_ID_E012 : ("57362" , t .uint16_t )}, # attribute_name:"57362"
103
- {ATT_ID_E013 : ("57363" , t .bitmap8 )}, # attribute_name:"57363"
104
- {ATT_ID_E014 : ("57364" , t .uint16_t )}, # attribute_name:"57364"
105
- {ATT_ID_E015 : ("57365" , t .uint16_t )}, # attribute_name:"57365"
106
- {ATT_ID_E016 : ("57366" , t .uint16_t )}, # attribute_name:"57366"
107
- {ATT_ID_E017 : ("57367" , t .uint8_t )}, # attribute_name:"57367"
183
+ 0xFFFD : ZCLAttributeDef (
184
+ id = 0xFFFD ,
185
+ name = "lift_duration" ,
186
+ type = t .uint16_t ,
187
+ access = "rw" ,
188
+ is_manufacturer_specific = True ,
189
+ )
190
+ }, # attribute_name:"65533"
191
+ {
192
+ 0xE000 : ZCLAttributeDef (
193
+ id = 0xE000 ,
194
+ name = "57344" ,
195
+ type = t .uint16_t ,
196
+ access = "rw" ,
197
+ is_manufacturer_specific = True ,
198
+ )
199
+ }, # attribute_name:"57344"
200
+ {
201
+ 0xE010 : ZCLAttributeDef (
202
+ id = 0xE010 ,
203
+ name = "57360" ,
204
+ type = t .bitmap8 ,
205
+ access = "r" ,
206
+ is_manufacturer_specific = True ,
207
+ )
208
+ }, # attribute_name:"57360"
209
+ {
210
+ 0xE012 : ZCLAttributeDef (
211
+ id = 0xE012 ,
212
+ name = "57362" ,
213
+ type = t .uint16_t ,
214
+ access = "rw" ,
215
+ is_manufacturer_specific = True ,
216
+ )
217
+ }, # attribute_name:"57362"
218
+ {
219
+ 0xE013 : ZCLAttributeDef (
220
+ id = 0xE013 ,
221
+ name = "57363" ,
222
+ type = t .bitmap8 ,
223
+ access = "r" ,
224
+ is_manufacturer_specific = True ,
225
+ )
226
+ }, # attribute_name:"57363"
227
+ {
228
+ 0xE014 : ZCLAttributeDef (
229
+ id = 0xE014 ,
230
+ name = "57364" ,
231
+ type = t .uint16_t ,
232
+ access = "rw" ,
233
+ is_manufacturer_specific = True ,
234
+ )
235
+ }, # attribute_name:"57364"
236
+ {
237
+ 0xE015 : ZCLAttributeDef (
238
+ id = 0xE015 ,
239
+ name = "57365" ,
240
+ type = t .uint16_t ,
241
+ access = "rw" ,
242
+ is_manufacturer_specific = True ,
243
+ )
244
+ }, # attribute_name:"57365"
245
+ {
246
+ 0xE016 : ZCLAttributeDef (
247
+ id = 0xE016 ,
248
+ name = "57366" ,
249
+ type = t .uint16_t ,
250
+ access = "rw" ,
251
+ is_manufacturer_specific = True ,
252
+ )
253
+ }, # attribute_name:"57366"
254
+ {
255
+ 0xE017 : ZCLAttributeDef (
256
+ id = 0xE017 ,
257
+ name = "57367" ,
258
+ type = t .uint8_t ,
259
+ access = "rw" ,
260
+ is_manufacturer_specific = True ,
261
+ )
262
+ }, # attribute_name:"57367"
108
263
)
109
264
110
265
111
266
class SEDiagnostic (CustomCluster , Diagnostic ):
112
267
113
- ATT_ID_FFFD = 0xFFFD
114
-
115
- attributes = Diagnostic .attributes .copy ()
268
+ attributes : dict [int , ZCLAttributeDef ] = Diagnostic .attributes .copy ()
116
269
117
270
# TODO: Check -> this attr don't seems to be manufacturer related (no "manf_id")
118
271
attributes .update (
119
- {ATT_ID_FFFD : ("65533" , t .uint16_t )}, # attribute_name:"65533"
272
+ {
273
+ 0xFFFD : ZCLAttributeDef (
274
+ id = 0xFFFD ,
275
+ name = "65533" ,
276
+ type = t .uint16_t ,
277
+ access = "r" ,
278
+ is_manufacturer_specific = True ,
279
+ )
280
+ }, # attribute_name:"65533"
120
281
)
0 commit comments