homebridge-melcloud-control 3.1.11 → 3.1.17
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/README.md +8 -8
- package/package.json +2 -2
- package/src/deviceata.js +294 -317
- package/src/deviceatw.js +354 -358
- package/src/deviceerv.js +169 -185
- package/src/melcloudata.js +70 -60
- package/src/melcloudatw.js +66 -47
- package/src/melclouderv.js +44 -36
package/src/deviceata.js
CHANGED
|
@@ -38,6 +38,7 @@ class DeviceAta extends EventEmitter {
|
|
|
38
38
|
this.refreshInterval = refreshInterval;
|
|
39
39
|
this.useFahrenheit = useFahrenheit;
|
|
40
40
|
this.startPrepareAccessory = true;
|
|
41
|
+
this.displayDeviceInfo = true;
|
|
41
42
|
|
|
42
43
|
//external integrations
|
|
43
44
|
this.restFul = account.restFul ?? {};
|
|
@@ -72,10 +73,10 @@ class DeviceAta extends EventEmitter {
|
|
|
72
73
|
this.buttonsConfigured = [];
|
|
73
74
|
for (const button of this.buttons) {
|
|
74
75
|
const buttonName = button.name ?? false;
|
|
75
|
-
const buttonMode = button.mode ??
|
|
76
|
+
const buttonMode = button.mode ?? -1;
|
|
76
77
|
const buttonDisplayType = button.displayType ?? 0;
|
|
77
78
|
const buttonNamePrefix = button.namePrefix ?? false;
|
|
78
|
-
if (buttonName && buttonMode && buttonDisplayType > 0) {
|
|
79
|
+
if (buttonName && buttonMode >= 0 && buttonDisplayType > 0) {
|
|
79
80
|
const buttonServiceType = ['', Service.Outlet, Service.Switch, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][buttonDisplayType];
|
|
80
81
|
const buttonCharacteristicType = ['', Characteristic.On, Characteristic.On, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][buttonDisplayType];
|
|
81
82
|
button.namePrefix = buttonNamePrefix;
|
|
@@ -94,11 +95,6 @@ class DeviceAta extends EventEmitter {
|
|
|
94
95
|
this.accessory.currentOperationMode = 0;
|
|
95
96
|
this.accessory.targetOperationMode = 0;
|
|
96
97
|
this.accessory.fanSpeed = 0;
|
|
97
|
-
|
|
98
|
-
this.accessory.operationModeSetPropsMinValue = 0;
|
|
99
|
-
this.accessory.operationModeSetPropsMaxValue = 3;
|
|
100
|
-
this.accessory.operationModeSetPropsValidValues = [0];
|
|
101
|
-
this.accessory.fanSpeedSetPropsMaxValue = 2;
|
|
102
98
|
};
|
|
103
99
|
|
|
104
100
|
async start() {
|
|
@@ -111,7 +107,7 @@ class DeviceAta extends EventEmitter {
|
|
|
111
107
|
debugLog: this.enableDebugMode
|
|
112
108
|
});
|
|
113
109
|
|
|
114
|
-
this.melCloudAta.on('externalIntegrations', (deviceData
|
|
110
|
+
this.melCloudAta.on('externalIntegrations', (deviceData) => {
|
|
115
111
|
try {
|
|
116
112
|
//RESTFul server
|
|
117
113
|
const restFulEnabled = this.restFul.enable || false;
|
|
@@ -128,7 +124,7 @@ class DeviceAta extends EventEmitter {
|
|
|
128
124
|
})
|
|
129
125
|
.on('set', async (key, value) => {
|
|
130
126
|
try {
|
|
131
|
-
await this.setOverExternalIntegration('RESTFul',
|
|
127
|
+
await this.setOverExternalIntegration('RESTFul', deviceData, key, value);
|
|
132
128
|
} catch (error) {
|
|
133
129
|
this.emit('warn', `RESTFul set error: ${error}.`);
|
|
134
130
|
};
|
|
@@ -141,7 +137,7 @@ class DeviceAta extends EventEmitter {
|
|
|
141
137
|
});
|
|
142
138
|
}
|
|
143
139
|
const restFul0 = this.restFulConnected ? this.restFul1.update('info', deviceData) : false;
|
|
144
|
-
const restFul1 = this.restFulConnected ? this.restFul1.update('state',
|
|
140
|
+
const restFul1 = this.restFulConnected ? this.restFul1.update('state', deviceData.Device) : false;
|
|
145
141
|
}
|
|
146
142
|
|
|
147
143
|
//MQTT client
|
|
@@ -167,7 +163,7 @@ class DeviceAta extends EventEmitter {
|
|
|
167
163
|
})
|
|
168
164
|
.on('set', async (key, value) => {
|
|
169
165
|
try {
|
|
170
|
-
await this.setOverExternalIntegration('MQTT',
|
|
166
|
+
await this.setOverExternalIntegration('MQTT', deviceData, key, value);
|
|
171
167
|
} catch (error) {
|
|
172
168
|
this.emit('warn', `MQTT set error: ${error}.`);
|
|
173
169
|
};
|
|
@@ -180,7 +176,7 @@ class DeviceAta extends EventEmitter {
|
|
|
180
176
|
});
|
|
181
177
|
}
|
|
182
178
|
const mqtt0 = this.mqttConnected ? this.mqtt1.emit('publish', `Info`, deviceData) : false;
|
|
183
|
-
const mqtt1 = this.mqttConnected ? this.mqtt1.emit('publish', `State`,
|
|
179
|
+
const mqtt1 = this.mqttConnected ? this.mqtt1.emit('publish', `State`, deviceData.Device) : false;
|
|
184
180
|
}
|
|
185
181
|
|
|
186
182
|
} catch (error) {
|
|
@@ -188,6 +184,10 @@ class DeviceAta extends EventEmitter {
|
|
|
188
184
|
};
|
|
189
185
|
})
|
|
190
186
|
.on('deviceInfo', (manufacturer, modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion) => {
|
|
187
|
+
if (!this.displayDeviceInfo) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
191
|
if (!this.disableLogDeviceInfo) {
|
|
192
192
|
this.emit('devInfo', `---- ${this.deviceTypeText}: ${this.deviceName} ----`);
|
|
193
193
|
this.emit('devInfo', `Account: ${this.accountName}`);
|
|
@@ -204,8 +204,9 @@ class DeviceAta extends EventEmitter {
|
|
|
204
204
|
this.model = modelIndoor ? modelIndoor : modelOutdoor ? modelOutdoor : `${this.deviceTypeText} ${this.deviceId}`;
|
|
205
205
|
this.serialNumber = serialNumber;
|
|
206
206
|
this.firmwareRevision = firmwareAppVersion;
|
|
207
|
+
this.displayDeviceInfo = false;
|
|
207
208
|
})
|
|
208
|
-
.on('deviceState', async (deviceData
|
|
209
|
+
.on('deviceState', async (deviceData) => {
|
|
209
210
|
//device info
|
|
210
211
|
const displayMode = this.displayMode;
|
|
211
212
|
const hasAutomaticFanSpeed = deviceData.Device.HasAutomaticFanSpeed ?? false;
|
|
@@ -228,32 +229,32 @@ class DeviceAta extends EventEmitter {
|
|
|
228
229
|
const presetsOnServer = deviceData.Presets ?? [];
|
|
229
230
|
|
|
230
231
|
//device state
|
|
231
|
-
const power =
|
|
232
|
-
const offline =
|
|
233
|
-
const inStandbyMode =
|
|
234
|
-
const roomTemperature =
|
|
235
|
-
const setTemperature =
|
|
236
|
-
const
|
|
237
|
-
const operationMode =
|
|
238
|
-
const
|
|
239
|
-
const
|
|
240
|
-
const hideVaneControls =
|
|
241
|
-
const hideDryModeControl =
|
|
242
|
-
const prohibitSetTemperature =
|
|
243
|
-
const prohibitOperationMode =
|
|
244
|
-
const prohibitPower =
|
|
232
|
+
const power = deviceData.Device.Power ?? false;
|
|
233
|
+
const offline = deviceData.Device.Offline ?? false;
|
|
234
|
+
const inStandbyMode = deviceData.Device.InStandbyMode ?? false;
|
|
235
|
+
const roomTemperature = deviceData.Device.RoomTemperature;
|
|
236
|
+
const setTemperature = deviceData.Device.SetTemperature;
|
|
237
|
+
const fanSpeed = deviceData.Device.FanSpeed;
|
|
238
|
+
const operationMode = deviceData.Device.OperationMode;
|
|
239
|
+
const vaneHorizontalDirection = deviceData.Device.VaneHorizontalDirection;
|
|
240
|
+
const VaneVerticalDirection = deviceData.Device.VaneVerticalDirection;
|
|
241
|
+
const hideVaneControls = deviceData.Device.HideVaneControls;
|
|
242
|
+
const hideDryModeControl = deviceData.Device.HideDryModeControl;
|
|
243
|
+
const prohibitSetTemperature = deviceData.Device.ProhibitSetTemperature ?? false;
|
|
244
|
+
const prohibitOperationMode = deviceData.Device.ProhibitOperationMode ?? false;
|
|
245
|
+
const prohibitPower = deviceData.Device.ProhibitPower ?? false;
|
|
245
246
|
|
|
246
247
|
//accessory
|
|
247
248
|
this.accessory.presetsOnServer = presetsOnServer;
|
|
248
249
|
this.accessory.power = power ? 1 : 0;
|
|
249
|
-
this.accessory.offline = offline;
|
|
250
|
+
this.accessory.offline = offline ?? false;
|
|
250
251
|
this.accessory.roomTemperature = roomTemperature;
|
|
251
252
|
this.accessory.outdoorTemperature = outdoorTemperature;
|
|
252
253
|
this.accessory.setTemperature = setTemperature;
|
|
253
|
-
this.accessory.
|
|
254
|
-
this.accessory.vaneHorizontal =
|
|
255
|
-
this.accessory.vaneVertical =
|
|
256
|
-
this.accessory.swingMode = swingFunction &&
|
|
254
|
+
this.accessory.fanSpeed = fanSpeed;
|
|
255
|
+
this.accessory.vaneHorizontal = vaneHorizontalDirection;
|
|
256
|
+
this.accessory.vaneVertical = VaneVerticalDirection;
|
|
257
|
+
this.accessory.swingMode = swingFunction && vaneHorizontalDirection === 12 && VaneVerticalDirection === 7 ? 1 : 0;
|
|
257
258
|
this.accessory.lockPhysicalControl = prohibitSetTemperature && prohibitOperationMode && prohibitPower ? 1 : 0;
|
|
258
259
|
this.accessory.temperatureIncrement = temperatureIncrement;
|
|
259
260
|
this.accessory.useFahrenheit = this.useFahrenheit;
|
|
@@ -327,25 +328,26 @@ class DeviceAta extends EventEmitter {
|
|
|
327
328
|
|
|
328
329
|
//fan speed mode
|
|
329
330
|
if (modelSupportsFanSpeed) {
|
|
331
|
+
this.accessory.fanSpeedSetPropsMaxValue = 2;
|
|
330
332
|
switch (numberOfFanSpeeds) {
|
|
331
333
|
case 2: //Fan speed mode 2
|
|
332
|
-
this.accessory.fanSpeed = hasAutomaticFanSpeed ? [3, 1, 2][
|
|
334
|
+
this.accessory.fanSpeed = hasAutomaticFanSpeed ? [3, 1, 2][fanSpeed] : [0, 1, 2][fanSpeed];
|
|
333
335
|
this.accessory.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 3 : 2;
|
|
334
336
|
break;
|
|
335
337
|
case 3: //Fan speed mode 3
|
|
336
|
-
this.accessory.fanSpeed = hasAutomaticFanSpeed ? [4, 1, 2, 3][
|
|
338
|
+
this.accessory.fanSpeed = hasAutomaticFanSpeed ? [4, 1, 2, 3][fanSpeed] : [0, 1, 2, 3][fanSpeed];
|
|
337
339
|
this.accessory.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 4 : 3;
|
|
338
340
|
break;
|
|
339
341
|
case 4: //Fan speed mode 4
|
|
340
|
-
this.accessory.fanSpeed = hasAutomaticFanSpeed ? [5, 1, 2, 3, 4][
|
|
342
|
+
this.accessory.fanSpeed = hasAutomaticFanSpeed ? [5, 1, 2, 3, 4][fanSpeed] : [0, 1, 2, 3, 4][fanSpeed];
|
|
341
343
|
this.accessory.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 5 : 4;
|
|
342
344
|
break;
|
|
343
345
|
case 5: //Fan speed mode 5
|
|
344
|
-
this.accessory.fanSpeed = hasAutomaticFanSpeed ? [6, 1, 2, 3, 4, 5][
|
|
346
|
+
this.accessory.fanSpeed = hasAutomaticFanSpeed ? [6, 1, 2, 3, 4, 5][fanSpeed] : [0, 1, 2, 3, 4, 5][fanSpeed];
|
|
345
347
|
this.accessory.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 6 : 5;
|
|
346
348
|
break;
|
|
347
349
|
case 6: //Fan speed mode 6
|
|
348
|
-
this.accessory.fanSpeed = hasAutomaticFanSpeed ? [7, 1, 2, 3, 4, 5, 6][
|
|
350
|
+
this.accessory.fanSpeed = hasAutomaticFanSpeed ? [7, 1, 2, 3, 4, 5, 6][fanSpeed] : [0, 1, 2, 3, 4, 5, 6][fanSpeed];
|
|
349
351
|
this.accessory.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 7 : 6;
|
|
350
352
|
break;
|
|
351
353
|
};
|
|
@@ -433,6 +435,9 @@ class DeviceAta extends EventEmitter {
|
|
|
433
435
|
.updateCharacteristic(Characteristic.TemperatureDisplayUnits, this.accessory.useFahrenheit);
|
|
434
436
|
};
|
|
435
437
|
break;
|
|
438
|
+
default:
|
|
439
|
+
this.emit('warn', `Unknown display mode: ${displayMode}`);
|
|
440
|
+
return;
|
|
436
441
|
};
|
|
437
442
|
|
|
438
443
|
if (this.roomTemperatureSensorService) {
|
|
@@ -449,15 +454,14 @@ class DeviceAta extends EventEmitter {
|
|
|
449
454
|
if (this.presetsConfigured.length > 0) {
|
|
450
455
|
for (let i = 0; i < this.presetsConfigured.length; i++) {
|
|
451
456
|
const preset = this.presetsConfigured[i];
|
|
452
|
-
const
|
|
453
|
-
const presetData = presetsOnServer[index];
|
|
457
|
+
const presetData = presetsOnServer.find(p => p.ID === preset.Id);
|
|
454
458
|
|
|
455
459
|
preset.state = presetData ? (presetData.Power === power
|
|
456
460
|
&& presetData.SetTemperature === setTemperature
|
|
457
461
|
&& presetData.OperationMode === operationMode
|
|
458
|
-
&& presetData.VaneHorizontal ===
|
|
459
|
-
&& presetData.VaneVertical ===
|
|
460
|
-
&& presetData.FanSpeed ===
|
|
462
|
+
&& presetData.VaneHorizontal === vaneHorizontalDirection
|
|
463
|
+
&& presetData.VaneVertical === VaneVerticalDirection
|
|
464
|
+
&& presetData.FanSpeed === fanSpeed) : false;
|
|
461
465
|
|
|
462
466
|
if (this.presetsServices) {
|
|
463
467
|
const characteristicType = preset.characteristicType;
|
|
@@ -498,73 +502,73 @@ class DeviceAta extends EventEmitter {
|
|
|
498
502
|
button.state = power ? (hideDryModeControl === true) : false;
|
|
499
503
|
break;
|
|
500
504
|
case 10: //VANE H SWING MODE AUTO
|
|
501
|
-
button.state = power ? (
|
|
505
|
+
button.state = power ? (vaneHorizontalDirection === 0) : false;
|
|
502
506
|
break;
|
|
503
507
|
case 11: //VANE H SWING MODE 1
|
|
504
|
-
button.state = power ? (
|
|
508
|
+
button.state = power ? (vaneHorizontalDirection === 1) : false;
|
|
505
509
|
break;
|
|
506
510
|
case 12: //VANE H SWING MODE 2
|
|
507
|
-
button.state = power ? (
|
|
511
|
+
button.state = power ? (vaneHorizontalDirection === 2) : false;
|
|
508
512
|
break;
|
|
509
513
|
case 13: //VANE H SWING MODE 3
|
|
510
|
-
button.state = power ? (
|
|
514
|
+
button.state = power ? (vaneHorizontalDirection === 3) : false;
|
|
511
515
|
break;
|
|
512
516
|
case 14: //VANE H SWING MODE 4
|
|
513
|
-
button.state = power ? (
|
|
517
|
+
button.state = power ? (vaneHorizontalDirection === 4) : false;
|
|
514
518
|
break;
|
|
515
519
|
case 15: //VANE H SWING MODE 5
|
|
516
|
-
button.state = power ? (
|
|
520
|
+
button.state = power ? (vaneHorizontalDirection === 5) : false;
|
|
517
521
|
break;
|
|
518
522
|
case 16: //VANE H SWING MODE SPLIT
|
|
519
|
-
button.state = power ? (
|
|
523
|
+
button.state = power ? (vaneHorizontalDirection === 8) : false;
|
|
520
524
|
break;
|
|
521
525
|
case 17: //VANE H SWING MODE SWING
|
|
522
|
-
button.state = power ? (
|
|
526
|
+
button.state = power ? (vaneHorizontalDirection === 12) : false;
|
|
523
527
|
break;
|
|
524
528
|
case 20: //VANE V SWING MODE AUTO
|
|
525
|
-
button.state = power ? (
|
|
529
|
+
button.state = power ? (VaneVerticalDirection === 0) : false;
|
|
526
530
|
break;
|
|
527
531
|
case 21: //VANE V SWING MODE 1
|
|
528
|
-
button.state = power ? (
|
|
532
|
+
button.state = power ? (VaneVerticalDirection === 1) : false;
|
|
529
533
|
break;
|
|
530
534
|
case 22: //VANE V SWING MODE 2
|
|
531
|
-
button.state = power ? (
|
|
535
|
+
button.state = power ? (VaneVerticalDirection === 2) : false;
|
|
532
536
|
break;
|
|
533
537
|
case 23: //VANE V SWING MODE 3
|
|
534
|
-
button.state = power ? (
|
|
538
|
+
button.state = power ? (VaneVerticalDirection === 3) : false;
|
|
535
539
|
break;
|
|
536
540
|
case 24: //VANE V SWING MODE 4
|
|
537
|
-
button.state = power ? (
|
|
541
|
+
button.state = power ? (VaneVerticalDirection === 4) : false;
|
|
538
542
|
break;
|
|
539
543
|
case 25: //VANE V SWING MODE 5
|
|
540
|
-
button.state = power ? (
|
|
544
|
+
button.state = power ? (VaneVerticalDirection === 5) : false;
|
|
541
545
|
break;
|
|
542
546
|
case 26: //VANE V SWING MODE SWING
|
|
543
|
-
button.state = power ? (
|
|
547
|
+
button.state = power ? (VaneVerticalDirection === 7) : false;
|
|
544
548
|
break;
|
|
545
549
|
case 27: //VANE H/V CONTROLS HIDE
|
|
546
550
|
button.state = power ? (hideVaneControls === true) : false;
|
|
547
551
|
break;
|
|
548
552
|
case 30: //FAN SPEED MODE AUTO
|
|
549
|
-
button.state = power ? (
|
|
553
|
+
button.state = power ? (fanSpeed === 0) : false;
|
|
550
554
|
break;
|
|
551
555
|
case 31: //FAN SPEED MODE 1
|
|
552
|
-
button.state = power ? (
|
|
556
|
+
button.state = power ? (fanSpeed === 1) : false;
|
|
553
557
|
break;
|
|
554
558
|
case 32: //FAN SPEED MODE 2
|
|
555
|
-
button.state = power ? (
|
|
559
|
+
button.state = power ? (fanSpeed === 2) : false;
|
|
556
560
|
break;
|
|
557
561
|
case 33: //FAN SPEED MODE 3
|
|
558
|
-
button.state = power ? (
|
|
562
|
+
button.state = power ? (fanSpeed === 3) : false;
|
|
559
563
|
break;
|
|
560
564
|
case 34: //FAN SPEED MODE 4
|
|
561
|
-
button.state = power ? (
|
|
565
|
+
button.state = power ? (fanSpeed === 4) : false;
|
|
562
566
|
break;
|
|
563
567
|
case 35: //FAN SPEED MODE 5
|
|
564
|
-
button.state = power ? (
|
|
568
|
+
button.state = power ? (fanSpeed === 5) : false;
|
|
565
569
|
break;
|
|
566
570
|
case 36: //FAN SPEED MODE 6
|
|
567
|
-
button.state = power ? (
|
|
571
|
+
button.state = power ? (fanSpeed === 6) : false;
|
|
568
572
|
break;
|
|
569
573
|
case 37: //PHYSICAL LOCK CONTROLS ALL
|
|
570
574
|
button.state = (this.accessory.lockPhysicalControl === 1);
|
|
@@ -602,7 +606,7 @@ class DeviceAta extends EventEmitter {
|
|
|
602
606
|
const info0 = hasOutdoorTemperature && this.accessory.outdoorTemperature !== null ? this.emit('message', `Outdoor temperature: ${roomTemperature}${temperatureUnit}`) : false;
|
|
603
607
|
const info1 = displayMode === 0 ? this.emit('message', `Heating threshold temperature: ${setTemperature}${temperatureUnit}`) : false;
|
|
604
608
|
const info2 = displayMode === 0 ? this.emit('message', `Cooling threshold temperature: ${setTemperature}${temperatureUnit}`) : false;
|
|
605
|
-
const info3 = modelSupportsFanSpeed ? this.emit('message', `Fan speed mode: ${CONSTANTS.AirConditioner.FanSpeed[
|
|
609
|
+
const info3 = modelSupportsFanSpeed ? this.emit('message', `Fan speed mode: ${CONSTANTS.AirConditioner.FanSpeed[fanSpeed]}`) : false;
|
|
606
610
|
const info4 = swingFunction ? this.emit('message', `Vane swing mode: ${CONSTANTS.AirConditioner.AirDirection[this.accessory.swingMode ? 6 : 0]}`) : false;
|
|
607
611
|
this.emit('message', `Temperature display unit: ${temperatureUnit}`);
|
|
608
612
|
this.emit('message', `Lock physical controls: ${this.accessory.lockPhysicalControl ? 'LOCKED' : 'UNLOCKED'}`);
|
|
@@ -614,7 +618,7 @@ class DeviceAta extends EventEmitter {
|
|
|
614
618
|
}
|
|
615
619
|
|
|
616
620
|
try {
|
|
617
|
-
const accessory = await this.prepareAccessory(this.accountInfo,
|
|
621
|
+
const accessory = await this.prepareAccessory(this.accountInfo, deviceData, this.deviceId, this.deviceTypeText, this.deviceName, this.accountName);
|
|
618
622
|
this.emit('publishAccessory', accessory);
|
|
619
623
|
this.startPrepareAccessory = false;
|
|
620
624
|
} catch (error) {
|
|
@@ -632,16 +636,13 @@ class DeviceAta extends EventEmitter {
|
|
|
632
636
|
})
|
|
633
637
|
.on('error', async (error) => {
|
|
634
638
|
this.emit('error', error);
|
|
635
|
-
this.melCloudAta.impulseGenerator.stop();
|
|
636
|
-
await new Promise(resolve => setTimeout(resolve, 15000));
|
|
637
|
-
this.melCloudAta.impulseGenerator.start([{ name: 'checkState', sampling: this.refreshInterval }]);
|
|
638
639
|
});
|
|
639
640
|
|
|
640
641
|
//check state
|
|
641
642
|
await this.melCloudAta.checkState();
|
|
642
643
|
|
|
643
644
|
//start impule generator
|
|
644
|
-
this.melCloudAta.impulseGenerator.start([{ name: 'checkState', sampling: this.refreshInterval }]);
|
|
645
|
+
await this.melCloudAta.impulseGenerator.start([{ name: 'checkState', sampling: this.refreshInterval }]);
|
|
645
646
|
|
|
646
647
|
return true;
|
|
647
648
|
} catch (error) {
|
|
@@ -649,74 +650,74 @@ class DeviceAta extends EventEmitter {
|
|
|
649
650
|
};
|
|
650
651
|
};
|
|
651
652
|
|
|
652
|
-
async setOverExternalIntegration(integration,
|
|
653
|
+
async setOverExternalIntegration(integration, deviceData, key, value) {
|
|
653
654
|
try {
|
|
654
655
|
let set = false
|
|
655
656
|
switch (key) {
|
|
656
657
|
case 'Power':
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
set = await this.melCloudAta.send(
|
|
658
|
+
deviceData.Device[key] = value;
|
|
659
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power;
|
|
660
|
+
set = await this.melCloudAta.send(deviceData);
|
|
660
661
|
break;
|
|
661
662
|
case 'OperationMode':
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
set = await this.melCloudAta.send(
|
|
663
|
+
deviceData.Device[key] = value;
|
|
664
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
665
|
+
set = await this.melCloudAta.send(deviceData);
|
|
665
666
|
break;
|
|
666
667
|
case 'SetTemperature':
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
set = await this.melCloudAta.send(
|
|
668
|
+
deviceData.Device[key] = value;
|
|
669
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
|
|
670
|
+
set = await this.melCloudAta.send(deviceData);
|
|
670
671
|
break;
|
|
671
672
|
case 'DefaultCoolingSetTemperature':
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
set = await this.melCloudAta.send(
|
|
673
|
+
deviceData.Device[key] = value;
|
|
674
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
|
|
675
|
+
set = await this.melCloudAta.send(deviceData);
|
|
675
676
|
break;
|
|
676
677
|
case 'DefaultHeatingSetTemperature':
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
set = await this.melCloudAta.send(
|
|
678
|
+
deviceData.Device[key] = value;
|
|
679
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
|
|
680
|
+
set = await this.melCloudAta.send(deviceData);
|
|
680
681
|
break;
|
|
681
682
|
case 'SetFanSpeed':
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
set = await this.melCloudAta.send(
|
|
683
|
+
deviceData.Device[key] = value;
|
|
684
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
685
|
+
set = await this.melCloudAta.send(deviceData);
|
|
685
686
|
break;
|
|
686
|
-
case '
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
set = await this.melCloudAta.send(
|
|
687
|
+
case 'VaneHorizontalDirection':
|
|
688
|
+
deviceData.Device[key] = value;
|
|
689
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
690
|
+
set = await this.melCloudAta.send(deviceData);
|
|
690
691
|
break;
|
|
691
|
-
case '
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
set = await this.melCloudAta.send(
|
|
692
|
+
case 'VaneVerticalDirection':
|
|
693
|
+
deviceData.Device[key] = value;
|
|
694
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
695
|
+
set = await this.melCloudAta.send(deviceData);
|
|
695
696
|
break;
|
|
696
697
|
case 'HideVaneControls':
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
set = await this.melCloudAta.send(
|
|
698
|
+
deviceData.Device[key] = value;
|
|
699
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Prohibit;
|
|
700
|
+
set = await this.melCloudAta.send(deviceData);
|
|
700
701
|
break;
|
|
701
702
|
case 'HideDryModeControl':
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
await this.melCloudAta.send(
|
|
703
|
+
deviceData.Device[key] = value;
|
|
704
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Prohibit;
|
|
705
|
+
await this.melCloudAta.send(deviceData);
|
|
705
706
|
break;
|
|
706
707
|
case 'ProhibitSetTemperature':
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
set = await this.melCloudAta.send(
|
|
708
|
+
deviceData.Device[key] = value;
|
|
709
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Prohibit;
|
|
710
|
+
set = await this.melCloudAta.send(deviceData);
|
|
710
711
|
break;
|
|
711
712
|
case 'ProhibitOperationMode':
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
await this.melCloudAta.send(
|
|
713
|
+
deviceData.Device[key] = value;
|
|
714
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Prohibit;
|
|
715
|
+
await this.melCloudAta.send(deviceData);
|
|
715
716
|
break;
|
|
716
717
|
case 'ProhibitPower':
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
set = await this.melCloudAta.send(
|
|
718
|
+
deviceData.Device[key] = value;
|
|
719
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Prohibit;
|
|
720
|
+
set = await this.melCloudAta.send(deviceData);
|
|
720
721
|
break;
|
|
721
722
|
default:
|
|
722
723
|
this.emit('warn', `${integration}, received key: ${key}, value: ${value}`);
|
|
@@ -729,7 +730,7 @@ class DeviceAta extends EventEmitter {
|
|
|
729
730
|
}
|
|
730
731
|
|
|
731
732
|
//prepare accessory
|
|
732
|
-
async prepareAccessory(accountInfo,
|
|
733
|
+
async prepareAccessory(accountInfo, deviceData, deviceId, deviceTypeText, deviceName, accountName) {
|
|
733
734
|
try {
|
|
734
735
|
//accessory
|
|
735
736
|
const debug = this.enableDebugMode ? this.emit('debug', `Prepare accessory`) : false;
|
|
@@ -747,23 +748,19 @@ class DeviceAta extends EventEmitter {
|
|
|
747
748
|
.setCharacteristic(Characteristic.FirmwareRevision, this.firmwareRevision);
|
|
748
749
|
|
|
749
750
|
//melcloud services
|
|
750
|
-
const presetsOnServer = this.accessory.presetsOnServer;
|
|
751
751
|
const displayMode = this.displayMode;
|
|
752
752
|
const temperatureSensor = this.temperatureSensor;
|
|
753
753
|
const temperatureSensorOutdoor = this.temperatureSensorOutdoor;
|
|
754
|
-
const presetsConfigured = this.presetsConfigured;
|
|
755
|
-
const presetsConfiguredCount = this.presetsConfiguredCount;
|
|
756
|
-
const buttonsConfigured = this.buttonsConfigured;
|
|
757
|
-
const buttonsConfiguredCount = this.buttonsConfiguredCount;
|
|
758
754
|
const hasAutomaticFanSpeed = this.accessory.hasAutomaticFanSpeed;
|
|
759
755
|
const modelSupportsFanSpeed = this.accessory.modelSupportsFanSpeed;
|
|
760
756
|
const modelSupportsDry = this.accessory.modelSupportsDry;
|
|
761
757
|
const numberOfFanSpeeds = this.accessory.numberOfFanSpeeds;
|
|
762
758
|
const swingFunction = this.accessory.swingFunction;
|
|
763
759
|
const hasOutdoorTemperature = this.accessory.hasOutdoorTemperature;
|
|
764
|
-
const
|
|
765
|
-
const
|
|
766
|
-
const
|
|
760
|
+
const presetsOnServer = this.accessory.presetsOnServer;
|
|
761
|
+
const autoDryFanMode = [deviceData.Device.OperationMode, 8, modelSupportsDry ? 2 : 8, 7][this.autoDryFanMode]; //NONE, AUTO - 8, DRY - 2, FAN - 7
|
|
762
|
+
const heatDryFanMode = [deviceData.Device.OperationMode, 1, modelSupportsDry ? 2 : 1, 7][this.heatDryFanMode]; //NONE, HEAT - 1, DRY - 2, FAN - 7
|
|
763
|
+
const coolDryFanMode = [deviceData.Device.OperationMode, 3, modelSupportsDry ? 2 : 3, 7][this.coolDryFanMode]; //NONE, COOL - 3, DRY - 2, FAN - 7
|
|
767
764
|
const serviceName = `${deviceTypeText} ${accessoryName}`;
|
|
768
765
|
|
|
769
766
|
switch (displayMode) {
|
|
@@ -777,9 +774,9 @@ class DeviceAta extends EventEmitter {
|
|
|
777
774
|
})
|
|
778
775
|
.onSet(async (state) => {
|
|
779
776
|
try {
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
await this.melCloudAta.send(
|
|
777
|
+
deviceData.Device.Power = [false, true][state];
|
|
778
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power;
|
|
779
|
+
await this.melCloudAta.send(deviceData);
|
|
783
780
|
const info = this.disableLogInfo ? false : this.emit('message', `Set power: ${state ? 'ON' : 'OFF'}`);
|
|
784
781
|
} catch (error) {
|
|
785
782
|
this.emit('warn', `Set power error: ${error}`);
|
|
@@ -804,26 +801,31 @@ class DeviceAta extends EventEmitter {
|
|
|
804
801
|
try {
|
|
805
802
|
switch (value) {
|
|
806
803
|
case 0: //AUTO - AUTO
|
|
807
|
-
|
|
808
|
-
|
|
804
|
+
deviceData.Device.OperationMode = autoDryFanMode;
|
|
805
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
809
806
|
break;
|
|
810
807
|
case 1: //HEAT - HEAT
|
|
811
|
-
|
|
812
|
-
|
|
808
|
+
deviceData.Device.OperationMode = heatDryFanMode;
|
|
809
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
813
810
|
break;
|
|
814
811
|
case 2: //COOL - COOL
|
|
815
|
-
|
|
816
|
-
|
|
812
|
+
deviceData.Device.OperationMode = coolDryFanMode;
|
|
813
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
817
814
|
break;
|
|
818
815
|
};
|
|
819
816
|
|
|
820
|
-
await this.melCloudAta.send(
|
|
821
|
-
const operationModeText = CONSTANTS.AirConditioner.DriveMode[
|
|
817
|
+
await this.melCloudAta.send(deviceData);
|
|
818
|
+
const operationModeText = CONSTANTS.AirConditioner.DriveMode[deviceData.Device.OperationMode];
|
|
822
819
|
const info = this.disableLogInfo ? false : this.emit('message', `Set operation mode: ${operationModeText}`);
|
|
823
820
|
} catch (error) {
|
|
824
821
|
this.emit('warn', `Set operation mode error: ${error}`);
|
|
825
822
|
};
|
|
826
823
|
});
|
|
824
|
+
this.melCloudService.getCharacteristic(Characteristic.CurrentTemperature)
|
|
825
|
+
.onGet(async () => {
|
|
826
|
+
const value = this.accessory.roomTemperature;
|
|
827
|
+
return value;
|
|
828
|
+
});
|
|
827
829
|
if (modelSupportsFanSpeed) {
|
|
828
830
|
this.melCloudService.getCharacteristic(Characteristic.RotationSpeed)
|
|
829
831
|
.setProps({
|
|
@@ -840,29 +842,29 @@ class DeviceAta extends EventEmitter {
|
|
|
840
842
|
let fanSpeedModeText = 0; //AUTO, 1, 2, 3, 4, 5, 6, OFF
|
|
841
843
|
switch (numberOfFanSpeeds) {
|
|
842
844
|
case 2: //Fan speed mode 2
|
|
843
|
-
|
|
845
|
+
deviceData.Device.FanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 0][value] : [1, 1, 2][value];
|
|
844
846
|
fanSpeedModeText = hasAutomaticFanSpeed ? [7, 1, 2, 0][value] : [7, 1, 2][value];
|
|
845
847
|
break;
|
|
846
848
|
case 3: //Fan speed mode 3
|
|
847
|
-
|
|
849
|
+
deviceData.Device.FanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 3, 0][value] : [1, 1, 2, 3][value];
|
|
848
850
|
fanSpeedModeText = hasAutomaticFanSpeed ? [7, 1, 2, 3, 0][value] : [7, 1, 2, 3][value];
|
|
849
851
|
break;
|
|
850
852
|
case 4: //Fan speed mode 4
|
|
851
|
-
|
|
853
|
+
deviceData.Device.FanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 0][value] : [1, 1, 2, 3, 4][value];
|
|
852
854
|
fanSpeedModeText = hasAutomaticFanSpeed ? [7, 1, 2, 3, 4, 0][value] : [7, 1, 2, 3, 4][value];
|
|
853
855
|
break;
|
|
854
856
|
case 5: //Fan speed mode 5
|
|
855
|
-
|
|
857
|
+
deviceData.Device.FanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 5, 0][value] : [1, 1, 2, 3, 4, 5][value];
|
|
856
858
|
fanSpeedModeText = hasAutomaticFanSpeed ? [7, 1, 2, 3, 4, 5, 0][value] : [7, 1, 2, 3, 4, 5][value];
|
|
857
859
|
break;
|
|
858
860
|
case 6: //Fan speed mode 6
|
|
859
|
-
|
|
861
|
+
deviceData.Device.FanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 5, 6, 0][value] : [1, 1, 2, 3, 4, 5, 6][value];
|
|
860
862
|
fanSpeedModeText = hasAutomaticFanSpeed ? [7, 1, 2, 3, 4, 5, 6, 0][value] : [7, 1, 2, 3, 4, 5, 6][value];
|
|
861
863
|
break;
|
|
862
864
|
};
|
|
863
865
|
|
|
864
|
-
|
|
865
|
-
await this.melCloudAta.send(
|
|
866
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
867
|
+
await this.melCloudAta.send(deviceData);
|
|
866
868
|
const info = this.disableLogInfo ? false : this.emit('message', `Set fan speed mode: ${CONSTANTS.AirConditioner.FanSpeed[fanSpeedModeText]}`);
|
|
867
869
|
} catch (error) {
|
|
868
870
|
this.emit('warn', `Set fan speed mode error: ${error}`);
|
|
@@ -878,26 +880,16 @@ class DeviceAta extends EventEmitter {
|
|
|
878
880
|
})
|
|
879
881
|
.onSet(async (value) => {
|
|
880
882
|
try {
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
await this.melCloudAta.send(
|
|
883
|
+
deviceData.Device.VaneHorizontal = value ? 12 : 0;
|
|
884
|
+
deviceData.Device.VaneVertical = value ? 7 : 0;
|
|
885
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal + CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
886
|
+
await this.melCloudAta.send(deviceData);
|
|
885
887
|
const info = this.disableLogInfo ? false : this.emit('message', `Set vane swing mode: ${CONSTANTS.AirConditioner.AirDirection[value ? 6 : 0]}`);
|
|
886
888
|
} catch (error) {
|
|
887
889
|
this.emit('warn', `Set vane swing mode error: ${error}`);
|
|
888
890
|
};
|
|
889
891
|
});
|
|
890
892
|
};
|
|
891
|
-
this.melCloudService.getCharacteristic(Characteristic.CurrentTemperature)
|
|
892
|
-
.setProps({
|
|
893
|
-
minValue: -35,
|
|
894
|
-
maxValue: 150,
|
|
895
|
-
minStep: 0.5
|
|
896
|
-
})
|
|
897
|
-
.onGet(async () => {
|
|
898
|
-
const value = this.accessory.roomTemperature;
|
|
899
|
-
return value;
|
|
900
|
-
});
|
|
901
893
|
this.melCloudService.getCharacteristic(Characteristic.HeatingThresholdTemperature)
|
|
902
894
|
.setProps({
|
|
903
895
|
minValue: 0,
|
|
@@ -910,9 +902,9 @@ class DeviceAta extends EventEmitter {
|
|
|
910
902
|
})
|
|
911
903
|
.onSet(async (value) => {
|
|
912
904
|
try {
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
await this.melCloudAta.send(
|
|
905
|
+
deviceData.Device.SetTemperature = value;
|
|
906
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
|
|
907
|
+
await this.melCloudAta.send(deviceData);
|
|
916
908
|
const info = this.disableLogInfo ? false : this.emit('message', `Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
917
909
|
} catch (error) {
|
|
918
910
|
this.emit('warn', `Set heating threshold temperature error: ${error}`);
|
|
@@ -930,9 +922,9 @@ class DeviceAta extends EventEmitter {
|
|
|
930
922
|
})
|
|
931
923
|
.onSet(async (value) => {
|
|
932
924
|
try {
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
await this.melCloudAta.send(
|
|
925
|
+
deviceData.Device.SetTemperature = value;
|
|
926
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
|
|
927
|
+
await this.melCloudAta.send(deviceData);
|
|
936
928
|
const info = this.disableLogInfo ? false : this.emit('message', `Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
937
929
|
} catch (error) {
|
|
938
930
|
this.emit('warn', `Set cooling threshold temperature error: ${error}`);
|
|
@@ -946,11 +938,11 @@ class DeviceAta extends EventEmitter {
|
|
|
946
938
|
.onSet(async (value) => {
|
|
947
939
|
try {
|
|
948
940
|
value = value ? true : false;
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
await this.melCloudAta.send(
|
|
941
|
+
deviceData.Device.ProhibitSetTemperature = value;
|
|
942
|
+
deviceData.Device.ProhibitOperationMode = value;
|
|
943
|
+
deviceData.Device.ProhibitPower = value;
|
|
944
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Prohibit;
|
|
945
|
+
await this.melCloudAta.send(deviceData);
|
|
954
946
|
const info = this.disableLogInfo ? false : this.emit('message', `Set local physical controls: ${value ? 'LOCK' : 'UNLOCK'}`);
|
|
955
947
|
} catch (error) {
|
|
956
948
|
this.emit('warn', `Set lock physical controls error: ${error}`);
|
|
@@ -974,7 +966,7 @@ class DeviceAta extends EventEmitter {
|
|
|
974
966
|
break;
|
|
975
967
|
case 2: //Thermostat
|
|
976
968
|
const debug1 = this.enableDebugMode ? this.emit('debug', `Prepare thermostat service`) : false;
|
|
977
|
-
this.melCloudService =
|
|
969
|
+
this.melCloudService = new Service.Thermostat(serviceName, `Thermostat ${deviceId}`);
|
|
978
970
|
this.melCloudService.getCharacteristic(Characteristic.CurrentHeatingCoolingState)
|
|
979
971
|
.onGet(async () => {
|
|
980
972
|
const value = this.accessory.currentOperationMode;;
|
|
@@ -994,39 +986,34 @@ class DeviceAta extends EventEmitter {
|
|
|
994
986
|
try {
|
|
995
987
|
switch (value) {
|
|
996
988
|
case 0: //OFF - POWER OFF
|
|
997
|
-
|
|
998
|
-
|
|
989
|
+
deviceData.Device.Power = false;
|
|
990
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power;
|
|
999
991
|
break;
|
|
1000
992
|
case 1: //HEAT - HEAT
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
993
|
+
deviceData.Device.Power = true;
|
|
994
|
+
deviceData.Device.OperationMode = heatDryFanMode;
|
|
995
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
1004
996
|
break;
|
|
1005
997
|
case 2: //COOL - COOL
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
998
|
+
deviceData.Device.Power = true;
|
|
999
|
+
deviceData.Device.OperationMode = coolDryFanMode;
|
|
1000
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
1009
1001
|
break;
|
|
1010
1002
|
case 3: //AUTO - AUTO
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1003
|
+
deviceData.Device.Power = true;
|
|
1004
|
+
deviceData.Device.OperationMode = autoDryFanMode;
|
|
1005
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
1014
1006
|
break;
|
|
1015
1007
|
};
|
|
1016
1008
|
|
|
1017
|
-
await this.melCloudAta.send(
|
|
1018
|
-
const operationModeText = CONSTANTS.AirConditioner.DriveMode[
|
|
1009
|
+
await this.melCloudAta.send(deviceData);
|
|
1010
|
+
const operationModeText = CONSTANTS.AirConditioner.DriveMode[deviceData.Device.OperationMode];
|
|
1019
1011
|
const info = this.disableLogInfo ? false : this.emit('message', `Set operation mode: ${operationModeText}`);
|
|
1020
1012
|
} catch (error) {
|
|
1021
1013
|
this.emit('warn', `Set operation mode error: ${error}`);
|
|
1022
1014
|
};
|
|
1023
1015
|
});
|
|
1024
1016
|
this.melCloudService.getCharacteristic(Characteristic.CurrentTemperature)
|
|
1025
|
-
.setProps({
|
|
1026
|
-
minValue: -35,
|
|
1027
|
-
maxValue: 150,
|
|
1028
|
-
minStep: 0.5
|
|
1029
|
-
})
|
|
1030
1017
|
.onGet(async () => {
|
|
1031
1018
|
const value = this.accessory.roomTemperature;
|
|
1032
1019
|
return value;
|
|
@@ -1043,9 +1030,9 @@ class DeviceAta extends EventEmitter {
|
|
|
1043
1030
|
})
|
|
1044
1031
|
.onSet(async (value) => {
|
|
1045
1032
|
try {
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
await this.melCloudAta.send(
|
|
1033
|
+
deviceData.Device.SetTemperature = value;
|
|
1034
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
|
|
1035
|
+
await this.melCloudAta.send(deviceData);
|
|
1049
1036
|
const info = this.disableLogInfo ? false : this.emit('message', `Set temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
1050
1037
|
} catch (error) {
|
|
1051
1038
|
this.emit('warn', `Set temperature error: ${error}`);
|
|
@@ -1065,6 +1052,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1065
1052
|
this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
1066
1053
|
};
|
|
1067
1054
|
});
|
|
1055
|
+
accessory.addService(this.melCloudService);
|
|
1068
1056
|
break;
|
|
1069
1057
|
};
|
|
1070
1058
|
|
|
@@ -1106,22 +1094,18 @@ class DeviceAta extends EventEmitter {
|
|
|
1106
1094
|
};
|
|
1107
1095
|
|
|
1108
1096
|
//presets services
|
|
1109
|
-
if (presetsConfiguredCount > 0) {
|
|
1097
|
+
if (this.presetsConfiguredCount > 0) {
|
|
1110
1098
|
const debug = this.enableDebugMode ? this.emit('debug', `Prepare presets services`) : false;
|
|
1111
1099
|
this.presetsServices = [];
|
|
1112
1100
|
const previousPresets = [];
|
|
1113
1101
|
|
|
1114
|
-
for (let i = 0; i < presetsConfiguredCount; i++) {
|
|
1115
|
-
const preset = presetsConfigured[i];
|
|
1116
|
-
const
|
|
1117
|
-
const presetData = presetsOnServer[index];
|
|
1102
|
+
for (let i = 0; i < this.presetsConfiguredCount; i++) {
|
|
1103
|
+
const preset = this.presetsConfigured[i];
|
|
1104
|
+
const presetData = presetsOnServer.find(p => p.ID === preset.Id);
|
|
1118
1105
|
|
|
1119
1106
|
//get preset name
|
|
1120
1107
|
const presetName = preset.name;
|
|
1121
1108
|
|
|
1122
|
-
//get preset display type
|
|
1123
|
-
const displayType = button.displayType;
|
|
1124
|
-
|
|
1125
1109
|
//get preset name prefix
|
|
1126
1110
|
const presetNamePrefix = preset.namePrefix;
|
|
1127
1111
|
|
|
@@ -1135,53 +1119,48 @@ class DeviceAta extends EventEmitter {
|
|
|
1135
1119
|
.onGet(async () => {
|
|
1136
1120
|
const state = preset.state;
|
|
1137
1121
|
return state;
|
|
1138
|
-
})
|
|
1139
|
-
|
|
1140
|
-
presetService.onSet(async (state) => {
|
|
1122
|
+
})
|
|
1123
|
+
.onSet(async (state) => {
|
|
1141
1124
|
try {
|
|
1142
1125
|
switch (state) {
|
|
1143
1126
|
case true:
|
|
1144
|
-
previousPresets[i] =
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1127
|
+
previousPresets[i] = deviceData.Device;
|
|
1128
|
+
deviceData.Device.SetTemperature = presetData.SetTemperature;
|
|
1129
|
+
deviceData.Device.Power = presetData.Power;
|
|
1130
|
+
deviceData.Device.OperationMode = presetData.OperationMode;
|
|
1131
|
+
deviceData.Device.VaneHorizontalDirection = presetData.VaneHorizontal;
|
|
1132
|
+
deviceData.Device.VaneVerticalDirection = presetData.VaneVertical;
|
|
1133
|
+
deviceData.Device.FanSpeed = presetData.FanSpeed;
|
|
1134
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power;
|
|
1152
1135
|
break;
|
|
1153
1136
|
case false:
|
|
1154
|
-
|
|
1137
|
+
deviceData.Device = previousPresets[i];
|
|
1155
1138
|
break;
|
|
1156
1139
|
};
|
|
1157
1140
|
|
|
1158
|
-
await this.melCloudAta.send(
|
|
1141
|
+
await this.melCloudAta.send(deviceData);
|
|
1159
1142
|
const info = this.disableLogInfo ? false : this.emit('message', `Set: ${presetName}`);
|
|
1160
1143
|
} catch (error) {
|
|
1161
1144
|
this.emit('warn', `Set preset error: ${error}`);
|
|
1162
1145
|
};
|
|
1163
1146
|
});
|
|
1164
|
-
|
|
1165
|
-
previousPresets.push(deviceState);
|
|
1147
|
+
previousPresets.push(deviceData.Device);
|
|
1166
1148
|
this.presetsServices.push(presetService);
|
|
1167
1149
|
accessory.addService(presetService);
|
|
1168
1150
|
};
|
|
1169
1151
|
};
|
|
1170
1152
|
|
|
1171
1153
|
//buttons services
|
|
1172
|
-
if (buttonsConfiguredCount > 0) {
|
|
1154
|
+
if (this.buttonsConfiguredCount > 0) {
|
|
1173
1155
|
const debug = this.enableDebugMode ? this.emit('debug', `Prepare buttons/sensors services`) : false;
|
|
1174
1156
|
this.buttonsServices = [];
|
|
1175
1157
|
|
|
1176
|
-
for (let i = 0; i < buttonsConfiguredCount; i++) {
|
|
1177
|
-
const button = buttonsConfigured[i];
|
|
1158
|
+
for (let i = 0; i < this.buttonsConfiguredCount; i++) {
|
|
1159
|
+
const button = this.buttonsConfigured[i];
|
|
1178
1160
|
|
|
1179
1161
|
//get button mode
|
|
1180
1162
|
const mode = button.mode;
|
|
1181
1163
|
|
|
1182
|
-
//get button display type
|
|
1183
|
-
const displayType = button.displayType;
|
|
1184
|
-
|
|
1185
1164
|
//get button name
|
|
1186
1165
|
const buttonName = button.name;
|
|
1187
1166
|
|
|
@@ -1199,190 +1178,188 @@ class DeviceAta extends EventEmitter {
|
|
|
1199
1178
|
const state = button.state;
|
|
1200
1179
|
return state;
|
|
1201
1180
|
})
|
|
1202
|
-
|
|
1203
|
-
buttonService.onSet(async (state) => {
|
|
1181
|
+
.onSet(async (state) => {
|
|
1204
1182
|
try {
|
|
1205
1183
|
switch (mode) {
|
|
1206
1184
|
case 0: //POWER ON,OFF
|
|
1207
|
-
|
|
1208
|
-
|
|
1185
|
+
deviceData.Device.Power = state;
|
|
1186
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power;
|
|
1209
1187
|
break;
|
|
1210
1188
|
case 1: //OPERATING MODE HEAT
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1189
|
+
deviceData.Device.Power = true;
|
|
1190
|
+
deviceData.Device.OperationMode = 1;
|
|
1191
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
1214
1192
|
break;
|
|
1215
1193
|
case 2: //OPERATING MODE DRY
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1194
|
+
deviceData.Device.Power = true;
|
|
1195
|
+
deviceData.Device.OperationMode = 2;
|
|
1196
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
1219
1197
|
break
|
|
1220
1198
|
case 3: //OPERATING MODE COOL
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1199
|
+
deviceData.Device.Power = true;
|
|
1200
|
+
deviceData.Device.OperationMode = 3;
|
|
1201
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
1224
1202
|
break;
|
|
1225
1203
|
case 4: //OPERATING MODE FAN
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1204
|
+
deviceData.Device.Power = true;
|
|
1205
|
+
deviceData.Device.OperationMode = 7;
|
|
1206
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
1229
1207
|
break;
|
|
1230
1208
|
case 5: //OPERATING MODE AUTO
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1209
|
+
deviceData.Device.Power = true;
|
|
1210
|
+
deviceData.Device.OperationMode = 8;
|
|
1211
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
1234
1212
|
break;
|
|
1235
1213
|
case 6: //OPERATING MODE PURIFY
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1214
|
+
deviceData.Device.Power = true;
|
|
1215
|
+
deviceData.Device.OperationMode = 9;
|
|
1216
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
1239
1217
|
break;
|
|
1240
1218
|
case 7: //OPERATING MODE DRY CONTROL HIDE
|
|
1241
|
-
|
|
1219
|
+
deviceData.Device.HideDryModeControl = state;
|
|
1242
1220
|
break;
|
|
1243
1221
|
case 10: //VANE H SWING MODE AUTO
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1222
|
+
deviceData.Device.Power = true;
|
|
1223
|
+
deviceData.Device.VaneHorizontalDirection = 0;
|
|
1224
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
1247
1225
|
break;
|
|
1248
1226
|
case 11: //VANE H SWING MODE 1
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1227
|
+
deviceData.Device.Power = true;
|
|
1228
|
+
deviceData.Device.VaneHorizontalDirection = 1;
|
|
1229
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
1252
1230
|
break;
|
|
1253
1231
|
case 12: //VANE H SWING MODE 2
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1232
|
+
deviceData.Device.Power = true;
|
|
1233
|
+
deviceData.Device.VaneHorizontalDirection = 2;
|
|
1234
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
1257
1235
|
break;
|
|
1258
1236
|
case 13: //VANE H SWING MODE 3
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1237
|
+
deviceData.Device.Power = true;
|
|
1238
|
+
deviceData.Device.VaneHorizontalDirection = 3;
|
|
1239
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
1262
1240
|
break;
|
|
1263
1241
|
case 14: //VANE H SWING MODE 4
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1242
|
+
deviceData.Device.Power = true;
|
|
1243
|
+
deviceData.Device.VaneHorizontalDirection = 4;
|
|
1244
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
1267
1245
|
break;
|
|
1268
1246
|
case 15: //VANE H SWING MODE 5
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1247
|
+
deviceData.Device.Power = true;
|
|
1248
|
+
deviceData.Device.VaneHorizontalDirection = 5;
|
|
1249
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
1272
1250
|
break;
|
|
1273
1251
|
case 16: //VANE H SWING MODE SPLIT
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1252
|
+
deviceData.Device.Power = true;
|
|
1253
|
+
deviceData.Device.VaneHorizontalDirection = 8;
|
|
1254
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
1277
1255
|
break;
|
|
1278
1256
|
case 17: //VANE H SWING MODE SWING
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1257
|
+
deviceData.Device.Power = true;
|
|
1258
|
+
deviceData.Device.VaneHorizontalDirection = 12;
|
|
1259
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
1282
1260
|
break;
|
|
1283
1261
|
case 20: //VANE V SWING MODE AUTO
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1262
|
+
deviceData.Device.Power = true;
|
|
1263
|
+
deviceData.Device.VaneVerticalDirection = 0;
|
|
1264
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
1287
1265
|
break;
|
|
1288
1266
|
case 21: //VANE V SWING MODE 1
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1267
|
+
deviceData.Device.Power = true;
|
|
1268
|
+
deviceData.Device.VaneVerticalDirection = 1;
|
|
1269
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
1292
1270
|
break;
|
|
1293
1271
|
case 22: //VANE V SWING MODE 2
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1272
|
+
deviceData.Device.Power = true;
|
|
1273
|
+
deviceData.Device.VaneVerticalDirection = 2;
|
|
1274
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
1297
1275
|
break;
|
|
1298
1276
|
case 23: //VANE V SWING MODE 3
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1277
|
+
deviceData.Device.Power = true;
|
|
1278
|
+
deviceData.Device.VaneVerticalDirection = 3;
|
|
1279
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
1302
1280
|
break;
|
|
1303
1281
|
case 24: //VANE V SWING MODE 4
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1282
|
+
deviceData.Device.Power = true;
|
|
1283
|
+
deviceData.Device.VaneVerticalDirection = 4;
|
|
1284
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
1307
1285
|
break;
|
|
1308
1286
|
case 25: //VANE V SWING MODE 5
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1287
|
+
deviceData.Device.Power = true;
|
|
1288
|
+
deviceData.Device.VaneVerticalDirection = 5;
|
|
1289
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
1312
1290
|
break;
|
|
1313
1291
|
case 26: //VANE V SWING MODE SWING
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1292
|
+
deviceData.Device.Power = true;
|
|
1293
|
+
deviceData.Device.VaneVerticalDirection = 7;
|
|
1294
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
1317
1295
|
break;
|
|
1318
1296
|
case 27: //VANE H/V CONTROLS HIDE
|
|
1319
|
-
|
|
1297
|
+
deviceData.Device.HideVaneControls = state;
|
|
1320
1298
|
break;
|
|
1321
1299
|
case 30: //FAN SPEED MODE AUTO
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1300
|
+
deviceData.Device.Power = true;
|
|
1301
|
+
deviceData.Device.FanSpeed = 0;
|
|
1302
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
1325
1303
|
break;
|
|
1326
1304
|
case 31: //FAN SPEED MODE 1
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1305
|
+
deviceData.Device.Power = true;
|
|
1306
|
+
deviceData.Device.FanSpeed = 1;
|
|
1307
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
1330
1308
|
break;
|
|
1331
1309
|
case 32: //FAN SPEED MODE 2
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1310
|
+
deviceData.Device.Power = true;
|
|
1311
|
+
deviceData.Device.FanSpeed = 2;
|
|
1312
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
1335
1313
|
break;
|
|
1336
1314
|
case 33: //FAN SPEED MODE 3
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1315
|
+
deviceData.Device.Power = true;
|
|
1316
|
+
deviceData.Device.FanSpeed = 3;
|
|
1317
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
1340
1318
|
break;
|
|
1341
1319
|
case 34: //FAN MODE 4
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1320
|
+
deviceData.Device.Power = true;
|
|
1321
|
+
deviceData.Device.FanSpeed = 4;
|
|
1322
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
1345
1323
|
break;
|
|
1346
1324
|
case 35: //FAN SPEED MODE 5
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1325
|
+
deviceData.Device.Power = true;
|
|
1326
|
+
deviceData.Device.FanSpeed = 5;
|
|
1327
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
1350
1328
|
break;
|
|
1351
1329
|
case 36: //FAN SPEED MODE 6
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1330
|
+
deviceData.Device.Power = true;
|
|
1331
|
+
deviceData.Device.FanSpeed = 6;
|
|
1332
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
1355
1333
|
break;
|
|
1356
1334
|
case 37: //PHYSICAL LOCK CONTROLS
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1335
|
+
deviceData.Device.ProhibitSetTemperature = state;
|
|
1336
|
+
deviceData.Device.ProhibitOperationMode = state;
|
|
1337
|
+
deviceData.Device.ProhibitPower = state;
|
|
1338
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Prohibit;
|
|
1361
1339
|
break;
|
|
1362
1340
|
case 38: //PHYSICAL LOCK CONTROLS POWER
|
|
1363
|
-
|
|
1364
|
-
|
|
1341
|
+
deviceData.Device.ProhibitPower = state;
|
|
1342
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Prohibit;
|
|
1365
1343
|
break;
|
|
1366
1344
|
case 39: //PHYSICAL LOCK CONTROLS MODE
|
|
1367
|
-
|
|
1368
|
-
|
|
1345
|
+
deviceData.Device.ProhibitOperationMode = state;
|
|
1346
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Prohibit;
|
|
1369
1347
|
break;
|
|
1370
1348
|
case 40: //PHYSICAL LOCK CONTROLS TEMP
|
|
1371
|
-
|
|
1372
|
-
|
|
1349
|
+
deviceData.Device.ProhibitSetTemperature = state;
|
|
1350
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Prohibit;
|
|
1373
1351
|
break;
|
|
1374
1352
|
default:
|
|
1375
1353
|
this.emit('message', `Unknown button mode: ${mode}`);
|
|
1376
1354
|
break;
|
|
1377
1355
|
};
|
|
1378
1356
|
|
|
1379
|
-
await this.melCloudAta.send(
|
|
1357
|
+
await this.melCloudAta.send(deviceData);
|
|
1380
1358
|
const info = this.disableLogInfo ? false : this.emit('message', `Set: ${buttonName}`);
|
|
1381
1359
|
} catch (error) {
|
|
1382
1360
|
this.emit('warn', `Set button error: ${error}`);
|
|
1383
1361
|
};
|
|
1384
1362
|
});
|
|
1385
|
-
};
|
|
1386
1363
|
this.buttonsServices.push(buttonService);
|
|
1387
1364
|
accessory.addService(buttonService);
|
|
1388
1365
|
};
|