homebridge-midea-platform 0.2.0 → 0.3.0

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 (77) hide show
  1. package/.eslintignore +3 -0
  2. package/.husky/pre-commit +4 -0
  3. package/.prettierrc +18 -0
  4. package/README.md +5 -0
  5. package/config.schema.json +55 -0
  6. package/dist/accessory/AccessoryFactory.d.ts +2 -1
  7. package/dist/accessory/AccessoryFactory.d.ts.map +1 -1
  8. package/dist/accessory/AccessoryFactory.js +3 -0
  9. package/dist/accessory/AccessoryFactory.js.map +1 -1
  10. package/dist/accessory/AirConditionerAccessory.d.ts +26 -0
  11. package/dist/accessory/AirConditionerAccessory.d.ts.map +1 -1
  12. package/dist/accessory/AirConditionerAccessory.js +153 -45
  13. package/dist/accessory/AirConditionerAccessory.js.map +1 -1
  14. package/dist/accessory/BaseAccessory.d.ts.map +1 -1
  15. package/dist/accessory/BaseAccessory.js +2 -16
  16. package/dist/accessory/BaseAccessory.js.map +1 -1
  17. package/dist/accessory/DehumidifierAccessory.d.ts +41 -0
  18. package/dist/accessory/DehumidifierAccessory.d.ts.map +1 -0
  19. package/dist/accessory/DehumidifierAccessory.js +294 -0
  20. package/dist/accessory/DehumidifierAccessory.js.map +1 -0
  21. package/dist/core/MideaCloud.d.ts +11 -0
  22. package/dist/core/MideaCloud.d.ts.map +1 -1
  23. package/dist/core/MideaCloud.js +109 -58
  24. package/dist/core/MideaCloud.js.map +1 -1
  25. package/dist/core/MideaConstants.d.ts +2 -1
  26. package/dist/core/MideaConstants.d.ts.map +1 -1
  27. package/dist/core/MideaConstants.js +12 -16
  28. package/dist/core/MideaConstants.js.map +1 -1
  29. package/dist/core/MideaDevice.d.ts +26 -8
  30. package/dist/core/MideaDevice.d.ts.map +1 -1
  31. package/dist/core/MideaDevice.js +130 -28
  32. package/dist/core/MideaDevice.js.map +1 -1
  33. package/dist/core/MideaDiscover.d.ts +21 -1
  34. package/dist/core/MideaDiscover.d.ts.map +1 -1
  35. package/dist/core/MideaDiscover.js +98 -20
  36. package/dist/core/MideaDiscover.js.map +1 -1
  37. package/dist/core/MideaMessage.d.ts.map +1 -1
  38. package/dist/core/MideaMessage.js +28 -11
  39. package/dist/core/MideaMessage.js.map +1 -1
  40. package/dist/core/MideaPacketBuilder.d.ts.map +1 -1
  41. package/dist/core/MideaPacketBuilder.js +15 -5
  42. package/dist/core/MideaPacketBuilder.js.map +1 -1
  43. package/dist/core/MideaSecurity.d.ts +3 -1
  44. package/dist/core/MideaSecurity.d.ts.map +1 -1
  45. package/dist/core/MideaSecurity.js +42 -17
  46. package/dist/core/MideaSecurity.js.map +1 -1
  47. package/dist/core/MideaUtils.d.ts +21 -6
  48. package/dist/core/MideaUtils.d.ts.map +1 -1
  49. package/dist/core/MideaUtils.js +81 -83
  50. package/dist/core/MideaUtils.js.map +1 -1
  51. package/dist/devices/DeviceFactory.d.ts +3 -2
  52. package/dist/devices/DeviceFactory.d.ts.map +1 -1
  53. package/dist/devices/DeviceFactory.js +5 -2
  54. package/dist/devices/DeviceFactory.js.map +1 -1
  55. package/dist/devices/a1/MideaA1Device.d.ts +77 -0
  56. package/dist/devices/a1/MideaA1Device.d.ts.map +1 -0
  57. package/dist/devices/a1/MideaA1Device.js +144 -0
  58. package/dist/devices/a1/MideaA1Device.js.map +1 -0
  59. package/dist/devices/a1/MideaA1Message.d.ts +41 -0
  60. package/dist/devices/a1/MideaA1Message.d.ts.map +1 -0
  61. package/dist/devices/a1/MideaA1Message.js +206 -0
  62. package/dist/devices/a1/MideaA1Message.js.map +1 -0
  63. package/dist/devices/ac/MideaACDevice.d.ts +21 -7
  64. package/dist/devices/ac/MideaACDevice.d.ts.map +1 -1
  65. package/dist/devices/ac/MideaACDevice.js +82 -30
  66. package/dist/devices/ac/MideaACDevice.js.map +1 -1
  67. package/dist/devices/ac/MideaACMessage.d.ts.map +1 -1
  68. package/dist/devices/ac/MideaACMessage.js +158 -82
  69. package/dist/devices/ac/MideaACMessage.js.map +1 -1
  70. package/dist/platform.d.ts +29 -5
  71. package/dist/platform.d.ts.map +1 -1
  72. package/dist/platform.js +151 -52
  73. package/dist/platform.js.map +1 -1
  74. package/dist/platformUtils.d.ts +7 -1
  75. package/dist/platformUtils.d.ts.map +1 -1
  76. package/dist/platformUtils.js.map +1 -1
  77. package/package.json +12 -5
