homebridge-midea-platform 1.2.0-beta.7 → 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.
Files changed (168) hide show
  1. package/CHANGELOG.md +7 -2
  2. package/README.md +2 -2
  3. package/config.schema.json +1 -1
  4. package/dist/accessory/AccessoryFactory.d.ts +14 -15
  5. package/dist/accessory/AccessoryFactory.js +34 -40
  6. package/dist/accessory/AccessoryFactory.js.map +1 -1
  7. package/dist/accessory/AirConditionerAccessory.d.ts +98 -99
  8. package/dist/accessory/AirConditionerAccessory.js +666 -662
  9. package/dist/accessory/AirConditionerAccessory.js.map +1 -1
  10. package/dist/accessory/BaseAccessory.d.ts +11 -12
  11. package/dist/accessory/BaseAccessory.js +21 -21
  12. package/dist/accessory/BaseAccessory.js.map +1 -1
  13. package/dist/accessory/DehumidifierAccessory.d.ts +45 -46
  14. package/dist/accessory/DehumidifierAccessory.js +343 -344
  15. package/dist/accessory/DehumidifierAccessory.js.map +1 -1
  16. package/dist/accessory/DishwasherAccessory.d.ts +30 -31
  17. package/dist/accessory/DishwasherAccessory.js +59 -63
  18. package/dist/accessory/DishwasherAccessory.js.map +1 -1
  19. package/dist/accessory/ElectricWaterHeaterAccessory.d.ts +44 -45
  20. package/dist/accessory/ElectricWaterHeaterAccessory.js +172 -176
  21. package/dist/accessory/ElectricWaterHeaterAccessory.js.map +1 -1
  22. package/dist/accessory/FanAccessory.d.ts +39 -40
  23. package/dist/accessory/FanAccessory.js +120 -123
  24. package/dist/accessory/FanAccessory.js.map +1 -1
  25. package/dist/accessory/FrontLoadWasherAccessory.d.ts +30 -31
  26. package/dist/accessory/FrontLoadWasherAccessory.js +63 -66
  27. package/dist/accessory/FrontLoadWasherAccessory.js.map +1 -1
  28. package/dist/accessory/GasWaterHeaterAccessory.d.ts +51 -52
  29. package/dist/accessory/GasWaterHeaterAccessory.js +217 -216
  30. package/dist/accessory/GasWaterHeaterAccessory.js.map +1 -1
  31. package/dist/accessory/{HeatPumpWifiControllerAccessory.d.ts → HeatPumpWiFiControllerAccessory.d.ts} +34 -35
  32. package/dist/accessory/{HeatPumpWifiControllerAccessory.js → HeatPumpWiFiControllerAccessory.js} +55 -36
  33. package/dist/accessory/HeatPumpWiFiControllerAccessory.js.map +1 -0
  34. package/dist/core/MideaCloud.d.ts +34 -36
  35. package/dist/core/MideaCloud.js +349 -350
  36. package/dist/core/MideaCloud.js.map +1 -1
  37. package/dist/core/MideaConstants.d.ts +51 -52
  38. package/dist/core/MideaConstants.js +56 -59
  39. package/dist/core/MideaConstants.js.map +1 -1
  40. package/dist/core/MideaDevice.d.ts +75 -78
  41. package/dist/core/MideaDevice.js +430 -420
  42. package/dist/core/MideaDevice.js.map +1 -1
  43. package/dist/core/MideaDiscover.d.ts +34 -36
  44. package/dist/core/MideaDiscover.js +208 -212
  45. package/dist/core/MideaDiscover.js.map +1 -1
  46. package/dist/core/MideaMessage.d.ts +75 -76
  47. package/dist/core/MideaMessage.js +185 -184
  48. package/dist/core/MideaMessage.js.map +1 -1
  49. package/dist/core/MideaPacketBuilder.d.ts +9 -11
  50. package/dist/core/MideaPacketBuilder.js +60 -60
  51. package/dist/core/MideaPacketBuilder.js.map +1 -1
  52. package/dist/core/MideaSecurity.d.ts +62 -64
  53. package/dist/core/MideaSecurity.js +241 -251
  54. package/dist/core/MideaSecurity.js.map +1 -1
  55. package/dist/core/MideaUtils.d.ts +31 -33
  56. package/dist/core/MideaUtils.js +178 -181
  57. package/dist/core/MideaUtils.js.map +1 -1
  58. package/dist/devices/DeviceFactory.d.ts +14 -15
  59. package/dist/devices/DeviceFactory.js +34 -40
  60. package/dist/devices/DeviceFactory.js.map +1 -1
  61. package/dist/devices/a1/MideaA1Device.d.ts +75 -77
  62. package/dist/devices/a1/MideaA1Device.js +142 -145
  63. package/dist/devices/a1/MideaA1Device.js.map +1 -1
  64. package/dist/devices/a1/MideaA1Message.d.ts +39 -41
  65. package/dist/devices/a1/MideaA1Message.js +219 -198
  66. package/dist/devices/a1/MideaA1Message.js.map +1 -1
  67. package/dist/devices/ac/MideaACDevice.d.ts +105 -107
  68. package/dist/devices/ac/MideaACDevice.js +417 -400
  69. package/dist/devices/ac/MideaACDevice.js.map +1 -1
  70. package/dist/devices/ac/MideaACMessage.d.ts +97 -96
  71. package/dist/devices/ac/MideaACMessage.js +724 -621
  72. package/dist/devices/ac/MideaACMessage.js.map +1 -1
  73. package/dist/devices/c3/MideaC3Device.d.ts +73 -75
  74. package/dist/devices/c3/MideaC3Device.js +249 -255
  75. package/dist/devices/c3/MideaC3Device.js.map +1 -1
  76. package/dist/devices/c3/MideaC3Message.d.ts +81 -80
  77. package/dist/devices/c3/MideaC3Message.js +190 -152
  78. package/dist/devices/c3/MideaC3Message.js.map +1 -1
  79. package/dist/devices/db/MideaDBDevice.d.ts +28 -30
  80. package/dist/devices/db/MideaDBDevice.js +94 -100
  81. package/dist/devices/db/MideaDBDevice.js.map +1 -1
  82. package/dist/devices/db/MideaDBMessage.d.ts +31 -33
  83. package/dist/devices/db/MideaDBMessage.js +101 -101
  84. package/dist/devices/db/MideaDBMessage.js.map +1 -1
  85. package/dist/devices/e1/MideaE1Device.d.ts +55 -57
  86. package/dist/devices/e1/MideaE1Device.js +122 -128
  87. package/dist/devices/e1/MideaE1Device.js.map +1 -1
  88. package/dist/devices/e1/MideaE1Message.d.ts +27 -29
  89. package/dist/devices/e1/MideaE1Message.js +128 -107
  90. package/dist/devices/e1/MideaE1Message.js.map +1 -1
  91. package/dist/devices/e2/MideaE2Device.d.ts +43 -45
  92. package/dist/devices/e2/MideaE2Device.js +124 -129
  93. package/dist/devices/e2/MideaE2Device.js.map +1 -1
  94. package/dist/devices/e2/MideaE2Message.d.ts +34 -34
  95. package/dist/devices/e2/MideaE2Message.js +143 -132
  96. package/dist/devices/e2/MideaE2Message.js.map +1 -1
  97. package/dist/devices/e3/MideaE3Device.d.ts +42 -44
  98. package/dist/devices/e3/MideaE3Device.js +132 -137
  99. package/dist/devices/e3/MideaE3Device.js.map +1 -1
  100. package/dist/devices/e3/MideaE3Message.d.ts +51 -52
  101. package/dist/devices/e3/MideaE3Message.js +144 -136
  102. package/dist/devices/e3/MideaE3Message.js.map +1 -1
  103. package/dist/devices/fa/MideaFADevice.d.ts +35 -37
  104. package/dist/devices/fa/MideaFADevice.js +102 -106
  105. package/dist/devices/fa/MideaFADevice.js.map +1 -1
  106. package/dist/devices/fa/MideaFAMessage.d.ts +38 -39
  107. package/dist/devices/fa/MideaFAMessage.js +108 -98
  108. package/dist/devices/fa/MideaFAMessage.js.map +1 -1
  109. package/dist/index.d.ts +6 -7
  110. package/dist/index.js +8 -6
  111. package/dist/index.js.map +1 -1
  112. package/dist/platform.d.ts +61 -61
  113. package/dist/platform.js +232 -212
  114. package/dist/platform.js.map +1 -1
  115. package/dist/platformUtils.d.ts +116 -117
  116. package/dist/platformUtils.js +107 -110
  117. package/dist/platformUtils.js.map +1 -1
  118. package/dist/settings.d.ts +8 -9
  119. package/dist/settings.js +8 -11
  120. package/dist/settings.js.map +1 -1
  121. package/docs/download_lua.md +9 -0
  122. package/eslint.config.js +43 -0
  123. package/homebridge-ui/public/js/bootstrap.min.js +1179 -1
  124. package/homebridge-ui/{server.js → server.cjs} +30 -30
  125. package/package.json +21 -31
  126. package/.eslintignore +0 -3
  127. package/.husky/pre-commit +0 -5
  128. package/.prettierrc +0 -19
  129. package/dist/accessory/AccessoryFactory.d.ts.map +0 -1
  130. package/dist/accessory/AirConditionerAccessory.d.ts.map +0 -1
  131. package/dist/accessory/BaseAccessory.d.ts.map +0 -1
  132. package/dist/accessory/DehumidifierAccessory.d.ts.map +0 -1
  133. package/dist/accessory/DishwasherAccessory.d.ts.map +0 -1
  134. package/dist/accessory/ElectricWaterHeaterAccessory.d.ts.map +0 -1
  135. package/dist/accessory/FanAccessory.d.ts.map +0 -1
  136. package/dist/accessory/FrontLoadWasherAccessory.d.ts.map +0 -1
  137. package/dist/accessory/GasWaterHeaterAccessory.d.ts.map +0 -1
  138. package/dist/accessory/HeatPumpWifiControllerAccessory.d.ts.map +0 -1
  139. package/dist/accessory/HeatPumpWifiControllerAccessory.js.map +0 -1
  140. package/dist/core/MideaCloud.d.ts.map +0 -1
  141. package/dist/core/MideaConstants.d.ts.map +0 -1
  142. package/dist/core/MideaDevice.d.ts.map +0 -1
  143. package/dist/core/MideaDiscover.d.ts.map +0 -1
  144. package/dist/core/MideaMessage.d.ts.map +0 -1
  145. package/dist/core/MideaPacketBuilder.d.ts.map +0 -1
  146. package/dist/core/MideaSecurity.d.ts.map +0 -1
  147. package/dist/core/MideaUtils.d.ts.map +0 -1
  148. package/dist/devices/DeviceFactory.d.ts.map +0 -1
  149. package/dist/devices/a1/MideaA1Device.d.ts.map +0 -1
  150. package/dist/devices/a1/MideaA1Message.d.ts.map +0 -1
  151. package/dist/devices/ac/MideaACDevice.d.ts.map +0 -1
  152. package/dist/devices/ac/MideaACMessage.d.ts.map +0 -1
  153. package/dist/devices/c3/MideaC3Device.d.ts.map +0 -1
  154. package/dist/devices/c3/MideaC3Message.d.ts.map +0 -1
  155. package/dist/devices/db/MideaDBDevice.d.ts.map +0 -1
  156. package/dist/devices/db/MideaDBMessage.d.ts.map +0 -1
  157. package/dist/devices/e1/MideaE1Device.d.ts.map +0 -1
  158. package/dist/devices/e1/MideaE1Message.d.ts.map +0 -1
  159. package/dist/devices/e2/MideaE2Device.d.ts.map +0 -1
  160. package/dist/devices/e2/MideaE2Message.d.ts.map +0 -1
  161. package/dist/devices/e3/MideaE3Device.d.ts.map +0 -1
  162. package/dist/devices/e3/MideaE3Message.d.ts.map +0 -1
  163. package/dist/devices/fa/MideaFADevice.d.ts.map +0 -1
  164. package/dist/devices/fa/MideaFAMessage.d.ts.map +0 -1
  165. package/dist/index.d.ts.map +0 -1
  166. package/dist/platform.d.ts.map +0 -1
  167. package/dist/platformUtils.d.ts.map +0 -1
  168. package/dist/settings.d.ts.map +0 -1
