homebridge-midea-platform 1.1.2-beta.3 → 1.1.2-beta.4

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.
Files changed (69) hide show
  1. package/.husky/pre-commit +0 -0
  2. package/dist/accessory/AccessoryFactory.d.ts +12 -12
  3. package/dist/accessory/AccessoryFactory.js +31 -31
  4. package/dist/accessory/AirConditionerAccessory.d.ts +86 -86
  5. package/dist/accessory/AirConditionerAccessory.js +560 -560
  6. package/dist/accessory/AirConditionerAccessory.js.map +1 -1
  7. package/dist/accessory/BaseAccessory.d.ts +11 -11
  8. package/dist/accessory/BaseAccessory.js +21 -21
  9. package/dist/accessory/DehumidifierAccessory.d.ts +45 -45
  10. package/dist/accessory/DehumidifierAccessory.js +344 -344
  11. package/dist/accessory/ElectricWaterHeaterAccessory.d.ts +44 -44
  12. package/dist/accessory/ElectricWaterHeaterAccessory.js +176 -176
  13. package/dist/accessory/FanAccessory.d.ts +39 -39
  14. package/dist/accessory/FanAccessory.js +123 -123
  15. package/dist/accessory/FrontLoadWasherAccessory.d.ts +30 -30
  16. package/dist/accessory/FrontLoadWasherAccessory.js +60 -60
  17. package/dist/accessory/GasWaterHeaterAccessory.d.ts +51 -51
  18. package/dist/accessory/GasWaterHeaterAccessory.js +216 -216
  19. package/dist/core/MideaCloud.d.ts +35 -35
  20. package/dist/core/MideaCloud.js +350 -350
  21. package/dist/core/MideaConstants.d.ts +49 -49
  22. package/dist/core/MideaConstants.js +57 -57
  23. package/dist/core/MideaDevice.d.ts +76 -76
  24. package/dist/core/MideaDevice.js +409 -409
  25. package/dist/core/MideaDiscover.d.ts +35 -35
  26. package/dist/core/MideaDiscover.js +212 -212
  27. package/dist/core/MideaMessage.d.ts +75 -75
  28. package/dist/core/MideaMessage.js +184 -184
  29. package/dist/core/MideaPacketBuilder.d.ts +10 -10
  30. package/dist/core/MideaPacketBuilder.js +60 -60
  31. package/dist/core/MideaSecurity.d.ts +63 -63
  32. package/dist/core/MideaSecurity.js +242 -242
  33. package/dist/core/MideaUtils.d.ts +32 -32
  34. package/dist/core/MideaUtils.js +181 -181
  35. package/dist/devices/DeviceFactory.d.ts +12 -12
  36. package/dist/devices/DeviceFactory.js +33 -33
  37. package/dist/devices/a1/MideaA1Device.d.ts +76 -76
  38. package/dist/devices/a1/MideaA1Device.js +136 -136
  39. package/dist/devices/a1/MideaA1Message.d.ts +40 -40
  40. package/dist/devices/a1/MideaA1Message.js +198 -198
  41. package/dist/devices/ac/MideaACDevice.d.ts +100 -100
  42. package/dist/devices/ac/MideaACDevice.js +370 -370
  43. package/dist/devices/ac/MideaACMessage.d.ts +92 -92
  44. package/dist/devices/ac/MideaACMessage.js +589 -589
  45. package/dist/devices/db/MideaDBDevice.d.ts +29 -29
  46. package/dist/devices/db/MideaDBDevice.js +88 -88
  47. package/dist/devices/db/MideaDBMessage.d.ts +32 -32
  48. package/dist/devices/db/MideaDBMessage.js +101 -101
  49. package/dist/devices/e2/MideaE2Device.d.ts +44 -44
  50. package/dist/devices/e2/MideaE2Device.js +119 -119
  51. package/dist/devices/e2/MideaE2Message.d.ts +33 -33
  52. package/dist/devices/e2/MideaE2Message.js +132 -132
  53. package/dist/devices/e3/MideaE3Device.d.ts +43 -43
  54. package/dist/devices/e3/MideaE3Device.js +125 -125
  55. package/dist/devices/e3/MideaE3Message.d.ts +51 -51
  56. package/dist/devices/e3/MideaE3Message.js +136 -136
  57. package/dist/devices/fa/MideaFADevice.d.ts +36 -36
  58. package/dist/devices/fa/MideaFADevice.js +92 -92
  59. package/dist/devices/fa/MideaFAMessage.d.ts +38 -38
  60. package/dist/devices/fa/MideaFAMessage.js +98 -98
  61. package/dist/index.d.ts +6 -6
  62. package/dist/index.js +6 -6
  63. package/dist/platform.d.ts +60 -60
  64. package/dist/platform.js +213 -213
  65. package/dist/platformUtils.d.ts +98 -98
  66. package/dist/platformUtils.js +96 -96
  67. package/dist/settings.d.ts +8 -8
  68. package/dist/settings.js +11 -11
  69. package/package.json +1 -1