@@ -0,0 +1,41 @@
1
+ import { MideaAccessory, MideaPlatform } from '../platform';
2
+ import BaseAccessory from './BaseAccessory';
3
+ import { DeviceConfig } from '../platformUtils';
4
+ import MideaA1Device from '../devices/a1/MideaA1Device';
5
+ export default class DehumidifierAccessory extends BaseAccessory<MideaA1Device> {
6
+ protected readonly device: MideaA1Device;
7
+ protected readonly configDev: DeviceConfig;
8
+ private service;
9
+ private accessories;
10
+ /*********************************************************************
11
+ * Constructor registers all the service types with Homebridge, registers
12
+ * a callback function with the MideaDevice class, and requests device status.
13
+ */
14
+ constructor(platform: MideaPlatform, accessory: MideaAccessory, device: MideaA1Device, configDev: DeviceConfig);
15
+ /*********************************************************************
16
+ * Callback function called by MideaDevice whenever there is a change to
17
+ * any attribute value.
18
+ */
19
+ private updateCharacteristics;
20
+ /*********************************************************************
21
+ * Callback functions for each Homebridge/HomeKit service
22
+ *
23
+ */
24
+ private getActive;
25
+ private setActive;
26
+ private getCurrentHumidifierDehumidifierState;
27
+ private currentHumidifierDehumidifierState;
28
+ private getTargetHumidifierDehumidifierState;
29
+ private setTargetHumidifierDehumidifierState;
30
+ private getCurrentRelativeHumidity;
31
+ private getRelativeHumidityDehumidifierThreshold;
32
+ private setRelativeHumidityDehumidifierThreshold;
33
+ private getRotationSpeed;
34
+ private setRotationSpeed;
35
+ private getWaterLevel;
36
+ private getSwingMode;
37
+ private setSwingMode;
38
+ private getChildLockMode;
39
+ private setChildLockMode;
40
+ }
41
+ //# sourceMappingURL=DehumidifierAccessory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DehumidifierAccessory.d.ts","sourceRoot":"","sources":["../../src/accessory/DehumidifierAccessory.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,aAA+B,MAAM,6BAA6B,CAAC;AAG1E,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,aAAa,CAAC,aAAa,CAAC;IAW3E,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,aAAa;IACxC,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,YAAY;IAX5C,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,WAAW,CAAmB;IAEtC;;;OAGG;gBAED,QAAQ,EAAE,aAAa,EACvB,SAAS,EAAE,cAAc,EACN,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,YAAY;IAkG5C;;;OAGG;YACW,qBAAqB;IA2FnC;;;OAGG;YACW,SAAS;YAST,SAAS;YAMT,qCAAqC;IAOnD,OAAO,CAAC,kCAAkC;YA+B5B,oCAAoC;YAWpC,oCAAoC;YAkBpC,0BAA0B;YAQ1B,wCAAwC;YAQxC,wCAAwC;YAmCxC,gBAAgB;YAQhB,gBAAgB;YAuBhB,aAAa;YAQb,YAAY;YAUZ,YAAY;YAMZ,gBAAgB;YAUhB,gBAAgB;CAM/B"}
@@ -0,0 +1,294 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const BaseAccessory_1 = __importDefault(require("./BaseAccessory"));
7
+ const settings_1 = require("../settings");
8
+ class DehumidifierAccessory extends BaseAccessory_1.default {
9
+ /*********************************************************************
10
+ * Constructor registers all the service types with Homebridge, registers
11
+ * a callback function with the MideaDevice class, and requests device status.
12
+ */
13
+ constructor(platform, accessory, device, configDev) {
14
+ super(platform, accessory, device, configDev);
15
+ this.device = device;
16
+ this.configDev = configDev;
17
+ this.service =
18
+ this.accessory.getService(this.platform.Service.HumidifierDehumidifier) ||
19
+ this.accessory.addService(this.platform.Service.HumidifierDehumidifier);
20
+ this.service.setCharacteristic(this.platform.Characteristic.Name, this.device.name);
21
+ this.accessories = this.platform.accessories.filter((acc) => acc.context.id === this.accessory.UUID && acc !== this.accessory);
22
+ this.service
23
+ .getCharacteristic(this.platform.Characteristic.Active)
24
+ .onGet(this.getActive.bind(this))
25
+ .onSet(this.setActive.bind(this));
26
+ this.service
27
+ .getCharacteristic(this.platform.Characteristic.CurrentHumidifierDehumidifierState)
28
+ .onGet(this.getCurrentHumidifierDehumidifierState.bind(this));
29
+ this.service
30
+ .getCharacteristic(this.platform.Characteristic.TargetHumidifierDehumidifierState)
31
+ .onGet(this.getTargetHumidifierDehumidifierState.bind(this))
32
+ .onSet(this.setTargetHumidifierDehumidifierState.bind(this))
33
+ .setProps({
34
+ validValues: [
35
+ this.platform.Characteristic.TargetHumidifierDehumidifierState
36
+ .HUMIDIFIER_OR_DEHUMIDIFIER,
37
+ this.platform.Characteristic.TargetHumidifierDehumidifierState
38
+ .HUMIDIFIER,
39
+ this.platform.Characteristic.TargetHumidifierDehumidifierState
40
+ .DEHUMIDIFIER,
41
+ ],
42
+ });
43
+ this.service
44
+ .getCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity)
45
+ .onGet(this.getCurrentRelativeHumidity.bind(this))
46
+ .setProps({
47
+ minValue: 0,
48
+ maxValue: 100,
49
+ minStep: 1,
50
+ });
51
+ this.service
52
+ .getCharacteristic(this.platform.Characteristic.RelativeHumidityDehumidifierThreshold)
53
+ .onGet(this.getRelativeHumidityDehumidifierThreshold.bind(this))
54
+ .onSet(this.setRelativeHumidityDehumidifierThreshold.bind(this))
55
+ .setProps({
56
+ minValue: 0,
57
+ maxValue: 100,
58
+ minStep: 5,
59
+ });
60
+ this.service
61
+ .getCharacteristic(this.platform.Characteristic.RotationSpeed)
62
+ .onGet(this.getRotationSpeed.bind(this))
63
+ .onSet(this.setRotationSpeed.bind(this));
64
+ this.service
65
+ .getCharacteristic(this.platform.Characteristic.SwingMode)
66
+ .onGet(this.getSwingMode.bind(this))
67
+ .onSet(this.setSwingMode.bind(this));
68
+ this.service
69
+ .getCharacteristic(this.platform.Characteristic.LockPhysicalControls)
70
+ .onGet(this.getChildLockMode.bind(this))
71
+ .onSet(this.setChildLockMode.bind(this));
72
+ this.service
73
+ .getCharacteristic(this.platform.Characteristic.WaterLevel)
74
+ .onGet(this.getWaterLevel.bind(this));
75
+ // Register a callback function with MideaDevice and then refresh device status. The callback
76
+ // is called whenever there is a change in any attribute value from the device.
77
+ this.device.on('update', this.updateCharacteristics.bind(this));
78
+ this.device.refresh_status();
79
+ // Remove unused accessories
80
+ this.platform.api.unregisterPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, this.accessories);
81
+ }
82
+ /*********************************************************************
83
+ * Callback function called by MideaDevice whenever there is a change to
84
+ * any attribute value.
85
+ */
86
+ async updateCharacteristics(attributes) {
87
+ for (const [k, v] of Object.entries(attributes)) {
88
+ this.platform.log.debug(`[${this.device.name}] Set attribute ${k} to: ${v}`);
89
+ let updateState = false;
90
+ switch (k.toLowerCase()) {
91
+ case 'power':
92
+ this.service.updateCharacteristic(this.platform.Characteristic.Active, v
93
+ ? this.platform.Characteristic.Active.ACTIVE
94
+ : this.platform.Characteristic.Active.INACTIVE);
95
+ updateState = true;
96
+ break;
97
+ case 'target_humidity':
98
+ this.service.updateCharacteristic(this.platform.Characteristic.RelativeHumidityDehumidifierThreshold, v);
99
+ updateState = true;
100
+ break;
101
+ case 'fan_speed':
102
+ this.service.updateCharacteristic(this.platform.Characteristic.RotationSpeed, v);
103
+ break;
104
+ case 'current_humidity':
105
+ this.service.updateCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity, v);
106
+ updateState = true;
107
+ break;
108
+ case 'mode':
109
+ updateState = true;
110
+ break;
111
+ case 'swing':
112
+ this.service.updateCharacteristic(this.platform.Characteristic.SwingMode, v
113
+ ? this.platform.Characteristic.SwingMode.SWING_ENABLED
114
+ : this.platform.Characteristic.SwingMode.SWING_DISABLED);
115
+ break;
116
+ case 'current_temperature':
117
+ // Not currently supported
118
+ break;
119
+ case 'tank_level':
120
+ this.service.updateCharacteristic(this.platform.Characteristic.WaterLevel, v);
121
+ break;
122
+ case 'tank_full':
123
+ // No HomeKit characteristic
124
+ break;
125
+ case 'water_level_set':
126
+ // No HomeKit characteristic
127
+ break;
128
+ case 'child_lock':
129
+ this.service.updateCharacteristic(this.platform.Characteristic.LockPhysicalControls, v
130
+ ? this.platform.Characteristic.LockPhysicalControls
131
+ .CONTROL_LOCK_ENABLED
132
+ : this.platform.Characteristic.LockPhysicalControls
133
+ .CONTROL_LOCK_DISABLED);
134
+ break;
135
+ default:
136
+ this.platform.log.warn(`[${this.device.name}] Attempt to set unsupported attribute ${k} to ${v}`);
137
+ }
138
+ if (updateState) {
139
+ this.service.updateCharacteristic(this.platform.Characteristic.TargetHumidifierDehumidifierState, this.platform.Characteristic.TargetHumidifierDehumidifierState
140
+ .DEHUMIDIFIER);
141
+ this.service.updateCharacteristic(this.platform.Characteristic.CurrentHumidifierDehumidifierState, this.currentHumidifierDehumidifierState());
142
+ }
143
+ }
144
+ }
145
+ /*********************************************************************
146
+ * Callback functions for each Homebridge/HomeKit service
147
+ *
148
+ */
149
+ async getActive() {
150
+ this.platform.log.debug(`[${this.device.name}] GET Active, value: ${this.device.attributes.POWER}`);
151
+ return this.device.attributes.POWER
152
+ ? this.platform.Characteristic.Active.ACTIVE
153
+ : this.platform.Characteristic.Active.INACTIVE;
154
+ }
155
+ async setActive(value) {
156
+ this.platform.log.debug(`[${this.device.name}] SET Active to: ${value}`);
157
+ await this.device.set_attribute({ POWER: !!value });
158
+ }
159
+ // Handle requests to get the current value of the "HumidifierDehumidifierState" characteristic
160
+ async getCurrentHumidifierDehumidifierState() {
161
+ this.platform.log.debug(`[${this.device.name}] GET CurrentHumidifierDehumidifierState, value: ${this.device.attributes.POWER},${this.device.attributes.MODE}`);
162
+ return this.currentHumidifierDehumidifierState();
163
+ }
164
+ currentHumidifierDehumidifierState() {
165
+ if (!this.device.attributes.POWER) {
166
+ // Powered off, must be inactive
167
+ return this.platform.Characteristic.CurrentHumidifierDehumidifierState
168
+ .INACTIVE;
169
+ }
170
+ else {
171
+ // Powered on, check mode
172
+ if (this.device.attributes.MODE >= 2) {
173
+ // Dehumidifying
174
+ return this.platform.Characteristic.CurrentHumidifierDehumidifierState
175
+ .DEHUMIDIFYING;
176
+ }
177
+ else if (this.device.attributes.MODE === 1) {
178
+ // Whether deumidifying depends on whether we have reached target. This is not
179
+ // always accurate, but is best we can do to signal whether actively dehumidifing or not.
180
+ if (this.device.attributes.CURRENT_HUMIDITY <
181
+ this.device.attributes.TARGET_HUMIDITY) {
182
+ return this.platform.Characteristic.CurrentHumidifierDehumidifierState
183
+ .IDLE;
184
+ }
185
+ else {
186
+ return this.platform.Characteristic.CurrentHumidifierDehumidifierState
187
+ .DEHUMIDIFYING;
188
+ }
189
+ }
190
+ return this.platform.Characteristic.CurrentHumidifierDehumidifierState
191
+ .IDLE;
192
+ }
193
+ }
194
+ // Handle requests to get the target value of the "HumidifierDehumidifierState" characteristic
195
+ async getTargetHumidifierDehumidifierState() {
196
+ this.platform.log.debug(`[${this.device.name}] GET TargetHumidifierDehumidifierState, value:
197
+ ${this.platform.Characteristic.TargetHumidifierDehumidifierState.DEHUMIDIFIER}`);
198
+ // Always return that we are a dehumidifier, other states not supported.
199
+ return this.platform.Characteristic.TargetHumidifierDehumidifierState
200
+ .DEHUMIDIFIER;
201
+ }
202
+ // Handle requests to set the target value of the "HumidifierDehumidifierState" characteristic
203
+ async setTargetHumidifierDehumidifierState(value) {
204
+ this.platform.log.debug(`[${this.device.name}] SET TargetHumidifierDehumidifierState to: ${value}`);
205
+ if (value !==
206
+ this.platform.Characteristic.TargetHumidifierDehumidifierState
207
+ .DEHUMIDIFIER) {
208
+ throw new Error(`Device ${this.device.name} (${this.device.id}) can only be a DeHumidifier, illegal value: ${value}`);
209
+ }
210
+ }
211
+ // Handle requests to get the current value of the "RelativeHumidity" characteristic
212
+ async getCurrentRelativeHumidity() {
213
+ this.platform.log.debug(`[${this.device.name}] GET CurrentRelativeHumidity, value: ${this.device.attributes.CURRENT_HUMIDITY}`);
214
+ return this.device.attributes.CURRENT_HUMIDITY;
215
+ }
216
+ // Handle requests to get the Relative value of the "HumidityDehumidifierThreshold" characteristic
217
+ async getRelativeHumidityDehumidifierThreshold() {
218
+ this.platform.log.debug(`[${this.device.name}] GET RelativeHumidityDehumidifierThreshold, value: ${this.device.attributes.TARGET_HUMIDITY}`);
219
+ return this.device.attributes.TARGET_HUMIDITY;
220
+ }
221
+ // Handle requests to set the Relative value of the "HumidityDehumidifierThreshold" characteristic
222
+ async setRelativeHumidityDehumidifierThreshold(value) {
223
+ let RequestedHumidity = value;
224
+ // valid humidity has to be between min and max values
225
+ RequestedHumidity =
226
+ RequestedHumidity < this.device.MIN_HUMIDITY
227
+ ? this.device.MIN_HUMIDITY
228
+ : RequestedHumidity > this.device.MAX_HUMIDITY
229
+ ? this.device.MAX_HUMIDITY
230
+ : RequestedHumidity;
231
+ this.platform.log.debug(`[${this.device.name}] SET RelativeHumidityDehumidifierThreshold to: ${RequestedHumidity} (${value})`);
232
+ await this.device.set_attribute({ TARGET_HUMIDITY: RequestedHumidity });
233
+ // Update HomeKit in case we adjusted the value outside of min and max values
234
+ if (RequestedHumidity !== value) {
235
+ // We had to adjust the requested value to within permitted range... Update homekit to actual value set.
236
+ // Calling updateCharacteristic within set handler seems to fail, new value is not accepted. Workaround is
237
+ // to request the update after short delay (say 50ms) to allow homebridge/homekit to complete the set handler.
238
+ setTimeout(() => {
239
+ this.service.updateCharacteristic(this.platform.Characteristic.RelativeHumidityDehumidifierThreshold, RequestedHumidity);
240
+ }, 50);
241
+ }
242
+ }
243
+ // Handle requests to get the current value of the "RotationSpeed" characteristic
244
+ async getRotationSpeed() {
245
+ this.platform.log.debug(`[${this.device.name}] GET RotationSpeed, value: ${this.device.attributes.FAN_SPEED}`);
246
+ return this.device.attributes.FAN_SPEED;
247
+ }
248
+ // Handle requests to set the "RotationSpeed" characteristic
249
+ async setRotationSpeed(value) {
250
+ let speed = value;
251
+ speed = speed <= 40 ? 40 : speed > 40 && speed <= 60 ? 60 : 80;
252
+ this.platform.log.debug(`[${this.device.name}] SET RotationSpeed to: ${speed} (${value})`);
253
+ await this.device.set_attribute({ FAN_SPEED: speed });
254
+ if (speed !== value) {
255
+ // We had to adjust the requested value to within permitted range... Update homekit to actual value set.
256
+ // Calling updateCharacteristic within set handler seems to fail, new value is not accepted. Workaround is
257
+ // to request the update after short delay (say 50ms) to allow homebridge/homekit to complete the set handler.
258
+ setTimeout(() => {
259
+ this.service.updateCharacteristic(this.platform.Characteristic.RotationSpeed, speed);
260
+ }, 50);
261
+ }
262
+ }
263
+ // Handle requests to get the current value of the "WaterLevel" characteristic
264
+ async getWaterLevel() {
265
+ this.platform.log.debug(`[${this.device.name}] GET WaterLevel, value: ${this.device.attributes.TANK_LEVEL}`);
266
+ return this.device.attributes.TANK_LEVEL;
267
+ }
268
+ // Handle requests to get the current value of the "swingMode" characteristic
269
+ async getSwingMode() {
270
+ this.platform.log.debug(`[${this.device.name}] GET SwingMode, value: ${this.device.attributes.SWING}`);
271
+ return this.device.attributes.SWING
272
+ ? this.platform.Characteristic.SwingMode.SWING_ENABLED
273
+ : this.platform.Characteristic.SwingMode.SWING_DISABLED;
274
+ }
275
+ // Handle requests to set the "swingMode" characteristic
276
+ async setSwingMode(value) {
277
+ this.platform.log.debug(`[${this.device.name}] SET SwingMode to: ${value}`);
278
+ await this.device.set_attribute({ SWING: !!value });
279
+ }
280
+ // Handle requests to get the current value of the "LockPhysicalControls" characteristic
281
+ async getChildLockMode() {
282
+ this.platform.log.debug(`[${this.device.name}] GET LockPhysicalControls, value: ${this.device.attributes.SWING}`);
283
+ return this.device.attributes.CHILD_LOCK
284
+ ? this.platform.Characteristic.LockPhysicalControls.CONTROL_LOCK_ENABLED
285
+ : this.platform.Characteristic.LockPhysicalControls.CONTROL_LOCK_DISABLED;
286
+ }
287
+ // Handle requests to set the "LockPhysicalControls" characteristic
288
+ async setChildLockMode(value) {
289
+ this.platform.log.debug(`[${this.device.name}] SET LockPhysicalControls to: ${value}`);
290
+ await this.device.set_attribute({ CHILD_LOCK: !!value });
291
+ }
292
+ }
293
+ exports.default = DehumidifierAccessory;
294
+ //# sourceMappingURL=DehumidifierAccessory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DehumidifierAccessory.js","sourceRoot":"","sources":["../../src/accessory/DehumidifierAccessory.ts"],"names":[],"mappings":";;;;;AAaA,oEAA4C;AAG5C,0CAAyD;AAEzD,MAAqB,qBAAsB,SAAQ,uBAA4B;IAI7E;;;OAGG;IACH,YACE,QAAuB,EACvB,SAAyB,EACN,MAAqB,EACrB,SAAuB;QAE1C,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;QAH3B,WAAM,GAAN,MAAM,CAAe;QACrB,cAAS,GAAT,SAAS,CAAc;QAI1C,IAAI,CAAC,OAAO;YACV,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,sBAAsB,CAAC;gBACvE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;QAE1E,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAC5B,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,EACjC,IAAI,CAAC,MAAM,CAAC,IAAI,CACjB,CAAC;QAEF,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,MAAM,CACjD,CAAC,GAAG,EAAE,EAAE,CAAC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AC,KAAK,EAAE,CAAC,CAAC;IAC3D,CAAC;CACF;AA7ZD,wCA6ZC"}
@@ -1,4 +1,13 @@
1
1
  /// <reference types="node" />