@@ -1,39 +1,38 @@
1
- /// <reference types="node" />
2
- import { MessageBody, MessageRequest, MessageResponse, MessageType } from '../../core/MideaMessage';
3
- declare abstract class MessageFABase extends MessageRequest {
4
- constructor(device_protocol_version: number, message_type: MessageType, body_type: number | null);
5
- }
6
- export declare class MessageQuery extends MessageFABase {
7
- constructor(device_protocol_version: number);
8
- get _body(): Buffer;
9
- get body(): Buffer;
10
- }
11
- export declare class MessageSet extends MessageFABase {
12
- private subtype;
13
- power?: boolean;
14
- lock?: boolean;
15
- mode?: number;
16
- fan_speed?: number;
17
- oscillate?: boolean;
18
- oscillation_angle?: number;
19
- oscillation_mode?: number;
20
- tilting_angle?: number;
21
- constructor(device_protocol_version: number, subtype: number);
22
- get _body(): Buffer;
23
- }
24
- export declare class FAGeneralMessageBody extends MessageBody {
25
- child_lock: boolean;
26
- power: boolean;
27
- mode: number;
28
- fan_speed: number;
29
- oscillate: boolean;
30
- oscillation_angle: number;
31
- oscillation_mode: number;
32
- tilting_angle: number;
33
- constructor(body: Buffer);
34
- }
35
- export declare class MessageFAResponse extends MessageResponse {
36
- constructor(message: Buffer);
37
- }
38
- export {};
39
- //# sourceMappingURL=MideaFAMessage.d.ts.map
1
+ import { MessageBody, MessageRequest, MessageResponse, MessageType } from '../../core/MideaMessage.js';
2
+ declare abstract class MessageFABase extends MessageRequest {
3
+ constructor(device_protocol_version: number, message_type: MessageType, body_type: number | null);
4
+ }
5
+ export declare class MessageQuery extends MessageFABase {
6
+ constructor(device_protocol_version: number);
7
+ get _body(): Buffer;
8
+ get body(): Buffer;
9
+ }
10
+ export declare class MessageSet extends MessageFABase {
11
+ [key: string]: any;
12
+ private subtype;
13
+ power?: boolean;
14
+ lock?: boolean;
15
+ mode?: number;
16
+ fan_speed?: number;
17
+ oscillate?: boolean;
18
+ oscillation_angle?: number;
19
+ oscillation_mode?: number;
20
+ tilting_angle?: number;
21
+ constructor(device_protocol_version: number, subtype: number);
22
+ get _body(): Buffer;
23
+ }
24
+ export declare class FAGeneralMessageBody extends MessageBody {
25
+ child_lock: boolean;
26
+ power: boolean;
27
+ mode: number;
28
+ fan_speed: number;
29
+ oscillate: boolean;
30
+ oscillation_angle: number;
31
+ oscillation_mode: number;
32
+ tilting_angle: number;
33
+ constructor(body: Buffer);
34
+ }
35
+ export declare class MessageFAResponse extends MessageResponse {
36
+ constructor(message: Buffer);
37
+ }
38
+ export {};
@@ -1,99 +1,109 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MessageFAResponse = exports.FAGeneralMessageBody = exports.MessageSet = exports.MessageQuery = void 0;
4
- const MideaConstants_1 = require("../../core/MideaConstants");
5
- const MideaMessage_1 = require("../../core/MideaMessage");
6
- class MessageFABase extends MideaMessage_1.MessageRequest {
7
- constructor(device_protocol_version, message_type, body_type) {
8
- super(MideaConstants_1.DeviceType.FAN, message_type, body_type, device_protocol_version);
9
- }
10
- }
11
- class MessageQuery extends MessageFABase {
12
- constructor(device_protocol_version) {
13
- super(device_protocol_version, MideaMessage_1.MessageType.QUERY, null);
14
- }
15
- get _body() {
16
- return Buffer.from([]);
17
- }
18
- get body() {
19
- return Buffer.from([]);
20
- }
21
- }
22
- exports.MessageQuery = MessageQuery;
23
- class MessageSet extends MessageFABase {
24
- constructor(device_protocol_version, subtype) {
25
- super(device_protocol_version, MideaMessage_1.MessageType.SET, 0x00);
26
- this.subtype = subtype;
27
- }
28
- get _body() {
29
- let body_return;
30
- if ((1 <= this.subtype && this.subtype <= 10) || this.subtype === 161) {
31
- body_return = Buffer.from([
32
- 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
33
- ]);
34
- if (this.subtype !== 10) {
35
- body_return[13] = 0xff;
36
- }
37
- }
38
- else {
39
- body_return = Buffer.from([
40
- 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
41
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
42
- 0x00, 0x00, 0x00, 0x00, 0x00,
43
- ]);
44
- }
45
- if (this.power !== undefined) {
46
- body_return[3] = this.power ? 0x01 : 0x00;
47
- }
48
- if (this.lock !== undefined) {
49
- body_return[2] = this.lock ? 0x01 : 0x03;
50
- }
51
- if (this.mode !== undefined) {
52
- body_return[3] = 0x01 | (((this.mode + 1) << 1) & 0x1e);
53
- }
54
- if (this.fan_speed !== undefined && 1 <= this.fan_speed && this.fan_speed <= 26) {
55
- body_return[4] = this.fan_speed;
56
- }
57
- if (this.oscillate !== undefined) {
58
- body_return[7] = this.oscillate ? 0x01 : 0x00;
59
- }
60
- if (this.oscillation_angle !== undefined) {
61
- body_return[7] = 1 | body_return[7] | ((this.oscillation_angle << 4) & 0x70);
62
- }
63
- if (this.oscillation_mode !== undefined) {
64
- body_return[7] = 1 | body_return[7] | ((this.oscillation_mode << 1) & 0x0e);
65
- }
66
- if (this.tilting_angle !== undefined && body_return.length > 24) {
67
- body_return[24] = this.tilting_angle;
68
- }
69
- return body_return;
70
- }
71
- }
72
- exports.MessageSet = MessageSet;
73
- class FAGeneralMessageBody extends MideaMessage_1.MessageBody {
74
- constructor(body) {
75
- super(body);
76
- const lock = body[3] & 0x03;
77
- this.child_lock = lock === 0x01;
78
- this.power = (body[4] & 0x01) > 0;
79
- const mode = (body[4] & 0x1e) >> 1;
80
- this.mode = mode > 0 ? mode - 1 : mode;
81
- const fan_speed = body[5];
82
- this.fan_speed = 1 <= fan_speed && fan_speed <= 26 ? fan_speed : 0;
83
- this.oscillate = (body[8] & 0x01) > 0;
84
- this.oscillation_angle = (body[8] & 0x70) >> 4;
85
- this.oscillation_mode = (body[8] & 0x0e) >> 1;
86
- this.tilting_angle = body.length > 25 ? body[25] : 0;
87
- }
88
- }
89
- exports.FAGeneralMessageBody = FAGeneralMessageBody;
90
- class MessageFAResponse extends MideaMessage_1.MessageResponse {
91
- constructor(message) {
92
- super(message);
93
- if ([MideaMessage_1.MessageType.QUERY, MideaMessage_1.MessageType.SET, MideaMessage_1.MessageType.NOTIFY1].includes(this.message_type)) {
94
- this.set_body(new FAGeneralMessageBody(this.body));
95
- }
96
- }
97
- }
98
- exports.MessageFAResponse = MessageFAResponse;
1
+ import { DeviceType } from '../../core/MideaConstants.js';
2
+ import { MessageBody, MessageRequest, MessageResponse, MessageType } from '../../core/MideaMessage.js';
3
+ class MessageFABase extends MessageRequest {
4
+ constructor(device_protocol_version, message_type, body_type) {
5
+ super(DeviceType.FAN, message_type, body_type, device_protocol_version);
6
+ }
7
+ }
8
+ export class MessageQuery extends MessageFABase {
9
+ constructor(device_protocol_version) {
10
+ super(device_protocol_version, MessageType.QUERY, null);
11
+ }
12
+ get _body() {
13
+ return Buffer.from([]);
14
+ }
15
+ get body() {
16
+ return Buffer.from([]);
17
+ }
18
+ }
19
+ export class MessageSet extends MessageFABase {
20
+ subtype;
21
+ power;
22
+ lock;
23
+ mode;
24
+ fan_speed;
25
+ oscillate;
26
+ oscillation_angle;
27
+ oscillation_mode;
28
+ tilting_angle;
29
+ constructor(device_protocol_version, subtype) {
30
+ super(device_protocol_version, MessageType.SET, 0x00);
31
+ this.subtype = subtype;
32
+ }
33
+ get _body() {
34
+ let body_return;
35
+ if ((1 <= this.subtype && this.subtype <= 10) || this.subtype === 161) {
36
+ body_return = Buffer.from([
37
+ 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
38
+ ]);
39
+ if (this.subtype !== 10) {
40
+ body_return[13] = 0xff;
41
+ }
42
+ }
43
+ else {
44
+ body_return = Buffer.from([
45
+ 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
46
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
47
+ 0x00, 0x00, 0x00, 0x00, 0x00,
48
+ ]);
49
+ }
50
+ if (this.power !== undefined) {
51
+ body_return[3] = this.power ? 0x01 : 0x00;
52
+ }
53
+ if (this.lock !== undefined) {
54
+ body_return[2] = this.lock ? 0x01 : 0x03;
55
+ }
56
+ if (this.mode !== undefined) {
57
+ body_return[3] = 0x01 | (((this.mode + 1) << 1) & 0x1e);
58
+ }
59
+ if (this.fan_speed !== undefined && 1 <= this.fan_speed && this.fan_speed <= 26) {
60
+ body_return[4] = this.fan_speed;
61
+ }
62
+ if (this.oscillate !== undefined) {
63
+ body_return[7] = this.oscillate ? 0x01 : 0x00;
64
+ }
65
+ if (this.oscillation_angle !== undefined) {
66
+ body_return[7] = 1 | body_return[7] | ((this.oscillation_angle << 4) & 0x70);
67
+ }
68
+ if (this.oscillation_mode !== undefined) {
69
+ body_return[7] = 1 | body_return[7] | ((this.oscillation_mode << 1) & 0x0e);
70
+ }
71
+ if (this.tilting_angle !== undefined && body_return.length > 24) {
72
+ body_return[24] = this.tilting_angle;
73
+ }
74
+ return body_return;
75
+ }
76
+ }
77
+ export class FAGeneralMessageBody extends MessageBody {
78
+ child_lock;
79
+ power;
80
+ mode;
81
+ fan_speed;
82
+ oscillate;
83
+ oscillation_angle;
84
+ oscillation_mode;
85
+ tilting_angle;
86
+ constructor(body) {
87
+ super(body);
88
+ const lock = body[3] & 0x03;
89
+ this.child_lock = lock === 0x01;
90
+ this.power = (body[4] & 0x01) > 0;
91
+ const mode = (body[4] & 0x1e) >> 1;
92
+ this.mode = mode > 0 ? mode - 1 : mode;
93
+ const fan_speed = body[5];
94
+ this.fan_speed = 1 <= fan_speed && fan_speed <= 26 ? fan_speed : 0;
95
+ this.oscillate = (body[8] & 0x01) > 0;
96
+ this.oscillation_angle = (body[8] & 0x70) >> 4;
97
+ this.oscillation_mode = (body[8] & 0x0e) >> 1;
98
+ this.tilting_angle = body.length > 25 ? body[25] : 0;
99
+ }
100
+ }
101
+ export class MessageFAResponse extends MessageResponse {
102
+ constructor(message) {
103
+ super(message);
104
+ if ([MessageType.QUERY, MessageType.SET, MessageType.NOTIFY1].includes(this.message_type)) {
105
+ this.set_body(new FAGeneralMessageBody(this.body));
106
+ }
107
+ }
108
+ }
99
109
  //# sourceMappingURL=MideaFAMessage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MideaFAMessage.js","sourceRoot":"","sources":["../../../src/devices/fa/MideaFAMessage.ts"],"names":[],"mappings":";;;AAAA,8DAAuD;AACvD,0DAAoG;AAEpG,MAAe,aAAc,SAAQ,6BAAc;IACjD,YAAY,uBAA+B,EAAE,YAAyB,EAAE,SAAwB;QAC9F,KAAK,CAAC,2BAAU,CAAC,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,uBAAuB,CAAC,CAAC;IAC1E,CAAC;CACF;AAED,MAAa,YAAa,SAAQ,aAAa;IAC7C,YAAY,uBAA+B;QACzC,KAAK,CAAC,uBAAuB,EAAE,0BAAW,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC1D,CAAC;IAED,IAAI,KAAK;QACP,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACzB,CAAC;IAED,IAAI,IAAI;QACN,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACzB,CAAC;CACF;AAZD,oCAYC;AAED,MAAa,UAAW,SAAQ,aAAa;IAY3C,YAAY,uBAA+B,EAAE,OAAe;QAC1D,KAAK,CAAC,uBAAuB,EAAE,0BAAW,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACtD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,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1