@@ -1,199 +1,199 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MessageA1Response = exports.MessageNewProtocolSet = exports.MessageSet = exports.MessageNewProtocolQuery = exports.MessageQuery = void 0;
4
- /***********************************************************************
5
- * Midea Dehumidifier Device message handler class
6
- *
7
- * Copyright (c) 2023 David Kerr, https://github.com/dkerr64
8
- *
9
- * With thanks to https://github.com/kovapatrik/homebridge-midea-platform
10
- * And https://github.com/georgezhao2010/midea_ac_lan
11
- *
12
- */
13
- const MideaConstants_1 = require("../../core/MideaConstants");
14
- const MideaMessage_1 = require("../../core/MideaMessage");
15
- const MideaUtils_1 = require("../../core/MideaUtils");
16
- var NewProtocolTags;
17
- (function (NewProtocolTags) {
18
- NewProtocolTags[NewProtocolTags["LIGHT"] = 91] = "LIGHT";
19
- })(NewProtocolTags || (NewProtocolTags = {}));
20
- class MessageA1Base extends MideaMessage_1.MessageRequest {
21
- constructor(device_protocol_version, message_type, body_type) {
22
- super(MideaConstants_1.DeviceType.DEHUMIDIFIER, message_type, body_type, device_protocol_version);
23
- MessageA1Base.message_serial += 1;
24
- // I don't know why dehumidifier wraps at 100, air conditioner wraps at 254
25
- if (MessageA1Base.message_serial >= 100) {
26
- MessageA1Base.message_serial = 1;
27
- }
28
- this.message_id = MessageA1Base.message_serial;
29
- }
30
- get body() {
31
- let body = Buffer.concat([Buffer.from([this.body_type]), this._body, Buffer.from([this.message_id])]);
32
- body = Buffer.concat([body, Buffer.from([(0, MideaUtils_1.calculate)(body)])]);
33
- return body;
34
- }
35
- }
36
- MessageA1Base.message_serial = 0;
37
- class MessageQuery extends MessageA1Base {
38
- constructor(device_protocol_version) {
39
- super(device_protocol_version, MideaMessage_1.MessageType.QUERY, 0x41);
40
- }
41
- get _body() {
42
- return Buffer.from([0x81, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
43
- }
44
- }
45
- exports.MessageQuery = MessageQuery;
46
- class MessageNewProtocolQuery extends MessageA1Base {
47
- constructor(device_protocol_version, alternate_display = false) {
48
- super(device_protocol_version, MideaMessage_1.MessageType.QUERY, 0xb1);
49
- this.alternate_display = alternate_display;
50
- }
51
- get _body() {
52
- const query_params = [NewProtocolTags.LIGHT];
53
- let body = Buffer.from([query_params.length]);
54
- for (const param of query_params) {
55
- if (param) {
56
- body = Buffer.concat([body, Buffer.from([param & 0xff, param >> 8])]);
57
- }
58
- }
59
- return body;
60
- }
61
- }
62
- exports.MessageNewProtocolQuery = MessageNewProtocolQuery;
63
- class MessageSet extends MessageA1Base {
64
- constructor(device_protocol_version) {
65
- super(device_protocol_version, MideaMessage_1.MessageType.SET, 0x48);
66
- this.power = false;
67
- this.prompt_tone = true;
68
- this.mode = 1;
69
- this.fan_speed = 40;
70
- this.child_lock = false;
71
- this.target_humidity = 40;
72
- this.swing = false;
73
- this.anion = false;
74
- this.water_level_set = 50;
75
- }
76
- get _body() {
77
- // byte1, power, prompt_tone
78
- const power = this.power ? 0x01 : 0x00;
79
- const prompt_tone = this.prompt_tone ? 0x40 : 0x00;
80
- // byte2 mode
81
- const mode = this.mode;
82
- // byte3 fan_speed
83
- const fan_speed = this.fan_speed;
84
- // byte7 target_humidity
85
- const target_humidity = this.target_humidity;
86
- // byte8 child_lock
87
- const child_lock = this.child_lock ? 0x80 : 0x00;
88
- // byte9 anion
89
- const anion = this.anion ? 0x40 : 0x00;
90
- // byte10 swing
91
- const swing = this.swing ? 0x08 : 0x00;
92
- // byte 13 water_level_set
93
- const water_level_set = this.water_level_set;
94
- return Buffer.from([
95
- power | prompt_tone | 0x02,
96
- mode,
97
- fan_speed,
98
- 0x00,
99
- 0x00,
100
- 0x00,
101
- target_humidity,
102
- child_lock,
103
- anion,
104
- swing,
105
- 0x00,
106
- 0x00,
107
- water_level_set,
108
- 0x00,
109
- 0x00,
110
- 0x00,
111
- 0x00,
112
- 0x00,
113
- 0x00,
114
- 0x00,
115
- ]);
116
- }
117
- }
118
- exports.MessageSet = MessageSet;
119
- class MessageNewProtocolSet extends MessageA1Base {
120
- constructor(device_protocol_version) {
121
- super(device_protocol_version, MideaMessage_1.MessageType.SET, 0xb0);
122
- this.light = false;
123
- }
124
- get _body() {
125
- let pack_count = 0;
126
- let payload = Buffer.from([0x00]);
127
- if (this.light !== undefined) {
128
- pack_count += 1;
129
- payload = Buffer.concat([
130
- payload,
131
- // original python code at:
132
- // https://github.com/georgezhao2010/midea_ac_lan/blob/master/custom_components/midea_ac_lan/midea/devices/a1/message.py
133
- // used "NewProtocolTags.INDIRECT_WIND" but that is/was not defined so assumed to be a bug and should be LIGHT
134
- MideaMessage_1.NewProtocolMessageBody.packet(NewProtocolTags.LIGHT, Buffer.from([this.light ? 0x01 : 0x00])),
135
- ]);
136
- }
137
- payload[0] = pack_count;
138
- return payload;
139
- }
140
- }
141
- exports.MessageNewProtocolSet = MessageNewProtocolSet;
142
- class A1GeneralMessageBody extends MideaMessage_1.MessageBody {
143
- constructor(body) {
144
- super(body);
145
- this.power = (body[1] & 0x01) > 0;
146
- this.mode = body[2] & 0x0f;
147
- this.fan_speed = body[3] & 0x7f;
148
- // Target humidity between 35% and 85%
149
- this.target_humidity = body[7] < 35 ? 35 : body[7] > 85 ? 85 : body[7];
150
- this.child_lock = (body[8] & 0x80) > 0;
151
- this.filter_indicator = (body[9] & 0x80) > 0;
152
- this.anion = (body[9] & 0x40) > 0;
153
- this.sleep_mode = (body[9] & 0x20) > 0;
154
- this.pump_switch_flag = (body[9] & 0x10) > 0;
155
- this.pump = (body[9] & 0x08) > 0;
156
- this.defrosting = (body[10] & 0x80) > 0;
157
- this.tank_level = body[10] & 0x7f;
158
- this.tank_full = this.tank_level >= 100;
159
- this.water_level_set = body[15];
160
- this.current_humidity = body[16];
161
- this.current_temperature = (body[17] - 50) / 2;
162
- // vertical swing or horizontal swing
163
- this.swing = (body[19] & 0x20) > 0 || (body[19] & 0x10) > 0;
164
- // Not sure the purpose of thisfan speed check, but it is part of the original python code at
165
- // https://github.com/georgezhao2010/midea_ac_lan/blob/master/custom_components/midea_ac_lan/midea/devices/a1/message.py
166
- if (this.fan_speed < 5) {
167
- this.fan_speed = 1;
168
- }
169
- }
170
- }
171
- class A1NewProtocolMessageBody extends MideaMessage_1.NewProtocolMessageBody {
172
- constructor(body, body_type) {
173
- super(body, body_type);
174
- this.light = false;
175
- const params = this.parse();
176
- if (NewProtocolTags.LIGHT in params) {
177
- this.light = params[NewProtocolTags.LIGHT][0] > 0;
178
- }
179
- }
180
- }
181
- class MessageA1Response extends MideaMessage_1.MessageResponse {
182
- constructor(message) {
183
- super(message);
184
- this.message = message;
185
- if ([MideaMessage_1.MessageType.QUERY, MideaMessage_1.MessageType.SET, MideaMessage_1.MessageType.NOTIFY2].includes(this.message_type)) {
186
- if ([0xb0, 0xb1, 0xb5].includes(this.body_type)) {
187
- this.set_body(new A1NewProtocolMessageBody(this.body, this.body_type));
188
- }
189
- else {
190
- this.set_body(new A1GeneralMessageBody(this.body));
191
- }
192
- }
193
- else if (this.message_type === MideaMessage_1.MessageType.NOTIFY2 && this.body_type === 0xa0) {
194
- this.set_body(new A1GeneralMessageBody(this.body));
195
- }
196
- }
197
- }
198
- exports.MessageA1Response = MessageA1Response;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MessageA1Response = exports.MessageNewProtocolSet = exports.MessageSet = exports.MessageNewProtocolQuery = exports.MessageQuery = void 0;
4
+ /***********************************************************************
5
+ * Midea Dehumidifier Device message handler class
6
+ *
7
+ * Copyright (c) 2023 David Kerr, https://github.com/dkerr64
8
+ *
9
+ * With thanks to https://github.com/kovapatrik/homebridge-midea-platform
10
+ * And https://github.com/georgezhao2010/midea_ac_lan
11
+ *
12
+ */
13
+ const MideaConstants_1 = require("../../core/MideaConstants");
14
+ const MideaMessage_1 = require("../../core/MideaMessage");
15
+ const MideaUtils_1 = require("../../core/MideaUtils");
16
+ var NewProtocolTags;
17
+ (function (NewProtocolTags) {
18
+ NewProtocolTags[NewProtocolTags["LIGHT"] = 91] = "LIGHT";
19
+ })(NewProtocolTags || (NewProtocolTags = {}));
20
+ class MessageA1Base extends MideaMessage_1.MessageRequest {
21
+ constructor(device_protocol_version, message_type, body_type) {
22
+ super(MideaConstants_1.DeviceType.DEHUMIDIFIER, message_type, body_type, device_protocol_version);
23
+ MessageA1Base.message_serial += 1;
24
+ // I don't know why dehumidifier wraps at 100, air conditioner wraps at 254
25
+ if (MessageA1Base.message_serial >= 100) {
26
+ MessageA1Base.message_serial = 1;
27
+ }
28
+ this.message_id = MessageA1Base.message_serial;
29
+ }
30
+ get body() {
31
+ let body = Buffer.concat([Buffer.from([this.body_type]), this._body, Buffer.from([this.message_id])]);
32
+ body = Buffer.concat([body, Buffer.from([(0, MideaUtils_1.calculate)(body)])]);
33
+ return body;
34
+ }
35
+ }
36
+ MessageA1Base.message_serial = 0;
37
+ class MessageQuery extends MessageA1Base {
38
+ constructor(device_protocol_version) {
39
+ super(device_protocol_version, MideaMessage_1.MessageType.QUERY, 0x41);
40
+ }
41
+ get _body() {
42
+ return Buffer.from([0x81, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
43
+ }
44
+ }
45
+ exports.MessageQuery = MessageQuery;
46
+ class MessageNewProtocolQuery extends MessageA1Base {
47
+ constructor(device_protocol_version, alternate_display = false) {
48
+ super(device_protocol_version, MideaMessage_1.MessageType.QUERY, 0xb1);
49
+ this.alternate_display = alternate_display;
50
+ }
51
+ get _body() {
52
+ const query_params = [NewProtocolTags.LIGHT];
53
+ let body = Buffer.from([query_params.length]);
54
+ for (const param of query_params) {
55
+ if (param) {
56
+ body = Buffer.concat([body, Buffer.from([param & 0xff, param >> 8])]);
57
+ }
58
+ }
59
+ return body;
60
+ }
61
+ }
62
+ exports.MessageNewProtocolQuery = MessageNewProtocolQuery;
63
+ class MessageSet extends MessageA1Base {
64
+ constructor(device_protocol_version) {
65
+ super(device_protocol_version, MideaMessage_1.MessageType.SET, 0x48);
66
+ this.power = false;
67
+ this.prompt_tone = true;
68
+ this.mode = 1;
69
+ this.fan_speed = 40;
70
+ this.child_lock = false;
71
+ this.target_humidity = 40;
72
+ this.swing = false;
73
+ this.anion = false;
74
+ this.water_level_set = 50;
75
+ }
76
+ get _body() {
77
+ // byte1, power, prompt_tone
78
+ const power = this.power ? 0x01 : 0x00;
79
+ const prompt_tone = this.prompt_tone ? 0x40 : 0x00;
80
+ // byte2 mode
81
+ const mode = this.mode;
82
+ // byte3 fan_speed
83
+ const fan_speed = this.fan_speed;
84
+ // byte7 target_humidity
85
+ const target_humidity = this.target_humidity;
86
+ // byte8 child_lock
87
+ const child_lock = this.child_lock ? 0x80 : 0x00;
88
+ // byte9 anion
89
+ const anion = this.anion ? 0x40 : 0x00;
90
+ // byte10 swing
91
+ const swing = this.swing ? 0x08 : 0x00;
92
+ // byte 13 water_level_set
93
+ const water_level_set = this.water_level_set;
94
+ return Buffer.from([
95
+ power | prompt_tone | 0x02,
96
+ mode,
97
+ fan_speed,
98
+ 0x00,
99
+ 0x00,
100
+ 0x00,
101
+ target_humidity,
102
+ child_lock,
103
+ anion,
104
+ swing,
105
+ 0x00,
106
+ 0x00,
107
+ water_level_set,
108
+ 0x00,
109
+ 0x00,
110
+ 0x00,
111
+ 0x00,
112
+ 0x00,
113
+ 0x00,
114
+ 0x00,
115
+ ]);
116
+ }
117
+ }
118
+ exports.MessageSet = MessageSet;
119
+ class MessageNewProtocolSet extends MessageA1Base {
120
+ constructor(device_protocol_version) {
121
+ super(device_protocol_version, MideaMessage_1.MessageType.SET, 0xb0);
122
+ this.light = false;
123
+ }
124
+ get _body() {
125
+ let pack_count = 0;
126
+ let payload = Buffer.from([0x00]);
127
+ if (this.light !== undefined) {
128
+ pack_count += 1;
129
+ payload = Buffer.concat([
130
+ payload,
131
+ // original python code at:
132
+ // https://github.com/georgezhao2010/midea_ac_lan/blob/master/custom_components/midea_ac_lan/midea/devices/a1/message.py
133
+ // used "NewProtocolTags.INDIRECT_WIND" but that is/was not defined so assumed to be a bug and should be LIGHT
134
+ MideaMessage_1.NewProtocolMessageBody.packet(NewProtocolTags.LIGHT, Buffer.from([this.light ? 0x01 : 0x00])),
135
+ ]);
136
+ }
137
+ payload[0] = pack_count;
138
+ return payload;
139
+ }
140
+ }
141
+ exports.MessageNewProtocolSet = MessageNewProtocolSet;
142
+ class A1GeneralMessageBody extends MideaMessage_1.MessageBody {
143
+ constructor(body) {
144
+ super(body);
145
+ this.power = (body[1] & 0x01) > 0;
146
+ this.mode = body[2] & 0x0f;
147
+ this.fan_speed = body[3] & 0x7f;
148
+ // Target humidity between 35% and 85%
149
+ this.target_humidity = body[7] < 35 ? 35 : body[7] > 85 ? 85 : body[7];
150
+ this.child_lock = (body[8] & 0x80) > 0;
151
+ this.filter_indicator = (body[9] & 0x80) > 0;
152
+ this.anion = (body[9] & 0x40) > 0;
153
+ this.sleep_mode = (body[9] & 0x20) > 0;
154
+ this.pump_switch_flag = (body[9] & 0x10) > 0;
155
+ this.pump = (body[9] & 0x08) > 0;
156
+ this.defrosting = (body[10] & 0x80) > 0;
157
+ this.tank_level = body[10] & 0x7f;
158
+ this.tank_full = this.tank_level >= 100;
159
+ this.water_level_set = body[15];
160
+ this.current_humidity = body[16];
161
+ this.current_temperature = (body[17] - 50) / 2;
162
+ // vertical swing or horizontal swing
163
+ this.swing = (body[19] & 0x20) > 0 || (body[19] & 0x10) > 0;
164
+ // Not sure the purpose of thisfan speed check, but it is part of the original python code at
165
+ // https://github.com/georgezhao2010/midea_ac_lan/blob/master/custom_components/midea_ac_lan/midea/devices/a1/message.py
166
+ if (this.fan_speed < 5) {
167
+ this.fan_speed = 1;
168
+ }
169
+ }
170
+ }
171
+ class A1NewProtocolMessageBody extends MideaMessage_1.NewProtocolMessageBody {
172
+ constructor(body, body_type) {
173
+ super(body, body_type);
174
+ this.light = false;
175
+ const params = this.parse();
176
+ if (NewProtocolTags.LIGHT in params) {
177
+ this.light = params[NewProtocolTags.LIGHT][0] > 0;
178
+ }
179
+ }
180
+ }
181
+ class MessageA1Response extends MideaMessage_1.MessageResponse {
182
+ constructor(message) {
183
+ super(message);
184
+ this.message = message;
185
+ if ([MideaMessage_1.MessageType.QUERY, MideaMessage_1.MessageType.SET, MideaMessage_1.MessageType.NOTIFY2].includes(this.message_type)) {
186
+ if ([0xb0, 0xb1, 0xb5].includes(this.body_type)) {
187
+ this.set_body(new A1NewProtocolMessageBody(this.body, this.body_type));
188
+ }
189
+ else {
190
+ this.set_body(new A1GeneralMessageBody(this.body));
191
+ }
192
+ }
193
+ else if (this.message_type === MideaMessage_1.MessageType.NOTIFY2 && this.body_type === 0xa0) {
194
+ this.set_body(new A1GeneralMessageBody(this.body));
195
+ }
196
+ }
197
+ }
198
+ exports.MessageA1Response = MessageA1Response;
199
199
  //# sourceMappingURL=MideaA1Message.js.map
@@ -1,101 +1,101 @@
1
- /// <reference types="node" />
2
- /***********************************************************************
3
- * Midea Air Conditioner Device class
4
- *
5
- * Copyright (c) 2023 Kovalovszky Patrik, https://github.com/kovapatrik
6
- *
7
- * With thanks to https://github.com/georgezhao2010/midea_ac_lan
8
- *
9
- */
10
- import { Logger } from 'homebridge';
11
- import { DeviceInfo } from '../../core/MideaConstants';
12
- import MideaDevice, { DeviceAttributeBase } from '../../core/MideaDevice';
13
- import { MessageGeneralSet, MessageNewProtocolQuery, MessagePowerQuery, MessageQuery, MessageSubProtocolSet } from './MideaACMessage';
14
- import { Config, DeviceConfig, SwingAngle } from '../../platformUtils';
15
- export interface ACAttributes extends DeviceAttributeBase {
16
- PROMPT_TONE: boolean;
17
- POWER: boolean | undefined;
18
- MODE: number;
19
- TARGET_TEMPERATURE: number;
20
- FAN_SPEED: number;
21
- FAN_AUTO: boolean;
22
- SWING_VERTICAL: boolean | undefined;
23
- WIND_SWING_UD_ANGLE: number;
24
- SWING_HORIZONTAL: boolean | undefined;
25
- WIND_SWING_LR_ANGLE: number;
26
- SMART_EYE: boolean;
27
- DRY: boolean;
28
- AUX_HEATING: boolean;
29
- BOOST_MODE: boolean;
30
- SLEEP_MODE: boolean;
31
- FROST_PROTECT: boolean;
32
- COMFORT_MODE: boolean;
33
- ECO_MODE: boolean;
34
- NATURAL_WIND: boolean;
35
- TEMP_FAHRENHEIT: boolean;
36
- SCREEN_DISPLAY: boolean | undefined;
37
- SCREEN_DISPLAY_NEW: boolean;
38
- FULL_DUST: boolean;
39
- INDOOR_TEMPERATURE?: number;
40
- OUTDOOR_TEMPERATURE?: number;
41
- INDIRECT_WIND: boolean;
42
- INDOOR_HUMIDITY: number | undefined;
43
- BREEZELESS: boolean;
44
- TOTAL_ENERGY_CONSUMPTION?: number;
45
- CURRENT_ENERGY_CONSUMPTION?: number;
46
- REALTIME_POWER: number;
47
- FRESH_AIR_POWER: boolean;
48
- FRESH_AIR_FAN_SPEED: number;
49
- FRESH_AIR_MODE?: string;
50
- FRESH_AIR_1: boolean;
51
- FRESH_AIR_2: boolean;
52
- }
53
- export default class MideaACDevice extends MideaDevice {
54
- readonly FRESH_AIR_FAN_SPEEDS: {
55
- 0: string;
56
- 20: string;
57
- 40: string;
58
- 60: string;
59
- 80: string;
60
- 100: string;
61
- };
62
- readonly FRESH_AIR_FAN_SPEEDS_REVERSE: {
63
- 100: string;
64
- 80: string;
65
- 60: string;
66
- 40: string;
67
- 20: string;
68
- 0: string;
69
- };
70
- attributes: ACAttributes;
71
- private fresh_air_version?;
72
- private used_subprotocol;
73
- private bb_sn8_flag;
74
- private bb_timer;
75
- private readonly DEFAULT_POWER_ANALYSIS_METHOD;
76
- private power_analysis_method?;
77
- private alternate_switch_display;
78
- private last_fan_speed;
79
- private defaultFahrenheit;
80
- private defaultScreenOff;
81
- /*********************************************************************
82
- * Constructor initializes all the attributes. We set some to invalid
83
- * values so that they are detected as "changed" on the first status
84
- * refresh... and passed back to the Homebridge/HomeKit accessory callback
85
- * function to set their initial values.
86
- */
87
- constructor(logger: Logger, device_info: DeviceInfo, config: Config, deviceConfig: DeviceConfig);
88
- build_query(): (MessageQuery | MessagePowerQuery | MessageNewProtocolQuery)[];
89
- process_message(msg: Buffer): void;
90
- make_message_set(): MessageGeneralSet;
91
- make_subprotocol_message_set(): MessageSubProtocolSet;
92
- make_message_unique_set(): MessageGeneralSet | MessageSubProtocolSet;
93
- set_attribute(attributes: Partial<ACAttributes>): Promise<void>;
94
- set_alternate_switch_display(value: boolean): void;
95
- set_target_temperature(target_temperature: number, mode?: number): Promise<void>;
96
- set_swing(swing_horizontal: boolean, swing_vertical: boolean): Promise<void>;
97
- set_fan_auto(fan_auto: boolean): Promise<void>;
98
- set_swing_angle(swing_direction: SwingAngle, swing_angle: number): Promise<void>;
99
- protected set_subtype(): void;
100
- }
1
+ /// <reference types="node" />
2
+ /***********************************************************************
3
+ * Midea Air Conditioner Device class
4
+ *
5
+ * Copyright (c) 2023 Kovalovszky Patrik, https://github.com/kovapatrik
6
+ *
7
+ * With thanks to https://github.com/georgezhao2010/midea_ac_lan
8
+ *
9
+ */
10
+ import { Logger } from 'homebridge';
11
+ import { DeviceInfo } from '../../core/MideaConstants';
12
+ import MideaDevice, { DeviceAttributeBase } from '../../core/MideaDevice';
13
+ import { MessageGeneralSet, MessageNewProtocolQuery, MessagePowerQuery, MessageQuery, MessageSubProtocolSet } from './MideaACMessage';
14
+ import { Config, DeviceConfig, SwingAngle } from '../../platformUtils';
15
+ export interface ACAttributes extends DeviceAttributeBase {
16
+ PROMPT_TONE: boolean;
17
+ POWER: boolean | undefined;
18
+ MODE: number;
19
+ TARGET_TEMPERATURE: number;
20
+ FAN_SPEED: number;
21
+ FAN_AUTO: boolean;
22
+ SWING_VERTICAL: boolean | undefined;
23
+ WIND_SWING_UD_ANGLE: number;
24
+ SWING_HORIZONTAL: boolean | undefined;
25
+ WIND_SWING_LR_ANGLE: number;
26
+ SMART_EYE: boolean;
27
+ DRY: boolean;
28
+ AUX_HEATING: boolean;
29
+ BOOST_MODE: boolean;
30
+ SLEEP_MODE: boolean;
31
+ FROST_PROTECT: boolean;
32
+ COMFORT_MODE: boolean;
33
+ ECO_MODE: boolean;
34
+ NATURAL_WIND: boolean;
35
+ TEMP_FAHRENHEIT: boolean;
36
+ SCREEN_DISPLAY: boolean | undefined;
37
+ SCREEN_DISPLAY_NEW: boolean;
38
+ FULL_DUST: boolean;
39
+ INDOOR_TEMPERATURE?: number;
40
+ OUTDOOR_TEMPERATURE?: number;
41
+ INDIRECT_WIND: boolean;
42
+ INDOOR_HUMIDITY: number | undefined;
43
+ BREEZELESS: boolean;
44
+ TOTAL_ENERGY_CONSUMPTION?: number;
45
+ CURRENT_ENERGY_CONSUMPTION?: number;
46
+ REALTIME_POWER: number;
47
+ FRESH_AIR_POWER: boolean;
48
+ FRESH_AIR_FAN_SPEED: number;
49
+ FRESH_AIR_MODE?: string;
50
+ FRESH_AIR_1: boolean;
51
+ FRESH_AIR_2: boolean;
52
+ }
53
+ export default class MideaACDevice extends MideaDevice {
54
+ readonly FRESH_AIR_FAN_SPEEDS: {
55
+ 0: string;
56
+ 20: string;
57
+ 40: string;
58
+ 60: string;
59
+ 80: string;
60
+ 100: string;
61
+ };
62
+ readonly FRESH_AIR_FAN_SPEEDS_REVERSE: {
63
+ 100: string;
64
+ 80: string;
65
+ 60: string;
66
+ 40: string;
67
+ 20: string;
68
+ 0: string;
69
+ };
70
+ attributes: ACAttributes;
71
+ private fresh_air_version?;
72
+ private used_subprotocol;
73
+ private bb_sn8_flag;
74
+ private bb_timer;
75
+ private readonly DEFAULT_POWER_ANALYSIS_METHOD;
76
+ private power_analysis_method?;
77
+ private alternate_switch_display;
78
+ private last_fan_speed;
79
+ private defaultFahrenheit;
80
+ private defaultScreenOff;
81
+ /*********************************************************************
82
+ * Constructor initializes all the attributes. We set some to invalid
83
+ * values so that they are detected as "changed" on the first status
84
+ * refresh... and passed back to the Homebridge/HomeKit accessory callback
85
+ * function to set their initial values.
86
+ */
87
+ constructor(logger: Logger, device_info: DeviceInfo, config: Config, deviceConfig: DeviceConfig);
88
+ build_query(): (MessageQuery | MessagePowerQuery | MessageNewProtocolQuery)[];
89
+ process_message(msg: Buffer): void;
90
+ make_message_set(): MessageGeneralSet;
91
+ make_subprotocol_message_set(): MessageSubProtocolSet;
92
+ make_message_unique_set(): MessageGeneralSet | MessageSubProtocolSet;
93
+ set_attribute(attributes: Partial<ACAttributes>): Promise<void>;
94
+ set_alternate_switch_display(value: boolean): void;
95
+ set_target_temperature(target_temperature: number, mode?: number): Promise<void>;
96
+ set_swing(swing_horizontal: boolean, swing_vertical: boolean): Promise<void>;
97
+ set_fan_auto(fan_auto: boolean): Promise<void>;
98
+ set_swing_angle(swing_direction: SwingAngle, swing_angle: number): Promise<void>;
99
+ protected set_subtype(): void;
100
+ }
101
101
  //# sourceMappingURL=MideaACDevice.d.ts.map