2
+ /***********************************************************************
3
+ * Midea Cloud access functions
4
+ *
5
+ * Copyright (c) 2023 Kovalovszky Patrik, https://github.com/kovapatrik
6
+ * Portions Copyright (c) 2023 David Kerr, https://github.com/dkerr64
7
+ *
8
+ * With thanks to https://github.com/georgezhao2010/midea_ac_lan
9
+ *
10
+ */
2
11
  import { Logger } from 'homebridge';
3
12
  import { CloudSecurity } from './MideaSecurity';
4
13
  import { Endianness } from './MideaConstants';
@@ -17,6 +26,8 @@ export declare abstract class CloudBase<T extends CloudSecurity> {
17
26
  protected abstract API_URL: string;
18
27
  protected access_token?: string;
19
28
  protected key?: string;
29
+ private semaphore;
30
+ private loggedIn;
20
31
  constructor(account: string, password: string, logger: Logger, security: T);
21
32
  protected timestamp(): string;
22
33
  apiRequest(endpoint: string, args?: {
@@ -1 +1 @@
1
- {"version":3,"file":"MideaCloud.d.ts","sourceRoot":"","sources":["../../src/core/MideaCloud.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAKpC,OAAO,EAAE,aAAa,EAAuC,MAAM,iBAAiB,CAAC;AAErF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,8BAAsB,SAAS,CAAC,CAAC,SAAS,aAAa;IAgBnD,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM;IAClC,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM;IACnC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM;IACjC,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAlBhC,SAAS,CAAC,QAAQ,CAAC,WAAW,KAAK;IACnC,SAAS,CAAC,QAAQ,CAAC,MAAM,KAAK;IAC9B,SAAS,CAAC,QAAQ,CAAC,OAAO,cAAc;IAExC,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