- import { API } from 'homebridge';
2
- /**
3
- * This method registers the platform with Homebridge
4
- */
5
- declare const _default: (api: API) => void;
6
- export = _default;
7
- //# sourceMappingURL=index.d.ts.map
1
+ import type { API } from 'homebridge';
2
+ /**
3
+ * This method registers the platform with Homebridge
4
+ */
5
+ declare const _default: (api: API) => void;
6
+ export default _default;
package/dist/index.js CHANGED
@@ -1,7 +1,9 @@
1
- "use strict";
2
- const settings_1 = require("./settings");
3
- const platform_1 = require("./platform");
4
- module.exports = (api) => {
5
- api.registerPlatform(settings_1.PLATFORM_NAME, platform_1.MideaPlatform);
6
- };
1
+ import { PLATFORM_NAME } from './settings.js';
2
+ import { MideaPlatform } from './platform.js';
3
+ /**
4
+ * This method registers the platform with Homebridge
5
+ */
6
+ export default (api) => {
7
+ api.registerPlatform(PLATFORM_NAME, MideaPlatform);
8
+ };
7
9
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,yCAA2C;AAC3C,yCAA2C;AAK3C,iBAAS,CAAC,GAAQ,EAAE,EAAE;IACpB,GAAG,CAAC,gBAAgB,CAAC,wBAAa,EAAE,wBAAa,CAAC,CAAC;AACrD,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C;;GAEG;AACH,eAAe,CAAC,GAAQ,EAAE,EAAE;IAC1B,GAAG,CAAC,gBAAgB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;AACrD,CAAC,CAAC"}
@@ -1,61 +1,61 @@
1
- /***********************************************************************
2
- * Midea Homebridge platform initialization
3
- *
4
- * Copyright (c) 2023 Kovalovszky Patrik, https://github.com/kovapatrik
5
- * Portions Copyright (c) 2023 David Kerr, https://github.com/dkerr64
6
- *
7
- * Based on https://github.com/homebridge/homebridge-plugin-template
8
- *
9
- */
10
- import { API, DynamicPlatformPlugin, Logger, PlatformAccessory, PlatformConfig, Service, Characteristic } from 'homebridge';
11
- export interface MideaAccessory extends PlatformAccessory {
12
- context: {
13
- token: string;
14
- key: string;
15
- id: string;
16
- type: string;
17
- sn: string;
18
- model: string;
19
- serviceVersion: number;
20
- };
21
- }
22
- export declare class MideaPlatform implements DynamicPlatformPlugin {
23
- readonly log: Logger;
24
- readonly config: PlatformConfig;
25
- readonly api: API;
26
- readonly Service: typeof Service;
27
- readonly Characteristic: typeof Characteristic;
28
- readonly accessories: MideaAccessory[];
29
- private discoveredDevices;
30
- private discoveryInterval;
31
- private readonly discover;
32
- private readonly platformConfig;
33
- constructor(log: Logger, config: PlatformConfig, api: API);
34
- /*********************************************************************
35
- * finishedLaunching
36
- * Function called when Homebridge has finished loading the plugin.
37
- */
38
- private finishedLaunching;
39
- /*********************************************************************
40
- * deviceDiscovered
41
- * Function called by the 'device' on handler.
42
- */
43
- private deviceDiscovered;
44
- /*********************************************************************
45
- * discoveryComplete
46
- * Function called by the 'complete' on handler.
47
- */
48
- private discoveryComplete;
49
- /*********************************************************************
50
- * addDevice
51
- * Called for each device as discovered on the network. Creates the
52
- * Midea device handler and the associated Homebridge accessory.
53
- */
54
- private addDevice;
55
- /**
56
- * This function is invoked when homebridge restores cached accessories from disk at startup.
57
- * It should be used to setup event handlers for characteristics and update respective values.
58
- */
59
- configureAccessory(accessory: MideaAccessory): void;
60
- }
61
- //# sourceMappingURL=platform.d.ts.map
1
+ /***********************************************************************
2
+ * Midea Homebridge platform initialization
3
+ *
4
+ * Copyright (c) 2023 Kovalovszky Patrik, https://github.com/kovapatrik
5
+ * Portions Copyright (c) 2023 David Kerr, https://github.com/dkerr64
6
+ *
7
+ * Based on https://github.com/homebridge/homebridge-plugin-template
8
+ *
9
+ */
10
+ import { API, DynamicPlatformPlugin, Logger, PlatformAccessory, PlatformConfig, Service, Characteristic } from 'homebridge';
11
+ type MideaContext = {
12
+ token: string;
13
+ key: string;
14
+ id: string;
15
+ type: string;
16
+ sn: string;
17
+ model: string;
18
+ serviceVersion: number;
19
+ };
20
+ export type MideaAccessory = PlatformAccessory<MideaContext>;
21
+ export declare class MideaPlatform implements DynamicPlatformPlugin {
22
+ readonly log: Logger;
23
+ readonly config: PlatformConfig;
24
+ readonly api: API;
25
+ readonly Service: typeof Service;
26
+ readonly Characteristic: typeof Characteristic;
27
+ readonly accessories: Map<string, MideaAccessory>;
28
+ readonly discoveredCacheUUIDs: string[];
29
+ private discoveredDevices;
30
+ private discoveryInterval;
31
+ private readonly discover;
32
+ private readonly platformConfig;
33
+ constructor(log: Logger, config: PlatformConfig, api: API);
34
+ /*********************************************************************
35
+ * finishedLaunching
36
+ * Function called when Homebridge has finished loading the plugin.
37
+ */
38
+ private finishedLaunching;
39
+ /*********************************************************************
40
+ * deviceDiscovered
41
+ * Function called by the 'device' on handler.
42
+ */
43
+ private deviceDiscovered;
44
+ /*********************************************************************
45
+ * discoveryComplete
46
+ * Function called by the 'complete' on handler.
47
+ */
48
+ private discoveryComplete;
49
+ /*********************************************************************
50
+ * addDevice
51
+ * Called for each device as discovered on the network. Creates the
52
+ * Midea device handler and the associated Homebridge accessory.
53
+ */
54
+ private addDevice;
55
+ /**
56
+ * This function is invoked when homebridge restores cached accessories from disk at startup.
57
+ * It should be used to setup event handlers for characteristics and update respective values.
58
+ */
59
+ configureAccessory(accessory: PlatformAccessory): void;
60
+ }
61
+ export {};