homebridge-midea-platform 1.2.0-beta.8 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -2
- package/README.md +2 -2
- package/dist/accessory/AccessoryFactory.d.ts +14 -15
- package/dist/accessory/AccessoryFactory.js +34 -40
- package/dist/accessory/AccessoryFactory.js.map +1 -1
- package/dist/accessory/AirConditionerAccessory.d.ts +98 -99
- package/dist/accessory/AirConditionerAccessory.js +666 -662
- package/dist/accessory/AirConditionerAccessory.js.map +1 -1
- package/dist/accessory/BaseAccessory.d.ts +11 -12
- package/dist/accessory/BaseAccessory.js +21 -21
- package/dist/accessory/BaseAccessory.js.map +1 -1
- package/dist/accessory/DehumidifierAccessory.d.ts +45 -46
- package/dist/accessory/DehumidifierAccessory.js +343 -344
- package/dist/accessory/DehumidifierAccessory.js.map +1 -1
- package/dist/accessory/DishwasherAccessory.d.ts +30 -31
- package/dist/accessory/DishwasherAccessory.js +59 -63
- package/dist/accessory/DishwasherAccessory.js.map +1 -1
- package/dist/accessory/ElectricWaterHeaterAccessory.d.ts +44 -45
- package/dist/accessory/ElectricWaterHeaterAccessory.js +172 -176
- package/dist/accessory/ElectricWaterHeaterAccessory.js.map +1 -1
- package/dist/accessory/FanAccessory.d.ts +39 -40
- package/dist/accessory/FanAccessory.js +120 -123
- package/dist/accessory/FanAccessory.js.map +1 -1
- package/dist/accessory/FrontLoadWasherAccessory.d.ts +30 -31
- package/dist/accessory/FrontLoadWasherAccessory.js +63 -66
- package/dist/accessory/FrontLoadWasherAccessory.js.map +1 -1
- package/dist/accessory/GasWaterHeaterAccessory.d.ts +51 -52
- package/dist/accessory/GasWaterHeaterAccessory.js +217 -216
- package/dist/accessory/GasWaterHeaterAccessory.js.map +1 -1
- package/dist/accessory/{HeatPumpWifiControllerAccessory.d.ts → HeatPumpWiFiControllerAccessory.d.ts} +34 -35
- package/dist/accessory/{HeatPumpWifiControllerAccessory.js → HeatPumpWiFiControllerAccessory.js} +55 -36
- package/dist/accessory/HeatPumpWiFiControllerAccessory.js.map +1 -0
- package/dist/core/MideaCloud.d.ts +34 -36
- package/dist/core/MideaCloud.js +349 -350
- package/dist/core/MideaCloud.js.map +1 -1
- package/dist/core/MideaConstants.d.ts +51 -52
- package/dist/core/MideaConstants.js +56 -59
- package/dist/core/MideaConstants.js.map +1 -1
- package/dist/core/MideaDevice.d.ts +75 -78
- package/dist/core/MideaDevice.js +430 -420
- package/dist/core/MideaDevice.js.map +1 -1
- package/dist/core/MideaDiscover.d.ts +34 -36
- package/dist/core/MideaDiscover.js +208 -212
- package/dist/core/MideaDiscover.js.map +1 -1
- package/dist/core/MideaMessage.d.ts +75 -76
- package/dist/core/MideaMessage.js +185 -184
- package/dist/core/MideaMessage.js.map +1 -1
- package/dist/core/MideaPacketBuilder.d.ts +9 -11
- package/dist/core/MideaPacketBuilder.js +60 -60
- package/dist/core/MideaPacketBuilder.js.map +1 -1
- package/dist/core/MideaSecurity.d.ts +62 -64
- package/dist/core/MideaSecurity.js +241 -251
- package/dist/core/MideaSecurity.js.map +1 -1
- package/dist/core/MideaUtils.d.ts +31 -33
- package/dist/core/MideaUtils.js +178 -181
- package/dist/core/MideaUtils.js.map +1 -1
- package/dist/devices/DeviceFactory.d.ts +14 -15
- package/dist/devices/DeviceFactory.js +34 -40
- package/dist/devices/DeviceFactory.js.map +1 -1
- package/dist/devices/a1/MideaA1Device.d.ts +75 -77
- package/dist/devices/a1/MideaA1Device.js +142 -145
- package/dist/devices/a1/MideaA1Device.js.map +1 -1
- package/dist/devices/a1/MideaA1Message.d.ts +39 -41
- package/dist/devices/a1/MideaA1Message.js +219 -198
- package/dist/devices/a1/MideaA1Message.js.map +1 -1
- package/dist/devices/ac/MideaACDevice.d.ts +105 -107
- package/dist/devices/ac/MideaACDevice.js +417 -400
- package/dist/devices/ac/MideaACDevice.js.map +1 -1
- package/dist/devices/ac/MideaACMessage.d.ts +97 -96
- package/dist/devices/ac/MideaACMessage.js +724 -621
- package/dist/devices/ac/MideaACMessage.js.map +1 -1
- package/dist/devices/c3/MideaC3Device.d.ts +73 -75
- package/dist/devices/c3/MideaC3Device.js +249 -255
- package/dist/devices/c3/MideaC3Device.js.map +1 -1
- package/dist/devices/c3/MideaC3Message.d.ts +81 -80
- package/dist/devices/c3/MideaC3Message.js +190 -152
- package/dist/devices/c3/MideaC3Message.js.map +1 -1
- package/dist/devices/db/MideaDBDevice.d.ts +28 -30
- package/dist/devices/db/MideaDBDevice.js +94 -100
- package/dist/devices/db/MideaDBDevice.js.map +1 -1
- package/dist/devices/db/MideaDBMessage.d.ts +31 -33
- package/dist/devices/db/MideaDBMessage.js +101 -101
- package/dist/devices/db/MideaDBMessage.js.map +1 -1
- package/dist/devices/e1/MideaE1Device.d.ts +55 -57
- package/dist/devices/e1/MideaE1Device.js +122 -128
- package/dist/devices/e1/MideaE1Device.js.map +1 -1
- package/dist/devices/e1/MideaE1Message.d.ts +27 -29
- package/dist/devices/e1/MideaE1Message.js +128 -107
- package/dist/devices/e1/MideaE1Message.js.map +1 -1
- package/dist/devices/e2/MideaE2Device.d.ts +43 -45
- package/dist/devices/e2/MideaE2Device.js +124 -129
- package/dist/devices/e2/MideaE2Device.js.map +1 -1
- package/dist/devices/e2/MideaE2Message.d.ts +34 -34
- package/dist/devices/e2/MideaE2Message.js +143 -132
- package/dist/devices/e2/MideaE2Message.js.map +1 -1
- package/dist/devices/e3/MideaE3Device.d.ts +42 -44
- package/dist/devices/e3/MideaE3Device.js +132 -137
- package/dist/devices/e3/MideaE3Device.js.map +1 -1
- package/dist/devices/e3/MideaE3Message.d.ts +51 -52
- package/dist/devices/e3/MideaE3Message.js +144 -136
- package/dist/devices/e3/MideaE3Message.js.map +1 -1
- package/dist/devices/fa/MideaFADevice.d.ts +35 -37
- package/dist/devices/fa/MideaFADevice.js +102 -106
- package/dist/devices/fa/MideaFADevice.js.map +1 -1
- package/dist/devices/fa/MideaFAMessage.d.ts +38 -39
- package/dist/devices/fa/MideaFAMessage.js +108 -98
- package/dist/devices/fa/MideaFAMessage.js.map +1 -1
- package/dist/index.d.ts +6 -7
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/platform.d.ts +61 -61
- package/dist/platform.js +232 -212
- package/dist/platform.js.map +1 -1
- package/dist/platformUtils.d.ts +116 -117
- package/dist/platformUtils.js +107 -110
- package/dist/platformUtils.js.map +1 -1
- package/dist/settings.d.ts +8 -9
- package/dist/settings.js +8 -11
- package/dist/settings.js.map +1 -1
- package/docs/download_lua.md +9 -0
- package/eslint.config.js +43 -0
- package/homebridge-ui/public/js/bootstrap.min.js +1179 -1
- package/homebridge-ui/{server.js → server.cjs} +30 -30
- package/package.json +21 -31
- package/.eslintignore +0 -3
- package/.husky/pre-commit +0 -5
- package/.prettierrc +0 -19
- package/dist/accessory/AccessoryFactory.d.ts.map +0 -1
- package/dist/accessory/AirConditionerAccessory.d.ts.map +0 -1
- package/dist/accessory/BaseAccessory.d.ts.map +0 -1
- package/dist/accessory/DehumidifierAccessory.d.ts.map +0 -1
- package/dist/accessory/DishwasherAccessory.d.ts.map +0 -1
- package/dist/accessory/ElectricWaterHeaterAccessory.d.ts.map +0 -1
- package/dist/accessory/FanAccessory.d.ts.map +0 -1
- package/dist/accessory/FrontLoadWasherAccessory.d.ts.map +0 -1
- package/dist/accessory/GasWaterHeaterAccessory.d.ts.map +0 -1
- package/dist/accessory/HeatPumpWifiControllerAccessory.d.ts.map +0 -1
- package/dist/accessory/HeatPumpWifiControllerAccessory.js.map +0 -1
- package/dist/core/MideaCloud.d.ts.map +0 -1
- package/dist/core/MideaConstants.d.ts.map +0 -1
- package/dist/core/MideaDevice.d.ts.map +0 -1
- package/dist/core/MideaDiscover.d.ts.map +0 -1
- package/dist/core/MideaMessage.d.ts.map +0 -1
- package/dist/core/MideaPacketBuilder.d.ts.map +0 -1
- package/dist/core/MideaSecurity.d.ts.map +0 -1
- package/dist/core/MideaUtils.d.ts.map +0 -1
- package/dist/devices/DeviceFactory.d.ts.map +0 -1
- package/dist/devices/a1/MideaA1Device.d.ts.map +0 -1
- package/dist/devices/a1/MideaA1Message.d.ts.map +0 -1
- package/dist/devices/ac/MideaACDevice.d.ts.map +0 -1
- package/dist/devices/ac/MideaACMessage.d.ts.map +0 -1
- package/dist/devices/c3/MideaC3Device.d.ts.map +0 -1
- package/dist/devices/c3/MideaC3Message.d.ts.map +0 -1
- package/dist/devices/db/MideaDBDevice.d.ts.map +0 -1
- package/dist/devices/db/MideaDBMessage.d.ts.map +0 -1
- package/dist/devices/e1/MideaE1Device.d.ts.map +0 -1
- package/dist/devices/e1/MideaE1Message.d.ts.map +0 -1
- package/dist/devices/e2/MideaE2Device.d.ts.map +0 -1
- package/dist/devices/e2/MideaE2Message.d.ts.map +0 -1
- package/dist/devices/e3/MideaE3Device.d.ts.map +0 -1
- package/dist/devices/e3/MideaE3Message.d.ts.map +0 -1
- package/dist/devices/fa/MideaFADevice.d.ts.map +0 -1
- package/dist/devices/fa/MideaFAMessage.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/platform.d.ts.map +0 -1
- package/dist/platformUtils.d.ts.map +0 -1
- package/dist/settings.d.ts.map +0 -1
|
@@ -1,622 +1,725 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
NewProtocolTags[NewProtocolTags["
|
|
18
|
-
NewProtocolTags[NewProtocolTags["
|
|
19
|
-
NewProtocolTags[NewProtocolTags["
|
|
20
|
-
NewProtocolTags[NewProtocolTags["
|
|
21
|
-
NewProtocolTags[NewProtocolTags["
|
|
22
|
-
NewProtocolTags[NewProtocolTags["
|
|
23
|
-
NewProtocolTags[NewProtocolTags["
|
|
24
|
-
NewProtocolTags[NewProtocolTags["
|
|
25
|
-
NewProtocolTags[NewProtocolTags["
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
MessageACBase.message_serial
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
get
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
NewProtocolTags.
|
|
89
|
-
NewProtocolTags.
|
|
90
|
-
NewProtocolTags.
|
|
91
|
-
NewProtocolTags.
|
|
92
|
-
NewProtocolTags.
|
|
93
|
-
NewProtocolTags.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
body = Buffer.
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
class
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
this.
|
|
152
|
-
this.
|
|
153
|
-
this.
|
|
154
|
-
this.
|
|
155
|
-
this.
|
|
156
|
-
this.
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
const
|
|
166
|
-
const
|
|
167
|
-
const
|
|
168
|
-
const
|
|
169
|
-
const
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
0x00,
|
|
182
|
-
0x00,
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
0x00,
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
0x00,
|
|
203
|
-
|
|
204
|
-
0x00,
|
|
205
|
-
0x00,
|
|
206
|
-
0x00,
|
|
207
|
-
0x00,
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
const
|
|
260
|
-
//
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
payload
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
this.
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
this.
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
this.
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
if (
|
|
449
|
-
|
|
450
|
-
const
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
this.
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
this.
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
this.
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
}
|
|
621
|
-
|
|
1
|
+
/***********************************************************************
|
|
2
|
+
* Midea Air Conditioner Device message handler class
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2023 Kovalovszky Patrik, https://github.com/kovapatrik
|
|
5
|
+
*
|
|
6
|
+
* With thanks to https://github.com/georgezhao2010/midea_ac_lan
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
import { DeviceType } from '../../core/MideaConstants.js';
|
|
10
|
+
import { MessageBody, MessageRequest, MessageResponse, MessageType, NewProtocolMessageBody } from '../../core/MideaMessage.js';
|
|
11
|
+
import { calculate } from '../../core/MideaUtils.js';
|
|
12
|
+
var NewProtocolTags;
|
|
13
|
+
(function (NewProtocolTags) {
|
|
14
|
+
NewProtocolTags[NewProtocolTags["WIND_SWING_UD_ANGLE"] = 9] = "WIND_SWING_UD_ANGLE";
|
|
15
|
+
NewProtocolTags[NewProtocolTags["WIND_SWING_LR_ANGLE"] = 10] = "WIND_SWING_LR_ANGLE";
|
|
16
|
+
NewProtocolTags[NewProtocolTags["INDOOR_HUMIDITY"] = 21] = "INDOOR_HUMIDITY";
|
|
17
|
+
NewProtocolTags[NewProtocolTags["SCREEN_DISPLAY"] = 36] = "SCREEN_DISPLAY";
|
|
18
|
+
NewProtocolTags[NewProtocolTags["BREEZELESS"] = 24] = "BREEZELESS";
|
|
19
|
+
NewProtocolTags[NewProtocolTags["PROMPT_TONE"] = 26] = "PROMPT_TONE";
|
|
20
|
+
NewProtocolTags[NewProtocolTags["INDIRECT_WIND"] = 66] = "INDIRECT_WIND";
|
|
21
|
+
NewProtocolTags[NewProtocolTags["FRESH_AIR_1"] = 563] = "FRESH_AIR_1";
|
|
22
|
+
NewProtocolTags[NewProtocolTags["FRESH_AIR_2"] = 75] = "FRESH_AIR_2";
|
|
23
|
+
NewProtocolTags[NewProtocolTags["SELF_CLEAN"] = 57] = "SELF_CLEAN";
|
|
24
|
+
NewProtocolTags[NewProtocolTags["RATE_SELECT"] = 72] = "RATE_SELECT";
|
|
25
|
+
NewProtocolTags[NewProtocolTags["ION"] = 30] = "ION";
|
|
26
|
+
})(NewProtocolTags || (NewProtocolTags = {}));
|
|
27
|
+
const BB_AC_MODES = [0, 3, 1, 2, 4, 5];
|
|
28
|
+
class MessageACBase extends MessageRequest {
|
|
29
|
+
static message_serial = 0;
|
|
30
|
+
message_id;
|
|
31
|
+
constructor(device_protocol_version, message_type, body_type) {
|
|
32
|
+
super(DeviceType.AIR_CONDITIONER, message_type, body_type, device_protocol_version);
|
|
33
|
+
MessageACBase.message_serial += 1;
|
|
34
|
+
if (MessageACBase.message_serial >= 254) {
|
|
35
|
+
MessageACBase.message_serial = 1;
|
|
36
|
+
}
|
|
37
|
+
this.message_id = MessageACBase.message_serial;
|
|
38
|
+
}
|
|
39
|
+
get body() {
|
|
40
|
+
let body = Buffer.concat([Buffer.from([this.body_type]), this._body, Buffer.from([this.message_id])]);
|
|
41
|
+
body = Buffer.concat([body, Buffer.from([calculate(body)])]);
|
|
42
|
+
return body;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export class MessageQuery extends MessageACBase {
|
|
46
|
+
constructor(device_protocol_version) {
|
|
47
|
+
super(device_protocol_version, MessageType.QUERY, 0x41);
|
|
48
|
+
}
|
|
49
|
+
get _body() {
|
|
50
|
+
return Buffer.from([0x81, 0x00, 0xff, 0x03, 0xff, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export class MessagePowerQuery extends MessageACBase {
|
|
54
|
+
constructor(device_protocol_version) {
|
|
55
|
+
super(device_protocol_version, MessageType.QUERY, 0x41);
|
|
56
|
+
}
|
|
57
|
+
get _body() {
|
|
58
|
+
return Buffer.from([0x21, 0x01, 0x44, 0x00, 0x01]);
|
|
59
|
+
}
|
|
60
|
+
get body() {
|
|
61
|
+
let body = Buffer.concat([Buffer.from([this.body_type]), this._body]);
|
|
62
|
+
body = Buffer.concat([body, Buffer.from([calculate(body)])]);
|
|
63
|
+
return body;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export class MessageSwitchDisplay extends MessageACBase {
|
|
67
|
+
constructor(device_protocol_version) {
|
|
68
|
+
super(device_protocol_version, MessageType.QUERY, 0x41);
|
|
69
|
+
}
|
|
70
|
+
get _body() {
|
|
71
|
+
return Buffer.concat([Buffer.from([0x00, 0x00, 0xff, 0x02, 0x00, 0x02, 0x00]), Buffer.alloc(12)]);
|
|
72
|
+
// return Buffer.from([0x81, 0x00, 0xff, 0x02, 0xff, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
export class MessageNewProtocolQuery extends MessageACBase {
|
|
76
|
+
alternate_display;
|
|
77
|
+
constructor(device_protocol_version, alternate_display = false) {
|
|
78
|
+
super(device_protocol_version, MessageType.QUERY, 0xb1);
|
|
79
|
+
this.alternate_display = alternate_display;
|
|
80
|
+
}
|
|
81
|
+
get _body() {
|
|
82
|
+
const query_params = [
|
|
83
|
+
NewProtocolTags.WIND_SWING_UD_ANGLE,
|
|
84
|
+
NewProtocolTags.WIND_SWING_LR_ANGLE,
|
|
85
|
+
NewProtocolTags.INDIRECT_WIND,
|
|
86
|
+
NewProtocolTags.BREEZELESS,
|
|
87
|
+
NewProtocolTags.INDOOR_HUMIDITY,
|
|
88
|
+
NewProtocolTags.SCREEN_DISPLAY,
|
|
89
|
+
NewProtocolTags.FRESH_AIR_1,
|
|
90
|
+
NewProtocolTags.FRESH_AIR_2,
|
|
91
|
+
NewProtocolTags.SELF_CLEAN,
|
|
92
|
+
NewProtocolTags.RATE_SELECT,
|
|
93
|
+
NewProtocolTags.ION,
|
|
94
|
+
];
|
|
95
|
+
let body = Buffer.from([query_params.length]);
|
|
96
|
+
for (const param of query_params) {
|
|
97
|
+
if (param) {
|
|
98
|
+
body = Buffer.concat([body, Buffer.from([param & 0xff, param >> 8])]);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return body;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
export class MessageSubProtocol extends MessageACBase {
|
|
105
|
+
subprotocol_query_type;
|
|
106
|
+
constructor(device_protocol_version, message_type, subprotocol_query_type) {
|
|
107
|
+
super(device_protocol_version, message_type, 0xaa);
|
|
108
|
+
this.subprotocol_query_type = subprotocol_query_type;
|
|
109
|
+
}
|
|
110
|
+
get body() {
|
|
111
|
+
let body = Buffer.concat([Buffer.from([this.body_type]), this._body]);
|
|
112
|
+
body = Buffer.concat([body, Buffer.from([calculate(body)])]);
|
|
113
|
+
body = Buffer.concat([body, Buffer.from([this.checksum(body)])]);
|
|
114
|
+
return body;
|
|
115
|
+
}
|
|
116
|
+
get _body() {
|
|
117
|
+
let body = Buffer.from([
|
|
118
|
+
6 + 2 + (this.subprotocol_body ? this.subprotocol_body.length : 0),
|
|
119
|
+
0x00,
|
|
120
|
+
0xff,
|
|
121
|
+
0xff,
|
|
122
|
+
this.subprotocol_query_type,
|
|
123
|
+
]);
|
|
124
|
+
if (this.subprotocol_body) {
|
|
125
|
+
body = Buffer.concat([body, this.subprotocol_body]);
|
|
126
|
+
}
|
|
127
|
+
return body;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
export class MessageSubProtocolQuery extends MessageSubProtocol {
|
|
131
|
+
subprotocol_body;
|
|
132
|
+
constructor(device_protocol_version, subprotocol_query_type) {
|
|
133
|
+
super(device_protocol_version, MessageType.QUERY, subprotocol_query_type);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
export class MessageSubProtocolSet extends MessageSubProtocol {
|
|
137
|
+
power;
|
|
138
|
+
mode;
|
|
139
|
+
target_temperature;
|
|
140
|
+
fan_speed;
|
|
141
|
+
boost_mode;
|
|
142
|
+
aux_heating;
|
|
143
|
+
dry;
|
|
144
|
+
eco_mode;
|
|
145
|
+
sleep_mode;
|
|
146
|
+
sn8_flag;
|
|
147
|
+
timer;
|
|
148
|
+
prompt_tone;
|
|
149
|
+
constructor(device_protocol_version) {
|
|
150
|
+
super(device_protocol_version, MessageType.SET, 0x20);
|
|
151
|
+
this.power = false;
|
|
152
|
+
this.mode = 0;
|
|
153
|
+
this.target_temperature = 20.0;
|
|
154
|
+
this.fan_speed = 102;
|
|
155
|
+
this.boost_mode = false;
|
|
156
|
+
this.aux_heating = false;
|
|
157
|
+
this.dry = false;
|
|
158
|
+
this.eco_mode = false;
|
|
159
|
+
this.sleep_mode = false;
|
|
160
|
+
this.sn8_flag = false;
|
|
161
|
+
this.timer = false;
|
|
162
|
+
this.prompt_tone = false;
|
|
163
|
+
}
|
|
164
|
+
get subprotocol_body() {
|
|
165
|
+
const power = this.power ? 0x01 : 0x00;
|
|
166
|
+
const dry = this.dry && this.power ? 0x10 : 0;
|
|
167
|
+
const boost_mode = this.boost_mode ? 0x20 : 0;
|
|
168
|
+
const aux_heating = this.aux_heating ? 0x40 : 0;
|
|
169
|
+
const sleep_mode = this.sleep_mode ? 0x80 : 0;
|
|
170
|
+
const mode = this.mode === 0 ? 0 : this.mode < BB_AC_MODES.length ? BB_AC_MODES[this.mode] - 1 : 2;
|
|
171
|
+
const target_temperature = (this.target_temperature * 2 + 30) | 0;
|
|
172
|
+
const water_model_temperature_set = ((this.target_temperature - 1) * 2 + 50) | 0;
|
|
173
|
+
const fan_speed = this.fan_speed;
|
|
174
|
+
const eco = this.eco_mode ? 0x40 : 0;
|
|
175
|
+
const prompt_tone = this.prompt_tone ? 0x01 : 0;
|
|
176
|
+
const timer = this.sn8_flag && this.timer ? 0x04 : 0;
|
|
177
|
+
return Buffer.from([
|
|
178
|
+
boost_mode | power | dry,
|
|
179
|
+
aux_heating,
|
|
180
|
+
sleep_mode,
|
|
181
|
+
0x00,
|
|
182
|
+
0x00,
|
|
183
|
+
mode,
|
|
184
|
+
target_temperature,
|
|
185
|
+
fan_speed,
|
|
186
|
+
0x32,
|
|
187
|
+
0x00,
|
|
188
|
+
0x00,
|
|
189
|
+
0x00,
|
|
190
|
+
0x00,
|
|
191
|
+
0x00,
|
|
192
|
+
0x00,
|
|
193
|
+
0x01,
|
|
194
|
+
0x01,
|
|
195
|
+
0x00,
|
|
196
|
+
0x01,
|
|
197
|
+
water_model_temperature_set,
|
|
198
|
+
prompt_tone,
|
|
199
|
+
target_temperature,
|
|
200
|
+
0x32,
|
|
201
|
+
0x66,
|
|
202
|
+
0x00,
|
|
203
|
+
eco | timer,
|
|
204
|
+
0x00,
|
|
205
|
+
0x00,
|
|
206
|
+
0x00,
|
|
207
|
+
0x00,
|
|
208
|
+
0x00,
|
|
209
|
+
0x00,
|
|
210
|
+
0x00,
|
|
211
|
+
0x00,
|
|
212
|
+
0x00,
|
|
213
|
+
0x00,
|
|
214
|
+
0x08,
|
|
215
|
+
]);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
export class MessageGeneralSet extends MessageACBase {
|
|
219
|
+
power;
|
|
220
|
+
prompt_tone;
|
|
221
|
+
mode;
|
|
222
|
+
target_temperature;
|
|
223
|
+
fan_speed;
|
|
224
|
+
swing_vertical;
|
|
225
|
+
swing_horizontal;
|
|
226
|
+
boost_mode;
|
|
227
|
+
smart_eye;
|
|
228
|
+
dry;
|
|
229
|
+
aux_heating;
|
|
230
|
+
eco_mode;
|
|
231
|
+
temp_fahrenheit;
|
|
232
|
+
sleep_mode;
|
|
233
|
+
natural_wind;
|
|
234
|
+
frost_protect;
|
|
235
|
+
comfort_mode;
|
|
236
|
+
constructor(device_protocol_version) {
|
|
237
|
+
super(device_protocol_version, MessageType.SET, 0x40);
|
|
238
|
+
this.power = false;
|
|
239
|
+
this.prompt_tone = true;
|
|
240
|
+
this.mode = 0;
|
|
241
|
+
this.target_temperature = 20.0;
|
|
242
|
+
this.fan_speed = 102;
|
|
243
|
+
this.swing_vertical = false;
|
|
244
|
+
this.swing_horizontal = false;
|
|
245
|
+
this.boost_mode = false;
|
|
246
|
+
this.smart_eye = false;
|
|
247
|
+
this.dry = false;
|
|
248
|
+
this.aux_heating = false;
|
|
249
|
+
this.eco_mode = false;
|
|
250
|
+
this.temp_fahrenheit = false;
|
|
251
|
+
this.sleep_mode = false;
|
|
252
|
+
this.natural_wind = false;
|
|
253
|
+
this.frost_protect = false;
|
|
254
|
+
this.comfort_mode = false;
|
|
255
|
+
}
|
|
256
|
+
get _body() {
|
|
257
|
+
// Byte1, Power, prompt_tone
|
|
258
|
+
const power = this.power ? 0x01 : 0x00;
|
|
259
|
+
const prompt_tone = this.prompt_tone ? 0x40 : 0x00;
|
|
260
|
+
// Byte2, mode target_temperature
|
|
261
|
+
const mode = (this.mode << 5) & 0xe0;
|
|
262
|
+
const target_temperature = ((this.target_temperature | 0) & 0xf) | ((Math.round(this.target_temperature * 2) | 0) % 2 !== 0 ? 0x10 : 0);
|
|
263
|
+
// Byte 3, fan_speed
|
|
264
|
+
const fan_speed = this.fan_speed & 0x7f;
|
|
265
|
+
// Byte 7, swing_mode
|
|
266
|
+
const swing_mode = 0x30 | (this.swing_vertical ? 0x0c : 0) | (this.swing_horizontal ? 0x03 : 0);
|
|
267
|
+
// Byte 8, turbo
|
|
268
|
+
const boost_mode = this.boost_mode ? 0x20 : 0;
|
|
269
|
+
// Byte 9 aux_heating eco_mode
|
|
270
|
+
const smart_eye = this.smart_eye ? 0x01 : 0;
|
|
271
|
+
const dry = this.dry ? 0x04 : 0;
|
|
272
|
+
const aux_heating = this.aux_heating ? 0x08 : 0;
|
|
273
|
+
const eco_mode = this.eco_mode ? 0x80 : 0;
|
|
274
|
+
// Byte 10 temp_fahrenheit
|
|
275
|
+
const temp_fahrenheit = this.temp_fahrenheit ? 0x04 : 0;
|
|
276
|
+
const sleep_mode = this.sleep_mode ? 0x01 : 0;
|
|
277
|
+
const boost_mode_1 = this.boost_mode ? 0x02 : 0;
|
|
278
|
+
// Byte 17 natural_wind
|
|
279
|
+
const natural_wind = this.natural_wind ? 0x40 : 0;
|
|
280
|
+
// Byte 21 frost_protect
|
|
281
|
+
const frost_protect = this.frost_protect ? 0x80 : 0;
|
|
282
|
+
// Byte 22 comfort_mode
|
|
283
|
+
const comfort_mode = this.comfort_mode ? 0x01 : 0;
|
|
284
|
+
return Buffer.from([
|
|
285
|
+
power | prompt_tone,
|
|
286
|
+
mode | target_temperature,
|
|
287
|
+
fan_speed,
|
|
288
|
+
0x00,
|
|
289
|
+
0x00,
|
|
290
|
+
0x00,
|
|
291
|
+
swing_mode,
|
|
292
|
+
boost_mode,
|
|
293
|
+
smart_eye | dry | aux_heating | eco_mode,
|
|
294
|
+
temp_fahrenheit | sleep_mode | boost_mode_1,
|
|
295
|
+
0x00,
|
|
296
|
+
0x00,
|
|
297
|
+
0x00,
|
|
298
|
+
0x00,
|
|
299
|
+
0x00,
|
|
300
|
+
0x00,
|
|
301
|
+
natural_wind,
|
|
302
|
+
0x00,
|
|
303
|
+
0x00,
|
|
304
|
+
0x00,
|
|
305
|
+
frost_protect,
|
|
306
|
+
comfort_mode,
|
|
307
|
+
]);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
export class MessageNewProtocolSet extends MessageACBase {
|
|
311
|
+
wind_swing_ud_angle;
|
|
312
|
+
wind_swing_lr_angle;
|
|
313
|
+
indirect_wind;
|
|
314
|
+
prompt_tone = false;
|
|
315
|
+
breezeless;
|
|
316
|
+
screen_display;
|
|
317
|
+
fresh_air_1;
|
|
318
|
+
fresh_air_2;
|
|
319
|
+
self_clean;
|
|
320
|
+
rate_select;
|
|
321
|
+
ion;
|
|
322
|
+
constructor(device_protocol_version) {
|
|
323
|
+
super(device_protocol_version, MessageType.SET, 0xb0);
|
|
324
|
+
}
|
|
325
|
+
get _body() {
|
|
326
|
+
let pack_count = 0;
|
|
327
|
+
let payload = Buffer.from([0x00]);
|
|
328
|
+
if (this.wind_swing_ud_angle !== undefined) {
|
|
329
|
+
pack_count += 1;
|
|
330
|
+
payload = Buffer.concat([
|
|
331
|
+
payload,
|
|
332
|
+
NewProtocolMessageBody.packet(NewProtocolTags.WIND_SWING_UD_ANGLE, Buffer.from([this.wind_swing_ud_angle])),
|
|
333
|
+
]);
|
|
334
|
+
}
|
|
335
|
+
if (this.wind_swing_lr_angle !== undefined) {
|
|
336
|
+
pack_count += 1;
|
|
337
|
+
payload = Buffer.concat([
|
|
338
|
+
payload,
|
|
339
|
+
NewProtocolMessageBody.packet(NewProtocolTags.WIND_SWING_LR_ANGLE, Buffer.from([this.wind_swing_lr_angle])),
|
|
340
|
+
]);
|
|
341
|
+
}
|
|
342
|
+
if (this.breezeless !== undefined) {
|
|
343
|
+
pack_count += 1;
|
|
344
|
+
payload = Buffer.concat([
|
|
345
|
+
payload,
|
|
346
|
+
NewProtocolMessageBody.packet(NewProtocolTags.BREEZELESS, Buffer.from([this.breezeless ? 0x01 : 0x00])),
|
|
347
|
+
]);
|
|
348
|
+
}
|
|
349
|
+
if (this.indirect_wind !== undefined) {
|
|
350
|
+
pack_count += 1;
|
|
351
|
+
payload = Buffer.concat([
|
|
352
|
+
payload,
|
|
353
|
+
NewProtocolMessageBody.packet(NewProtocolTags.INDIRECT_WIND, Buffer.from([this.indirect_wind ? 0x02 : 0x01])),
|
|
354
|
+
]);
|
|
355
|
+
}
|
|
356
|
+
if (this.screen_display !== undefined) {
|
|
357
|
+
pack_count += 1;
|
|
358
|
+
payload = Buffer.concat([
|
|
359
|
+
payload,
|
|
360
|
+
NewProtocolMessageBody.packet(NewProtocolTags.SCREEN_DISPLAY, Buffer.from([this.screen_display ? 0x64 : 0x00])),
|
|
361
|
+
]);
|
|
362
|
+
}
|
|
363
|
+
if (this.fresh_air_1 !== undefined && this.fresh_air_1.length === 2) {
|
|
364
|
+
pack_count += 1;
|
|
365
|
+
const fresh_air_power = this.fresh_air_1[0] > 0 ? 2 : 1;
|
|
366
|
+
const fresh_air_fan_speed = this.fresh_air_1[1];
|
|
367
|
+
payload = Buffer.concat([
|
|
368
|
+
payload,
|
|
369
|
+
NewProtocolMessageBody.packet(NewProtocolTags.FRESH_AIR_1, Buffer.from([fresh_air_power, fresh_air_fan_speed, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])),
|
|
370
|
+
]);
|
|
371
|
+
}
|
|
372
|
+
if (this.fresh_air_2 !== undefined && this.fresh_air_2.length === 2) {
|
|
373
|
+
pack_count += 1;
|
|
374
|
+
const fresh_air_power = this.fresh_air_2[0] > 0 ? 1 : 0;
|
|
375
|
+
const fresh_air_fan_speed = this.fresh_air_2[1];
|
|
376
|
+
payload = Buffer.concat([
|
|
377
|
+
payload,
|
|
378
|
+
NewProtocolMessageBody.packet(NewProtocolTags.FRESH_AIR_2, Buffer.from([fresh_air_power, fresh_air_fan_speed, 0xff])),
|
|
379
|
+
]);
|
|
380
|
+
}
|
|
381
|
+
if (this.self_clean !== undefined) {
|
|
382
|
+
pack_count += 1;
|
|
383
|
+
payload = Buffer.concat([
|
|
384
|
+
payload,
|
|
385
|
+
NewProtocolMessageBody.packet(NewProtocolTags.SELF_CLEAN, Buffer.from([this.self_clean ? 0x01 : 0x00])),
|
|
386
|
+
]);
|
|
387
|
+
}
|
|
388
|
+
if (this.rate_select !== undefined) {
|
|
389
|
+
pack_count += 1;
|
|
390
|
+
payload = Buffer.concat([payload, NewProtocolMessageBody.packet(NewProtocolTags.RATE_SELECT, Buffer.from([this.rate_select]))]);
|
|
391
|
+
}
|
|
392
|
+
if (this.ion !== undefined) {
|
|
393
|
+
pack_count += 1;
|
|
394
|
+
payload = Buffer.concat([payload, NewProtocolMessageBody.packet(NewProtocolTags.ION, Buffer.from([this.ion ? 0x01 : 0x00]))]);
|
|
395
|
+
}
|
|
396
|
+
pack_count += 1;
|
|
397
|
+
payload = Buffer.concat([
|
|
398
|
+
payload,
|
|
399
|
+
NewProtocolMessageBody.packet(NewProtocolTags.PROMPT_TONE, Buffer.from([this.prompt_tone ? 0x01 : 0x00])),
|
|
400
|
+
]);
|
|
401
|
+
payload[0] = pack_count;
|
|
402
|
+
return payload;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
class XA0MessageBody extends MessageBody {
|
|
406
|
+
power;
|
|
407
|
+
target_temperature;
|
|
408
|
+
mode;
|
|
409
|
+
fan_speed;
|
|
410
|
+
fan_auto;
|
|
411
|
+
swing_vertical;
|
|
412
|
+
swing_horizontal;
|
|
413
|
+
boost_mode;
|
|
414
|
+
smart_eye;
|
|
415
|
+
dry;
|
|
416
|
+
aux_heating;
|
|
417
|
+
eco_mode;
|
|
418
|
+
sleep_mode;
|
|
419
|
+
natural_wind;
|
|
420
|
+
full_dust;
|
|
421
|
+
comfort_mode;
|
|
422
|
+
constructor(body) {
|
|
423
|
+
super(body);
|
|
424
|
+
this.power = (body[1] & 0x1) > 0;
|
|
425
|
+
this.target_temperature = ((body[1] & 0x3e) >> 1) - 4 + 16.0 + ((body[1] & 0x40) > 0 ? 0.5 : 0.0);
|
|
426
|
+
this.mode = (body[2] & 0xe0) >> 5;
|
|
427
|
+
this.fan_speed = body[3] & 0x7f;
|
|
428
|
+
this.fan_auto = this.fan_speed > 100;
|
|
429
|
+
this.swing_vertical = (body[7] & 0xc) > 0;
|
|
430
|
+
this.swing_horizontal = (body[7] & 0x3) > 0;
|
|
431
|
+
this.boost_mode = (body[8] & 0x20) > 0 || (body[10] & 0x2) > 0;
|
|
432
|
+
this.smart_eye = (body[9] & 0x01) > 0;
|
|
433
|
+
this.dry = (body[9] & 0x04) > 0;
|
|
434
|
+
this.aux_heating = (body[9] & 0x08) > 0;
|
|
435
|
+
this.eco_mode = (body[9] & 0x10) > 0;
|
|
436
|
+
this.sleep_mode = (body[10] & 0x01) > 0;
|
|
437
|
+
this.natural_wind = (body[10] & 0x40) > 0;
|
|
438
|
+
this.full_dust = (body[13] & 0x20) > 0;
|
|
439
|
+
this.comfort_mode = body.length > 16 ? (body[14] & 0x1) > 0 : false;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
class XA1MessageBody extends MessageBody {
|
|
443
|
+
indoor_temperature;
|
|
444
|
+
outdoor_temperature;
|
|
445
|
+
indoor_humidity;
|
|
446
|
+
constructor(body) {
|
|
447
|
+
super(body);
|
|
448
|
+
if (body[13] !== 0xff) {
|
|
449
|
+
const temp_integer = ((body[13] - 50) / 2) | 0;
|
|
450
|
+
const temp_decimal = body.length > 20 ? (body[18] & 0xf) * 0.1 : 0;
|
|
451
|
+
if (body[13] > 49) {
|
|
452
|
+
this.indoor_temperature = temp_integer + temp_decimal;
|
|
453
|
+
}
|
|
454
|
+
else {
|
|
455
|
+
this.indoor_temperature = temp_integer - temp_decimal;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
if (body[14] === 0xff) {
|
|
459
|
+
this.outdoor_temperature = undefined;
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
const temp_integer = ((body[14] - 50) / 2) | 0;
|
|
463
|
+
const temp_decimal = body.length > 20 ? ((body[18] & 0xf0) >> 4) * 0.1 : 0;
|
|
464
|
+
if (body[14] > 49) {
|
|
465
|
+
this.outdoor_temperature = temp_integer + temp_decimal;
|
|
466
|
+
}
|
|
467
|
+
else {
|
|
468
|
+
this.outdoor_temperature = temp_integer - temp_decimal;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
this.indoor_humidity = body[17];
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
class XBXMessageBody extends NewProtocolMessageBody {
|
|
475
|
+
wind_swing_lr_angle;
|
|
476
|
+
wind_swing_ud_angle;
|
|
477
|
+
indirect_wind;
|
|
478
|
+
indoor_humidity;
|
|
479
|
+
breezeless;
|
|
480
|
+
screen_display;
|
|
481
|
+
screen_display_new;
|
|
482
|
+
fresh_air_1;
|
|
483
|
+
fresh_air_2;
|
|
484
|
+
fresh_air_power;
|
|
485
|
+
fresh_air_fan_speed;
|
|
486
|
+
self_clean;
|
|
487
|
+
rate_select; // 50% 75% 100%
|
|
488
|
+
ion;
|
|
489
|
+
constructor(body, body_type) {
|
|
490
|
+
super(body, body_type);
|
|
491
|
+
const params = this.parse();
|
|
492
|
+
if (NewProtocolTags.WIND_SWING_LR_ANGLE in params) {
|
|
493
|
+
this.wind_swing_lr_angle = params[NewProtocolTags.WIND_SWING_LR_ANGLE][0];
|
|
494
|
+
}
|
|
495
|
+
if (NewProtocolTags.WIND_SWING_UD_ANGLE in params) {
|
|
496
|
+
this.wind_swing_ud_angle = params[NewProtocolTags.WIND_SWING_UD_ANGLE][0];
|
|
497
|
+
}
|
|
498
|
+
if (NewProtocolTags.INDIRECT_WIND in params) {
|
|
499
|
+
this.indirect_wind = params[NewProtocolTags.INDIRECT_WIND][0] === 0x02;
|
|
500
|
+
}
|
|
501
|
+
if (NewProtocolTags.INDOOR_HUMIDITY in params) {
|
|
502
|
+
this.indoor_humidity = params[NewProtocolTags.INDOOR_HUMIDITY][0];
|
|
503
|
+
}
|
|
504
|
+
if (NewProtocolTags.BREEZELESS in params) {
|
|
505
|
+
this.breezeless = params[NewProtocolTags.BREEZELESS][0] === 1;
|
|
506
|
+
}
|
|
507
|
+
if (NewProtocolTags.SCREEN_DISPLAY in params) {
|
|
508
|
+
this.screen_display = params[NewProtocolTags.SCREEN_DISPLAY][0] > 0;
|
|
509
|
+
this.screen_display_new = true;
|
|
510
|
+
}
|
|
511
|
+
if (NewProtocolTags.FRESH_AIR_1 in params) {
|
|
512
|
+
this.fresh_air_1 = true;
|
|
513
|
+
const data = params[NewProtocolTags.FRESH_AIR_1];
|
|
514
|
+
this.fresh_air_power = data[0] === 0x02;
|
|
515
|
+
this.fresh_air_fan_speed = data[1];
|
|
516
|
+
}
|
|
517
|
+
if (NewProtocolTags.FRESH_AIR_2 in params) {
|
|
518
|
+
this.fresh_air_2 = true;
|
|
519
|
+
const data = params[NewProtocolTags.FRESH_AIR_2];
|
|
520
|
+
this.fresh_air_power = data[0] > 0;
|
|
521
|
+
this.fresh_air_fan_speed = data[1];
|
|
522
|
+
}
|
|
523
|
+
if (NewProtocolTags.SELF_CLEAN in params) {
|
|
524
|
+
this.self_clean = params[NewProtocolTags.SELF_CLEAN][0] === 0x1;
|
|
525
|
+
}
|
|
526
|
+
if (NewProtocolTags.RATE_SELECT in params) {
|
|
527
|
+
this.rate_select = params[NewProtocolTags.RATE_SELECT][0];
|
|
528
|
+
}
|
|
529
|
+
if (NewProtocolTags.ION in params) {
|
|
530
|
+
this.ion = params[NewProtocolTags.ION][0] === 0x1;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
class XC0MessageBody extends MessageBody {
|
|
535
|
+
power;
|
|
536
|
+
mode;
|
|
537
|
+
target_temperature;
|
|
538
|
+
fan_speed;
|
|
539
|
+
fan_auto;
|
|
540
|
+
swing_vertical;
|
|
541
|
+
swing_horizontal;
|
|
542
|
+
boost_mode;
|
|
543
|
+
smart_eye;
|
|
544
|
+
natural_wind;
|
|
545
|
+
dry;
|
|
546
|
+
eco_mode;
|
|
547
|
+
aux_heating;
|
|
548
|
+
temp_fahrenheit;
|
|
549
|
+
sleep_mode;
|
|
550
|
+
indoor_temperature;
|
|
551
|
+
outdoor_temperature;
|
|
552
|
+
full_dust;
|
|
553
|
+
screen_display;
|
|
554
|
+
frost_protect;
|
|
555
|
+
comfort_mode;
|
|
556
|
+
constructor(body) {
|
|
557
|
+
super(body);
|
|
558
|
+
this.power = (body[1] & 0x1) > 0;
|
|
559
|
+
this.mode = (body[2] & 0xe0) >> 5;
|
|
560
|
+
this.target_temperature = (body[2] & 0x0f) + 16.0 + ((body[2] & 0x10) > 0 ? 0.5 : 0.0);
|
|
561
|
+
this.fan_speed = body[3] & 0x7f;
|
|
562
|
+
this.fan_auto = this.fan_speed > 100;
|
|
563
|
+
this.swing_vertical = (body[7] & 0x0c) > 0;
|
|
564
|
+
this.swing_horizontal = (body[7] & 0x03) > 0;
|
|
565
|
+
this.boost_mode = (body[8] & 0x20) > 0 || (body[10] & 0x2) > 0;
|
|
566
|
+
this.smart_eye = (body[8] & 0x40) > 0;
|
|
567
|
+
this.natural_wind = (body[9] & 0x2) > 0;
|
|
568
|
+
this.dry = (body[9] & 0x4) > 0;
|
|
569
|
+
this.eco_mode = (body[9] & 0x10) > 0;
|
|
570
|
+
this.aux_heating = (body[9] & 0x08) > 0;
|
|
571
|
+
this.temp_fahrenheit = (body[10] & 0x04) > 0;
|
|
572
|
+
this.sleep_mode = (body[10] & 0x01) > 0;
|
|
573
|
+
if (body[11] !== 0xff) {
|
|
574
|
+
const temp_integer = ((body[11] - 50) / 2) | 0;
|
|
575
|
+
const temp_decimal = (body[15] & 0x0f) * 0.1;
|
|
576
|
+
if (body[11] > 49) {
|
|
577
|
+
this.indoor_temperature = temp_integer + temp_decimal;
|
|
578
|
+
}
|
|
579
|
+
else {
|
|
580
|
+
this.indoor_temperature = temp_integer - temp_decimal;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
if (body[12] === 0xff) {
|
|
584
|
+
this.outdoor_temperature = undefined;
|
|
585
|
+
}
|
|
586
|
+
else {
|
|
587
|
+
const temp_integer = ((body[12] - 50) / 2) | 0;
|
|
588
|
+
const temp_decimal = ((body[15] & 0xf0) >> 4) * 0.1;
|
|
589
|
+
if (body[12] > 49) {
|
|
590
|
+
this.outdoor_temperature = temp_integer + temp_decimal;
|
|
591
|
+
}
|
|
592
|
+
else {
|
|
593
|
+
this.outdoor_temperature = temp_integer - temp_decimal;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
this.full_dust = (body[13] & 0x20) > 0;
|
|
597
|
+
this.screen_display = (body[14] & 0x70) >> 4 !== 0x07;
|
|
598
|
+
this.frost_protect = body.length > 23 ? (body[21] & 0x80) > 0 : false;
|
|
599
|
+
this.comfort_mode = body.length > 24 ? (body[22] & 0x1) > 0 : false;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
class XC1MessageBody extends MessageBody {
|
|
603
|
+
total_energy_consumption;
|
|
604
|
+
current_energy_consumption;
|
|
605
|
+
realtime_power;
|
|
606
|
+
constructor(body, analysis_method = 3) {
|
|
607
|
+
super(body);
|
|
608
|
+
if (body[3] === 0x44) {
|
|
609
|
+
this.total_energy_consumption = XC1MessageBody.parse_consumption(analysis_method, body[4], body[5], body[6], body[7]);
|
|
610
|
+
this.current_energy_consumption = XC1MessageBody.parse_consumption(analysis_method, body[12], body[13], body[14], body[15]);
|
|
611
|
+
this.realtime_power = XC1MessageBody.parse_power(analysis_method, body[16], body[17], body[18]);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
static parse_power(analysis_method, byte1, byte2, byte3) {
|
|
615
|
+
if (analysis_method === 1) {
|
|
616
|
+
return byte1 + byte2 / 100 + byte3 / 10000;
|
|
617
|
+
}
|
|
618
|
+
else if (analysis_method === 2) {
|
|
619
|
+
return ((byte1 << 16) + (byte2 << 8) + byte3) / 1000;
|
|
620
|
+
}
|
|
621
|
+
else {
|
|
622
|
+
return (byte1 * 10000 + byte2 * 100 + byte3) / 10;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
static parse_consumption(analysis_method, byte1, byte2, byte3, byte4) {
|
|
626
|
+
if (analysis_method === 1) {
|
|
627
|
+
return byte1 * 10000 + byte2 * 100 + byte3 + byte4 / 100;
|
|
628
|
+
}
|
|
629
|
+
else if (analysis_method === 2) {
|
|
630
|
+
return ((byte1 << 32) + (byte2 << 16) + (byte3 << 8) + byte4) / 1000;
|
|
631
|
+
}
|
|
632
|
+
else {
|
|
633
|
+
return (byte1 * 1000000 + byte2 * 10000 + byte3 * 100 + byte4) / 100;
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
class XBBMessageBody extends MessageBody {
|
|
638
|
+
power;
|
|
639
|
+
dry;
|
|
640
|
+
boost_mode;
|
|
641
|
+
aux_heating;
|
|
642
|
+
sleep_mode;
|
|
643
|
+
mode;
|
|
644
|
+
target_temperature;
|
|
645
|
+
fan_speed;
|
|
646
|
+
fan_auto;
|
|
647
|
+
timer;
|
|
648
|
+
eco_mode;
|
|
649
|
+
indoor_temperature;
|
|
650
|
+
indoor_humidity;
|
|
651
|
+
sn8_flag;
|
|
652
|
+
outdoor_temperature;
|
|
653
|
+
constructor(body) {
|
|
654
|
+
super(body);
|
|
655
|
+
const subprotocol_head = body.subarray(0, 6);
|
|
656
|
+
const subprotocol_body = body.subarray(6, body.length);
|
|
657
|
+
const data_type = subprotocol_head[subprotocol_head.length - 1];
|
|
658
|
+
const subprotocol_body_len = subprotocol_body.length;
|
|
659
|
+
if (data_type === 0x20 || data_type === 0x11) {
|
|
660
|
+
this.power = (subprotocol_body[0] & 0x1) > 0;
|
|
661
|
+
this.dry = (subprotocol_body[0] & 0x10) > 0;
|
|
662
|
+
this.boost_mode = (subprotocol_body[0] & 0x20) > 0;
|
|
663
|
+
this.aux_heating = (subprotocol_body[1] & 0x40) > 0;
|
|
664
|
+
this.sleep_mode = (subprotocol_body[2] & 0x80) > 0;
|
|
665
|
+
this.mode = BB_AC_MODES.indexOf(subprotocol_body[5] + 1);
|
|
666
|
+
if (this.mode === -1) {
|
|
667
|
+
this.mode = 0;
|
|
668
|
+
}
|
|
669
|
+
this.target_temperature = (subprotocol_body[6] - 30) / 2;
|
|
670
|
+
this.fan_speed = subprotocol_body[7];
|
|
671
|
+
this.fan_auto = this.fan_speed > 100;
|
|
672
|
+
this.timer = subprotocol_body_len > 27 ? (subprotocol_body[25] & 0x04) > 0 : false;
|
|
673
|
+
this.eco_mode = subprotocol_body_len > 27 ? (subprotocol_body[25] & 0x40) > 0 : false;
|
|
674
|
+
}
|
|
675
|
+
else if (data_type === 0x10) {
|
|
676
|
+
if ((subprotocol_body[8] & 0x80) === 0x80) {
|
|
677
|
+
this.indoor_temperature = ((0 - (~(subprotocol_body[7] + subprotocol_body[8] * 256) + 1)) & 0xffff) / 100;
|
|
678
|
+
}
|
|
679
|
+
else {
|
|
680
|
+
this.indoor_temperature = (subprotocol_body[7] + subprotocol_body[8] * 256) / 100;
|
|
681
|
+
}
|
|
682
|
+
this.indoor_humidity = subprotocol_body[30];
|
|
683
|
+
this.sn8_flag = subprotocol_body[80] === 0x31;
|
|
684
|
+
}
|
|
685
|
+
else if (data_type === 0x30) {
|
|
686
|
+
if ((subprotocol_body[6] & 0x80) === 0x80) {
|
|
687
|
+
this.outdoor_temperature = ((0 - (~(subprotocol_body[5] + subprotocol_body[6] * 256) + 1)) & 0xffff) / 100;
|
|
688
|
+
}
|
|
689
|
+
else {
|
|
690
|
+
this.outdoor_temperature = (subprotocol_body[5] + subprotocol_body[6] * 256) / 100;
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
export class MessageACResponse extends MessageResponse {
|
|
696
|
+
message;
|
|
697
|
+
used_subprotocol;
|
|
698
|
+
constructor(message, power_analysis_method = 3) {
|
|
699
|
+
super(message);
|
|
700
|
+
this.message = message;
|
|
701
|
+
if (this.message_type === MessageType.NOTIFY2 && this.body_type === 0xa0) {
|
|
702
|
+
this.set_body(new XA0MessageBody(this.body));
|
|
703
|
+
}
|
|
704
|
+
else if (this.message_type === MessageType.NOTIFY1 && this.body_type === 0xa1) {
|
|
705
|
+
this.set_body(new XA1MessageBody(this.body));
|
|
706
|
+
}
|
|
707
|
+
else if ([MessageType.QUERY, MessageType.SET, MessageType.NOTIFY2].includes(this.message_type) &&
|
|
708
|
+
[0xb0, 0xb1, 0xb5].includes(this.body_type)) {
|
|
709
|
+
this.set_body(new XBXMessageBody(this.body, this.body_type));
|
|
710
|
+
}
|
|
711
|
+
else if ([MessageType.QUERY, MessageType.SET].includes(this.message_type) && this.body_type === 0xc0) {
|
|
712
|
+
this.set_body(new XC0MessageBody(this.body));
|
|
713
|
+
}
|
|
714
|
+
else if (this.message_type === MessageType.QUERY && this.body_type === 0xc1) {
|
|
715
|
+
this.set_body(new XC1MessageBody(this.body, power_analysis_method));
|
|
716
|
+
}
|
|
717
|
+
else if ([MessageType.QUERY, MessageType.SET, MessageType.NOTIFY2].includes(this.message_type) &&
|
|
718
|
+
this.body_type === 0xbb &&
|
|
719
|
+
this.body.length >= 21) {
|
|
720
|
+
this.used_subprotocol = true;
|
|
721
|
+
this.set_body(new XBBMessageBody(this.body));
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
622
725
|
//# sourceMappingURL=MideaACMessage.js.map
|