homebridge-melcloud-control 3.8.1 → 3.8.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/deviceata.js +171 -157
- package/src/deviceatw.js +112 -101
- package/src/deviceerv.js +150 -141
package/src/deviceata.js
CHANGED
|
@@ -44,6 +44,10 @@ class DeviceAta extends EventEmitter {
|
|
|
44
44
|
this.mqtt = mqtt;
|
|
45
45
|
this.mqttConnected = false;
|
|
46
46
|
|
|
47
|
+
//variables
|
|
48
|
+
this.useFahrenheit = useFahrenheit ? 1 : 0;
|
|
49
|
+
this.temperatureUnit = TemperatureDisplayUnits[this.useFahrenheit];
|
|
50
|
+
|
|
47
51
|
//function
|
|
48
52
|
this.melCloud = melCloud; //function
|
|
49
53
|
|
|
@@ -57,9 +61,9 @@ class DeviceAta extends EventEmitter {
|
|
|
57
61
|
|
|
58
62
|
const presetyServiceType = ['', Service.Outlet, Service.Switch, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][displayType];
|
|
59
63
|
const presetCharacteristicType = ['', Characteristic.On, Characteristic.On, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][displayType];
|
|
60
|
-
preset.name = preset.name || 'Preset'
|
|
61
64
|
preset.serviceType = presetyServiceType;
|
|
62
65
|
preset.characteristicType = presetCharacteristicType;
|
|
66
|
+
preset.name = preset.name || 'Preset'
|
|
63
67
|
preset.state = false;
|
|
64
68
|
preset.previousSettings = {};
|
|
65
69
|
this.presetsConfigured.push(preset);
|
|
@@ -76,9 +80,9 @@ class DeviceAta extends EventEmitter {
|
|
|
76
80
|
|
|
77
81
|
const buttonServiceType = ['', Service.Outlet, Service.Switch, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][displayType];
|
|
78
82
|
const buttonCharacteristicType = ['', Characteristic.On, Characteristic.On, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][displayType];
|
|
79
|
-
button.name = button.name || 'Button'
|
|
80
83
|
button.serviceType = buttonServiceType;
|
|
81
84
|
button.characteristicType = buttonCharacteristicType;
|
|
85
|
+
button.name = button.name || 'Button'
|
|
82
86
|
button.state = false;
|
|
83
87
|
button.previousValue = null;
|
|
84
88
|
this.buttonsConfigured.push(button);;
|
|
@@ -89,9 +93,7 @@ class DeviceAta extends EventEmitter {
|
|
|
89
93
|
this.deviceData = {};
|
|
90
94
|
|
|
91
95
|
//accessory
|
|
92
|
-
this.
|
|
93
|
-
this.accessory.useFahrenheit = useFahrenheit ? 1 : 0;
|
|
94
|
-
this.accessory.temperatureUnit = TemperatureDisplayUnits[this.accessory.useFahrenheit];
|
|
96
|
+
this.mielHvac = {};
|
|
95
97
|
};
|
|
96
98
|
|
|
97
99
|
async externalIntegrations() {
|
|
@@ -259,19 +261,19 @@ class DeviceAta extends EventEmitter {
|
|
|
259
261
|
//prepare accessory
|
|
260
262
|
async prepareAccessory(accountInfo, deviceData, deviceId, deviceTypeText, deviceName, accountName) {
|
|
261
263
|
try {
|
|
262
|
-
const presetsOnServer = this.
|
|
263
|
-
const modelSupportsHeat = this.
|
|
264
|
-
const modelSupportsDry = this.
|
|
265
|
-
const modelSupportsCool = this.
|
|
266
|
-
const modelSupportsAuto = this.
|
|
267
|
-
const modelSupportsFanSpeed = this.
|
|
268
|
-
const hasAutomaticFanSpeed = this.
|
|
269
|
-
const hasOutdoorTemperature = this.
|
|
270
|
-
const numberOfFanSpeeds = this.
|
|
271
|
-
const swingFunction = this.
|
|
272
|
-
const autoDryFanMode = [this.
|
|
273
|
-
const heatDryFanMode = [this.
|
|
274
|
-
const coolDryFanMode = [this.
|
|
264
|
+
const presetsOnServer = this.mielHvac.presets;
|
|
265
|
+
const modelSupportsHeat = this.mielHvac.modelSupportsHeat;
|
|
266
|
+
const modelSupportsDry = this.mielHvac.modelSupportsDry;
|
|
267
|
+
const modelSupportsCool = this.mielHvac.modelSupportsCool;
|
|
268
|
+
const modelSupportsAuto = this.mielHvac.modelSupportsAuto;
|
|
269
|
+
const modelSupportsFanSpeed = this.mielHvac.modelSupportsFanSpeed;
|
|
270
|
+
const hasAutomaticFanSpeed = this.mielHvac.hasAutomaticFanSpeed;
|
|
271
|
+
const hasOutdoorTemperature = this.mielHvac.hasOutdoorTemperature;
|
|
272
|
+
const numberOfFanSpeeds = this.mielHvac.numberOfFanSpeeds;
|
|
273
|
+
const swingFunction = this.mielHvac.swingFunction;
|
|
274
|
+
const autoDryFanMode = [this.mielHvac.operationMode, 8, modelSupportsDry ? 2 : 8, 7][this.autoDryFanMode]; //NONE, AUTO - 8, DRY - 2, FAN - 7
|
|
275
|
+
const heatDryFanMode = [this.mielHvac.operationMode, 1, modelSupportsDry ? 2 : 1, 7][this.heatDryFanMode]; //NONE, HEAT - 1, DRY - 2, FAN - 7
|
|
276
|
+
const coolDryFanMode = [this.mielHvac.operationMode, 3, modelSupportsDry ? 2 : 3, 7][this.coolDryFanMode]; //NONE, COOL - 3, DRY - 2, FAN - 7
|
|
275
277
|
|
|
276
278
|
//accessory
|
|
277
279
|
const debug = this.enableDebugMode ? this.emit('debug', `Prepare accessory`) : false;
|
|
@@ -298,7 +300,7 @@ class DeviceAta extends EventEmitter {
|
|
|
298
300
|
this.melCloudService.setPrimaryService(true);
|
|
299
301
|
this.melCloudService.getCharacteristic(Characteristic.Active)
|
|
300
302
|
.onGet(async () => {
|
|
301
|
-
const state = this.
|
|
303
|
+
const state = this.mielHvac.power;
|
|
302
304
|
return state;
|
|
303
305
|
})
|
|
304
306
|
.onSet(async (state) => {
|
|
@@ -313,17 +315,17 @@ class DeviceAta extends EventEmitter {
|
|
|
313
315
|
});
|
|
314
316
|
this.melCloudService.getCharacteristic(Characteristic.CurrentHeaterCoolerState)
|
|
315
317
|
.onGet(async () => {
|
|
316
|
-
const value = this.
|
|
318
|
+
const value = this.mielHvac.currentOperationMode;
|
|
317
319
|
return value;
|
|
318
320
|
});
|
|
319
321
|
this.melCloudService.getCharacteristic(Characteristic.TargetHeaterCoolerState)
|
|
320
322
|
.setProps({
|
|
321
|
-
minValue: this.
|
|
322
|
-
maxValue: this.
|
|
323
|
-
validValues: this.
|
|
323
|
+
minValue: this.mielHvac.operationModeSetPropsMinValue,
|
|
324
|
+
maxValue: this.mielHvac.operationModeSetPropsMaxValue,
|
|
325
|
+
validValues: this.mielHvac.operationModeSetPropsValidValues
|
|
324
326
|
})
|
|
325
327
|
.onGet(async () => {
|
|
326
|
-
const value = this.
|
|
328
|
+
const value = this.mielHvac.targetOperationMode; //1 = HEAT, 2 = DRY 3 = COOL, 7 = FAN, 8 = AUTO
|
|
327
329
|
return value;
|
|
328
330
|
})
|
|
329
331
|
.onSet(async (value) => {
|
|
@@ -350,18 +352,18 @@ class DeviceAta extends EventEmitter {
|
|
|
350
352
|
});
|
|
351
353
|
this.melCloudService.getCharacteristic(Characteristic.CurrentTemperature)
|
|
352
354
|
.onGet(async () => {
|
|
353
|
-
const value = this.
|
|
355
|
+
const value = this.mielHvac.roomTemperature;
|
|
354
356
|
return value;
|
|
355
357
|
});
|
|
356
358
|
if (modelSupportsFanSpeed) {
|
|
357
359
|
this.melCloudService.getCharacteristic(Characteristic.RotationSpeed)
|
|
358
360
|
.setProps({
|
|
359
361
|
minValue: 0,
|
|
360
|
-
maxValue: this.
|
|
362
|
+
maxValue: this.mielHvac.fanSpeedSetPropsMaxValue,
|
|
361
363
|
minStep: 1
|
|
362
364
|
})
|
|
363
365
|
.onGet(async () => {
|
|
364
|
-
const value = this.
|
|
366
|
+
const value = this.mielHvac.fanSpeed; //AUTO, 1, 2, 3, 4, 5, 6, OFF
|
|
365
367
|
return value;
|
|
366
368
|
})
|
|
367
369
|
.onSet(async (value) => {
|
|
@@ -401,7 +403,7 @@ class DeviceAta extends EventEmitter {
|
|
|
401
403
|
this.melCloudService.getCharacteristic(Characteristic.SwingMode)
|
|
402
404
|
.onGet(async () => {
|
|
403
405
|
//Vane Horizontal: Auto, 1, 2, 3, 4, 5, 6, 12 = Swing //Vertical: Auto, 1, 2, 3, 4, 5, 7 = Swing
|
|
404
|
-
const value = this.
|
|
406
|
+
const value = this.mielHvac.swingMode;
|
|
405
407
|
return value;
|
|
406
408
|
})
|
|
407
409
|
.onSet(async (value) => {
|
|
@@ -418,12 +420,12 @@ class DeviceAta extends EventEmitter {
|
|
|
418
420
|
};
|
|
419
421
|
this.melCloudService.getCharacteristic(Characteristic.CoolingThresholdTemperature)
|
|
420
422
|
.setProps({
|
|
421
|
-
minValue: this.
|
|
422
|
-
maxValue: this.
|
|
423
|
-
minStep: this.
|
|
423
|
+
minValue: this.mielHvac.minTempCoolDry,
|
|
424
|
+
maxValue: this.mielHvac.maxTempCoolDry,
|
|
425
|
+
minStep: this.mielHvac.temperatureIncrement
|
|
424
426
|
})
|
|
425
427
|
.onGet(async () => {
|
|
426
|
-
const value = this.
|
|
428
|
+
const value = this.mielHvac.operationMode === 8 ? this.mielHvac.defaultCoolingSetTemperature : this.mielHvac.setTemperature;
|
|
427
429
|
return value;
|
|
428
430
|
})
|
|
429
431
|
.onSet(async (value) => {
|
|
@@ -431,7 +433,7 @@ class DeviceAta extends EventEmitter {
|
|
|
431
433
|
deviceData.Device.DefaultCoolingSetTemperature = value;
|
|
432
434
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
433
435
|
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
434
|
-
const info = this.disableLogInfo ? false : this.emit('message', `Set cooling threshold temperature: ${value}${this.
|
|
436
|
+
const info = this.disableLogInfo ? false : this.emit('message', `Set cooling threshold temperature: ${value}${this.mielHvac.temperatureUnit}`);
|
|
435
437
|
} catch (error) {
|
|
436
438
|
this.emit('warn', `Set cooling threshold temperature error: ${error}`);
|
|
437
439
|
};
|
|
@@ -439,12 +441,12 @@ class DeviceAta extends EventEmitter {
|
|
|
439
441
|
if (modelSupportsHeat) {
|
|
440
442
|
this.melCloudService.getCharacteristic(Characteristic.HeatingThresholdTemperature)
|
|
441
443
|
.setProps({
|
|
442
|
-
minValue: this.
|
|
443
|
-
maxValue: this.
|
|
444
|
-
minStep: this.
|
|
444
|
+
minValue: this.mielHvac.minTempHeat,
|
|
445
|
+
maxValue: this.mielHvac.maxTempHeat,
|
|
446
|
+
minStep: this.mielHvac.temperatureIncrement
|
|
445
447
|
})
|
|
446
448
|
.onGet(async () => {
|
|
447
|
-
const value = this.
|
|
449
|
+
const value = this.mielHvac.operationMode === 8 ? this.mielHvac.defaultHeatingSetTemperature : this.mielHvac.setTemperature;
|
|
448
450
|
return value;
|
|
449
451
|
})
|
|
450
452
|
.onSet(async (value) => {
|
|
@@ -452,7 +454,7 @@ class DeviceAta extends EventEmitter {
|
|
|
452
454
|
deviceData.Device.DefaultHeatingSetTemperature = value;
|
|
453
455
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
454
456
|
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
455
|
-
const info = this.disableLogInfo ? false : this.emit('message', `Set heating threshold temperature: ${value}${this.
|
|
457
|
+
const info = this.disableLogInfo ? false : this.emit('message', `Set heating threshold temperature: ${value}${this.mielHvac.temperatureUnit}`);
|
|
456
458
|
} catch (error) {
|
|
457
459
|
this.emit('warn', `Set heating threshold temperature error: ${error}`);
|
|
458
460
|
};
|
|
@@ -460,7 +462,7 @@ class DeviceAta extends EventEmitter {
|
|
|
460
462
|
};
|
|
461
463
|
this.melCloudService.getCharacteristic(Characteristic.LockPhysicalControls)
|
|
462
464
|
.onGet(async () => {
|
|
463
|
-
const value = this.
|
|
465
|
+
const value = this.mielHvac.lockPhysicalControl;
|
|
464
466
|
return value;
|
|
465
467
|
})
|
|
466
468
|
.onSet(async (value) => {
|
|
@@ -478,14 +480,14 @@ class DeviceAta extends EventEmitter {
|
|
|
478
480
|
});
|
|
479
481
|
this.melCloudService.getCharacteristic(Characteristic.TemperatureDisplayUnits)
|
|
480
482
|
.onGet(async () => {
|
|
481
|
-
const value = this.
|
|
483
|
+
const value = this.mielHvac.useFahrenheit;
|
|
482
484
|
return value;
|
|
483
485
|
})
|
|
484
486
|
.onSet(async (value) => {
|
|
485
487
|
try {
|
|
486
488
|
accountInfo.UseFahrenheit = [false, true][value];
|
|
487
489
|
await this.melCloud.send(accountInfo);
|
|
488
|
-
this.
|
|
490
|
+
this.mielHvac.useFahrenheit = value;
|
|
489
491
|
const info = this.disableLogInfo ? false : this.emit('message', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
490
492
|
} catch (error) {
|
|
491
493
|
this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
@@ -499,17 +501,17 @@ class DeviceAta extends EventEmitter {
|
|
|
499
501
|
this.melCloudService.setPrimaryService(true);
|
|
500
502
|
this.melCloudService.getCharacteristic(Characteristic.CurrentHeatingCoolingState)
|
|
501
503
|
.onGet(async () => {
|
|
502
|
-
const value = this.
|
|
504
|
+
const value = this.mielHvac.currentOperationMode;
|
|
503
505
|
return value;
|
|
504
506
|
});
|
|
505
507
|
this.melCloudService.getCharacteristic(Characteristic.TargetHeatingCoolingState)
|
|
506
508
|
.setProps({
|
|
507
|
-
minValue: this.
|
|
508
|
-
maxValue: this.
|
|
509
|
-
validValues: this.
|
|
509
|
+
minValue: this.mielHvac.operationModeSetPropsMinValue,
|
|
510
|
+
maxValue: this.mielHvac.operationModeSetPropsMaxValue,
|
|
511
|
+
validValues: this.mielHvac.operationModeSetPropsValidValues
|
|
510
512
|
})
|
|
511
513
|
.onGet(async () => {
|
|
512
|
-
const value = this.
|
|
514
|
+
const value = this.mielHvac.targetOperationMode; //1 = HEAT, 2 = DRY 3 = COOL, 7 = FAN, 8 = AUTO
|
|
513
515
|
return value;
|
|
514
516
|
})
|
|
515
517
|
.onSet(async (value) => {
|
|
@@ -545,17 +547,17 @@ class DeviceAta extends EventEmitter {
|
|
|
545
547
|
});
|
|
546
548
|
this.melCloudService.getCharacteristic(Characteristic.CurrentTemperature)
|
|
547
549
|
.onGet(async () => {
|
|
548
|
-
const value = this.
|
|
550
|
+
const value = this.mielHvac.roomTemperature;
|
|
549
551
|
return value;
|
|
550
552
|
});
|
|
551
553
|
this.melCloudService.getCharacteristic(Characteristic.TargetTemperature)
|
|
552
554
|
.setProps({
|
|
553
|
-
minValue: this.
|
|
554
|
-
maxValue: this.
|
|
555
|
-
minStep: this.
|
|
555
|
+
minValue: this.mielHvac.minTempHeat,
|
|
556
|
+
maxValue: this.mielHvac.maxTempHeat,
|
|
557
|
+
minStep: this.mielHvac.temperatureIncrement
|
|
556
558
|
})
|
|
557
559
|
.onGet(async () => {
|
|
558
|
-
const value = this.
|
|
560
|
+
const value = this.mielHvac.setTemperature;
|
|
559
561
|
return value;
|
|
560
562
|
})
|
|
561
563
|
.onSet(async (value) => {
|
|
@@ -563,21 +565,21 @@ class DeviceAta extends EventEmitter {
|
|
|
563
565
|
deviceData.Device.SetTemperature = value;
|
|
564
566
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
565
567
|
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
566
|
-
const info = this.disableLogInfo ? false : this.emit('message', `Set temperature: ${value}${this.
|
|
568
|
+
const info = this.disableLogInfo ? false : this.emit('message', `Set temperature: ${value}${this.mielHvac.temperatureUnit}`);
|
|
567
569
|
} catch (error) {
|
|
568
570
|
this.emit('warn', `Set temperature error: ${error}`);
|
|
569
571
|
};
|
|
570
572
|
});
|
|
571
573
|
this.melCloudService.getCharacteristic(Characteristic.TemperatureDisplayUnits)
|
|
572
574
|
.onGet(async () => {
|
|
573
|
-
const value = this.
|
|
575
|
+
const value = this.mielHvac.useFahrenheit;
|
|
574
576
|
return value;
|
|
575
577
|
})
|
|
576
578
|
.onSet(async (value) => {
|
|
577
579
|
try {
|
|
578
580
|
accountInfo.UseFahrenheit = [false, true][value];
|
|
579
581
|
await this.melCloud.send(accountInfo);
|
|
580
|
-
this.
|
|
582
|
+
this.mielHvac.useFahrenheit = value;
|
|
581
583
|
const info = this.disableLogInfo ? false : this.emit('message', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
582
584
|
} catch (error) {
|
|
583
585
|
this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
@@ -588,7 +590,7 @@ class DeviceAta extends EventEmitter {
|
|
|
588
590
|
};
|
|
589
591
|
|
|
590
592
|
//temperature sensor services
|
|
591
|
-
if (this.temperatureSensor && this.
|
|
593
|
+
if (this.temperatureSensor && this.mielHvac.roomTemperature !== null) {
|
|
592
594
|
const debug = this.enableDebugMode ? this.emit('debug', `Prepare room temperature sensor service`) : false;
|
|
593
595
|
this.roomTemperatureSensorService = new Service.TemperatureSensor(`${serviceName} Room`, `Room Temperature Sensor ${deviceId}`);
|
|
594
596
|
this.roomTemperatureSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
@@ -600,13 +602,13 @@ class DeviceAta extends EventEmitter {
|
|
|
600
602
|
minStep: 0.5
|
|
601
603
|
})
|
|
602
604
|
.onGet(async () => {
|
|
603
|
-
const state = this.
|
|
605
|
+
const state = this.mielHvac.roomTemperature;
|
|
604
606
|
return state;
|
|
605
607
|
})
|
|
606
608
|
accessory.addService(this.roomTemperatureSensorService);
|
|
607
609
|
};
|
|
608
610
|
|
|
609
|
-
if (this.temperatureSensorOutdoor && hasOutdoorTemperature && this.
|
|
611
|
+
if (this.temperatureSensorOutdoor && hasOutdoorTemperature && this.mielHvac.outdoorTemperature !== null) {
|
|
610
612
|
const debug = this.enableDebugMode ? this.emit('debug', `Prepare outdoor temperature sensor service`) : false;
|
|
611
613
|
this.outdoorTemperatureSensorService = new Service.TemperatureSensor(`${serviceName} Outdoor`, `Outdoor Temperature Sensor ${deviceId}`);
|
|
612
614
|
this.outdoorTemperatureSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
@@ -618,7 +620,7 @@ class DeviceAta extends EventEmitter {
|
|
|
618
620
|
minStep: 0.5
|
|
619
621
|
})
|
|
620
622
|
.onGet(async () => {
|
|
621
|
-
const state = this.
|
|
623
|
+
const state = this.mielHvac.outdoorTemperature;
|
|
622
624
|
return state;
|
|
623
625
|
})
|
|
624
626
|
accessory.addService(this.outdoorTemperatureSensorService);
|
|
@@ -1016,106 +1018,117 @@ class DeviceAta extends EventEmitter {
|
|
|
1016
1018
|
const outdoorTemperature = deviceData.Device.OutdoorTemperature;
|
|
1017
1019
|
|
|
1018
1020
|
//accessory
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1021
|
+
const obj = {
|
|
1022
|
+
presets: presetsOnServer,
|
|
1023
|
+
hasAutomaticFanSpeed: hasAutomaticFanSpeed,
|
|
1024
|
+
airDirectionFunction: airDirectionFunction,
|
|
1025
|
+
swingFunction: swingFunction,
|
|
1026
|
+
hasOutdoorTemperature: hasOutdoorTemperature,
|
|
1027
|
+
numberOfFanSpeeds: numberOfFanSpeeds,
|
|
1028
|
+
modelSupportsFanSpeed: modelSupportsFanSpeed,
|
|
1029
|
+
modelSupportsAuto: modelSupportsAuto,
|
|
1030
|
+
modelSupportsHeat: modelSupportsHeat,
|
|
1031
|
+
modelSupportsDry: modelSupportsDry,
|
|
1032
|
+
modelSupportsCool: modelSupportsCool,
|
|
1033
|
+
minTempHeat: minTempHeat,
|
|
1034
|
+
maxTempHeat: maxTempHeat,
|
|
1035
|
+
minTempCoolDry: minTempCoolDry,
|
|
1036
|
+
maxTempCoolDry: maxTempCoolDry,
|
|
1037
|
+
power: power ? 1 : 0,
|
|
1038
|
+
inStandbyMode: inStandbyMode,
|
|
1039
|
+
operationMode: operationMode,
|
|
1040
|
+
currentOperationMode: 0,
|
|
1041
|
+
targetOperationMode: 0,
|
|
1042
|
+
roomTemperature: roomTemperature,
|
|
1043
|
+
outdoorTemperature: outdoorTemperature,
|
|
1044
|
+
setTemperature: setTemperature,
|
|
1045
|
+
defaultHeatingSetTemperature: defaultHeatingSetTemperature,
|
|
1046
|
+
defaultCoolingSetTemperature: defaultCoolingSetTemperature,
|
|
1047
|
+
fanSpeed: 0,
|
|
1048
|
+
actualFanSpeed: actualFanSpeed,
|
|
1049
|
+
automaticFanSpeed: automaticFanSpeed,
|
|
1050
|
+
vaneVerticalSwing: vaneVerticalSwing,
|
|
1051
|
+
vaneHorizontalSwing: vaneHorizontalSwing,
|
|
1052
|
+
swingMode: swingFunction && vaneHorizontalDirection === 12 && vaneVerticalDirection === 7 ? 1 : 0,
|
|
1053
|
+
lockPhysicalControl: prohibitSetTemperature && prohibitOperationMode && prohibitPower ? 1 : 0,
|
|
1054
|
+
useFahrenheit: this.useFahrenheit,
|
|
1055
|
+
temperatureUnit: this.useFahrenheit,
|
|
1056
|
+
temperatureIncrement: temperatureIncrement,
|
|
1057
|
+
operationModeSetPropsMinValue: 0,
|
|
1058
|
+
operationModeSetPropsMaxValue: 2,
|
|
1059
|
+
operationModeSetPropsValidValues: [0, 1, 2],
|
|
1060
|
+
fanSpeedSetPropsMaxValue: 6
|
|
1061
|
+
|
|
1062
|
+
};
|
|
1050
1063
|
|
|
1051
1064
|
//operating mode 0, HEAT, DRY, COOL, 4, 5, 6, FAN, AUTO, ISEE HEAT, ISEE DRY, ISEE COOL
|
|
1052
1065
|
switch (this.displayMode) {
|
|
1053
1066
|
case 1: //Heater Cooler
|
|
1054
1067
|
switch (operationMode) {
|
|
1055
1068
|
case 1: //HEAT
|
|
1056
|
-
|
|
1057
|
-
|
|
1069
|
+
obj.currentOperationMode = roomTemperature > setTemperature ? 1 : 2; //INACTIVE, IDLE, HEATING, COOLING
|
|
1070
|
+
obj.targetOperationMode = 1; //AUTO, HEAT, COOL
|
|
1058
1071
|
break;
|
|
1059
1072
|
case 2: //DRY
|
|
1060
|
-
|
|
1061
|
-
|
|
1073
|
+
obj.currentOperationMode = 1;
|
|
1074
|
+
obj.targetOperationMode = this.autoDryFanMode === 2 ? 0 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : obj.targetOperationMode ?? 0;
|
|
1062
1075
|
break;
|
|
1063
1076
|
case 3: //COOL
|
|
1064
|
-
|
|
1065
|
-
|
|
1077
|
+
obj.currentOperationMode = roomTemperature < setTemperature ? 1 : 3;
|
|
1078
|
+
obj.targetOperationMode = 2;
|
|
1066
1079
|
break;
|
|
1067
1080
|
case 7: //FAN
|
|
1068
|
-
|
|
1069
|
-
|
|
1081
|
+
obj.currentOperationMode = 1;
|
|
1082
|
+
obj.targetOperationMode = this.autoDryFanMode === 3 ? 0 : this.heatDryFanMode === 3 ? 1 : this.coolDryFanMode === 3 ? 2 : obj.targetOperationMode ?? 0;
|
|
1070
1083
|
break;
|
|
1071
1084
|
case 8: //AUTO
|
|
1072
|
-
|
|
1073
|
-
|
|
1085
|
+
obj.currentOperationMode = roomTemperature > setTemperature ? 3 : roomTemperature < setTemperature ? 2 : 1;
|
|
1086
|
+
obj.targetOperationMode = 0;
|
|
1074
1087
|
break;
|
|
1075
1088
|
case 9: //ISEE HEAT
|
|
1076
|
-
|
|
1077
|
-
|
|
1089
|
+
obj.currentOperationMode = roomTemperature > setTemperature ? 1 : 2
|
|
1090
|
+
obj.targetOperationMode = 1;
|
|
1078
1091
|
break;
|
|
1079
1092
|
case 10: //ISEE DRY
|
|
1080
|
-
|
|
1081
|
-
|
|
1093
|
+
obj.currentOperationMode = 1;
|
|
1094
|
+
obj.targetOperationMode = this.autoDryFanMode === 2 ? 0 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : obj.targetOperationMode ?? 0;
|
|
1082
1095
|
break;
|
|
1083
1096
|
case 11: //ISEE COOL;
|
|
1084
|
-
|
|
1085
|
-
|
|
1097
|
+
obj.currentOperationMode = roomTemperature < setTemperature ? 1 : 3;
|
|
1098
|
+
obj.targetOperationMode = 2;
|
|
1086
1099
|
break;
|
|
1087
1100
|
default:
|
|
1088
1101
|
this.emit('warn', `Unknown operating mode: ${operationMode}`);
|
|
1089
1102
|
return
|
|
1090
1103
|
};
|
|
1091
1104
|
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1105
|
+
obj.currentOperationMode = !power ? 0 : inStandbyMode ? 1 : obj.currentOperationMode;
|
|
1106
|
+
obj.operationModeSetPropsMinValue = modelSupportsAuto && modelSupportsHeat ? 0 : !modelSupportsAuto && modelSupportsHeat ? 1 : modelSupportsAuto && !modelSupportsHeat ? 0 : 2;
|
|
1107
|
+
obj.operationModeSetPropsMaxValue = 2
|
|
1108
|
+
obj.operationModeSetPropsValidValues = modelSupportsAuto && modelSupportsHeat ? [0, 1, 2] : !modelSupportsAuto && modelSupportsHeat ? [1, 2] : modelSupportsAuto && !modelSupportsHeat ? [0, 2] : [2];
|
|
1096
1109
|
|
|
1097
1110
|
//fan speed mode
|
|
1098
1111
|
if (modelSupportsFanSpeed) {
|
|
1099
1112
|
switch (numberOfFanSpeeds) {
|
|
1100
1113
|
case 2: //Fan speed mode 2
|
|
1101
|
-
|
|
1102
|
-
|
|
1114
|
+
obj.fanSpeed = hasAutomaticFanSpeed ? [3, 1, 2][fanSpeed] : [0, 1, 2][fanSpeed];
|
|
1115
|
+
obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 3 : 2;
|
|
1103
1116
|
break;
|
|
1104
1117
|
case 3: //Fan speed mode 3
|
|
1105
|
-
|
|
1106
|
-
|
|
1118
|
+
obj.fanSpeed = hasAutomaticFanSpeed ? [4, 1, 2, 3][fanSpeed] : [0, 1, 2, 3][fanSpeed];
|
|
1119
|
+
obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 4 : 3;
|
|
1107
1120
|
break;
|
|
1108
1121
|
case 4: //Fan speed mode 4
|
|
1109
|
-
|
|
1110
|
-
|
|
1122
|
+
obj.fanSpeed = hasAutomaticFanSpeed ? [5, 1, 2, 3, 4][fanSpeed] : [0, 1, 2, 3, 4][fanSpeed];
|
|
1123
|
+
obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 5 : 4;
|
|
1111
1124
|
break;
|
|
1112
1125
|
case 5: //Fan speed mode 5
|
|
1113
|
-
|
|
1114
|
-
|
|
1126
|
+
obj.fanSpeed = hasAutomaticFanSpeed ? [6, 1, 2, 3, 4, 5][fanSpeed] : [0, 1, 2, 3, 4, 5][fanSpeed];
|
|
1127
|
+
obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 6 : 5;
|
|
1115
1128
|
break;
|
|
1116
1129
|
case 6: //Fan speed mode 6
|
|
1117
|
-
|
|
1118
|
-
|
|
1130
|
+
obj.fanSpeed = hasAutomaticFanSpeed ? [7, 1, 2, 3, 4, 5, 6][fanSpeed] : [0, 1, 2, 3, 4, 5, 6][fanSpeed];
|
|
1131
|
+
obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 7 : 6;
|
|
1119
1132
|
break;
|
|
1120
1133
|
};
|
|
1121
1134
|
};
|
|
@@ -1124,73 +1137,74 @@ class DeviceAta extends EventEmitter {
|
|
|
1124
1137
|
if (this.melCloudService) {
|
|
1125
1138
|
this.melCloudService
|
|
1126
1139
|
.updateCharacteristic(Characteristic.Active, power ? 1 : 0)
|
|
1127
|
-
.updateCharacteristic(Characteristic.CurrentHeaterCoolerState,
|
|
1128
|
-
.updateCharacteristic(Characteristic.TargetHeaterCoolerState,
|
|
1140
|
+
.updateCharacteristic(Characteristic.CurrentHeaterCoolerState, obj.currentOperationMode)
|
|
1141
|
+
.updateCharacteristic(Characteristic.TargetHeaterCoolerState, obj.targetOperationMode)
|
|
1129
1142
|
.updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature)
|
|
1130
|
-
.updateCharacteristic(Characteristic.LockPhysicalControls,
|
|
1131
|
-
.updateCharacteristic(Characteristic.TemperatureDisplayUnits,
|
|
1143
|
+
.updateCharacteristic(Characteristic.LockPhysicalControls, obj.lockPhysicalControl)
|
|
1144
|
+
.updateCharacteristic(Characteristic.TemperatureDisplayUnits, obj.useFahrenheit)
|
|
1132
1145
|
.updateCharacteristic(Characteristic.CoolingThresholdTemperature, defaultCoolingSetTemperature);
|
|
1133
1146
|
const updateDefHeat = modelSupportsHeat ? this.melCloudService.updateCharacteristic(Characteristic.HeatingThresholdTemperature, defaultHeatingSetTemperature) : false;
|
|
1134
|
-
const updateRS = modelSupportsFanSpeed ? this.melCloudService.updateCharacteristic(Characteristic.RotationSpeed,
|
|
1135
|
-
const updateSM = swingFunction ? this.melCloudService.updateCharacteristic(Characteristic.SwingMode,
|
|
1147
|
+
const updateRS = modelSupportsFanSpeed ? this.melCloudService.updateCharacteristic(Characteristic.RotationSpeed, obj.fanSpeed) : false;
|
|
1148
|
+
const updateSM = swingFunction ? this.melCloudService.updateCharacteristic(Characteristic.SwingMode, obj.swingMode) : false;
|
|
1136
1149
|
};
|
|
1137
1150
|
break;
|
|
1138
1151
|
case 2: //Thermostat
|
|
1139
1152
|
switch (operationMode) {
|
|
1140
1153
|
case 1: //HEAT
|
|
1141
|
-
|
|
1142
|
-
|
|
1154
|
+
obj.currentOperationMode = roomTemperature > setTemperature ? 0 : 1; //OFF, HEATING, COOLING
|
|
1155
|
+
obj.targetOperationMode = 1; //OFF, HEAT, COOL, AUTO
|
|
1143
1156
|
break;
|
|
1144
1157
|
case 2: //DRY
|
|
1145
|
-
|
|
1146
|
-
|
|
1158
|
+
obj.currentOperationMode = 0;
|
|
1159
|
+
obj.targetOperationMode = this.autoDryFanMode === 2 ? 3 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : obj.targetOperationMode ?? 0;
|
|
1147
1160
|
break;
|
|
1148
1161
|
case 3: //COOL
|
|
1149
|
-
|
|
1150
|
-
|
|
1162
|
+
obj.currentOperationMode = roomTemperature < setTemperature ? 0 : 2;
|
|
1163
|
+
obj.targetOperationMode = 2;
|
|
1151
1164
|
break;
|
|
1152
1165
|
case 7: //FAN
|
|
1153
|
-
|
|
1154
|
-
|
|
1166
|
+
obj.currentOperationMode = 0;
|
|
1167
|
+
obj.targetOperationMode = this.autoDryFanMode === 3 ? 3 : this.heatDryFanMode === 3 ? 1 : this.coolDryFanMode === 3 ? 2 : obj.targetOperationMode ?? 0;
|
|
1155
1168
|
break;
|
|
1156
1169
|
case 8: //AUTO
|
|
1157
|
-
|
|
1158
|
-
|
|
1170
|
+
obj.currentOperationMode = roomTemperature < setTemperature ? 1 : roomTemperature > setTemperature ? 2 : 0;
|
|
1171
|
+
obj.targetOperationMode = 3;
|
|
1159
1172
|
break;
|
|
1160
1173
|
case 9: //ISEE HEAT
|
|
1161
|
-
|
|
1162
|
-
|
|
1174
|
+
obj.currentOperationMode = roomTemperature > setTemperature ? 0 : 1;
|
|
1175
|
+
obj.targetOperationMode = 1;
|
|
1163
1176
|
break;
|
|
1164
1177
|
case 10: //ISEE DRY
|
|
1165
|
-
|
|
1166
|
-
|
|
1178
|
+
obj.currentOperationMode = 0;
|
|
1179
|
+
obj.targetOperationMode = this.autoDryFanMode === 2 ? 3 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : obj.targetOperationMode ?? 0;
|
|
1167
1180
|
break;
|
|
1168
1181
|
case 11: //ISEE COOL;
|
|
1169
|
-
|
|
1170
|
-
|
|
1182
|
+
obj.currentOperationMode = roomTemperature < setTemperature ? 0 : 2;
|
|
1183
|
+
obj.targetOperationMode = 2;
|
|
1171
1184
|
break;
|
|
1172
1185
|
default:
|
|
1173
1186
|
this.emit('warn', `Unknown operating mode: ${operationMode}`);
|
|
1174
1187
|
break;
|
|
1175
1188
|
};
|
|
1176
1189
|
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1190
|
+
obj.currentOperationMode = !power ? 0 : obj.currentOperationMode;
|
|
1191
|
+
obj.targetOperationMode = !power ? 0 : obj.targetOperationMode;
|
|
1192
|
+
obj.operationModeSetPropsMinValue = 0
|
|
1193
|
+
obj.operationModeSetPropsMaxValue = modelSupportsAuto && modelSupportsHeat ? 3 : !modelSupportsAuto && modelSupportsHeat ? 2 : modelSupportsAuto && !modelSupportsHeat ? 3 : 2;
|
|
1194
|
+
obj.operationModeSetPropsValidValues = modelSupportsAuto && modelSupportsHeat ? [0, 1, 2, 3] : !modelSupportsAuto && modelSupportsHeat ? [0, 1, 2] : modelSupportsAuto && !modelSupportsHeat ? [0, 2, 3] : [0, 2];
|
|
1182
1195
|
|
|
1183
1196
|
//update characteristics
|
|
1184
1197
|
if (this.melCloudService) {
|
|
1185
1198
|
this.melCloudService
|
|
1186
|
-
.updateCharacteristic(Characteristic.CurrentHeatingCoolingState,
|
|
1187
|
-
.updateCharacteristic(Characteristic.TargetHeatingCoolingState,
|
|
1199
|
+
.updateCharacteristic(Characteristic.CurrentHeatingCoolingState, obj.currentOperationMode)
|
|
1200
|
+
.updateCharacteristic(Characteristic.TargetHeatingCoolingState, obj.targetOperationMode)
|
|
1188
1201
|
.updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature)
|
|
1189
1202
|
.updateCharacteristic(Characteristic.TargetTemperature, setTemperature)
|
|
1190
|
-
.updateCharacteristic(Characteristic.TemperatureDisplayUnits,
|
|
1203
|
+
.updateCharacteristic(Characteristic.TemperatureDisplayUnits, obj.useFahrenheit);
|
|
1191
1204
|
};
|
|
1192
1205
|
break;
|
|
1193
1206
|
};
|
|
1207
|
+
this.mielHvac = obj;
|
|
1194
1208
|
|
|
1195
1209
|
if (this.roomTemperatureSensorService) {
|
|
1196
1210
|
this.roomTemperatureSensorService
|
|
@@ -1321,7 +1335,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1321
1335
|
button.state = power ? (fanSpeed === 6) : false;
|
|
1322
1336
|
break;
|
|
1323
1337
|
case 37: //PHYSICAL LOCK CONTROLS ALL
|
|
1324
|
-
button.state = (
|
|
1338
|
+
button.state = (obj.lockPhysicalControl === 1);
|
|
1325
1339
|
break;
|
|
1326
1340
|
case 38: //PHYSICAL LOCK CONTROLS POWER
|
|
1327
1341
|
button.state = (prohibitPower === true);
|
|
@@ -1350,17 +1364,17 @@ class DeviceAta extends EventEmitter {
|
|
|
1350
1364
|
if (!this.disableLogInfo) {
|
|
1351
1365
|
this.emit('message', `Power: ${power ? 'ON' : 'OFF'}`);
|
|
1352
1366
|
this.emit('message', `Target operation mode: ${AirConditioner.DriveMode[operationMode]}`);
|
|
1353
|
-
this.emit('message', `Current operation mode: ${this.displayMode === 1 ? AirConditioner.CurrentOperationModeHeatherCooler[
|
|
1354
|
-
this.emit('message', `Target temperature: ${setTemperature}${
|
|
1355
|
-
this.emit('message', `Current temperature: ${roomTemperature}${
|
|
1356
|
-
const info = hasOutdoorTemperature && outdoorTemperature !== null ? this.emit('message', `Outdoor temperature: ${outdoorTemperature}${
|
|
1367
|
+
this.emit('message', `Current operation mode: ${this.displayMode === 1 ? AirConditioner.CurrentOperationModeHeatherCooler[obj.currentOperationMode] : AirConditioner.CurrentOperationModeThermostat[obj.currentOperationMode]}`);
|
|
1368
|
+
this.emit('message', `Target temperature: ${setTemperature}${obj.temperatureUnit}`);
|
|
1369
|
+
this.emit('message', `Current temperature: ${roomTemperature}${obj.temperatureUnit}`);
|
|
1370
|
+
const info = hasOutdoorTemperature && outdoorTemperature !== null ? this.emit('message', `Outdoor temperature: ${outdoorTemperature}${obj.temperatureUnit}`) : false;
|
|
1357
1371
|
const info3 = modelSupportsFanSpeed ? this.emit('message', `Target fan speed: ${AirConditioner.FanSpeed[fanSpeed]}`) : false;
|
|
1358
1372
|
const info4 = modelSupportsFanSpeed ? this.emit('message', `Current fan speed: ${AirConditioner.FanSpeed[actualFanSpeed]}`) : false;
|
|
1359
1373
|
const info5 = vaneHorizontalDirection !== null ? this.emit('message', `Vane horizontal: ${AirConditioner.HorizontalVane[vaneHorizontalDirection] ?? vaneHorizontalDirection}`) : false;
|
|
1360
1374
|
const info6 = vaneVerticalDirection !== null ? this.emit('message', `Vane vertical: ${AirConditioner.VerticalVane[vaneVerticalDirection] ?? vaneVerticalDirection}`) : false;
|
|
1361
|
-
const info7 = swingFunction ? this.emit('message', `Air direction: ${AirConditioner.AirDirection[
|
|
1362
|
-
this.emit('message', `Temperature display unit: ${
|
|
1363
|
-
this.emit('message', `Lock physical controls: ${
|
|
1375
|
+
const info7 = swingFunction ? this.emit('message', `Air direction: ${AirConditioner.AirDirection[obj.swingMode]}`) : false;
|
|
1376
|
+
this.emit('message', `Temperature display unit: ${obj.temperatureUnit}`);
|
|
1377
|
+
this.emit('message', `Lock physical controls: ${obj.lockPhysicalControl ? 'LOCKED' : 'UNLOCKED'}`);
|
|
1364
1378
|
};
|
|
1365
1379
|
|
|
1366
1380
|
//prepare accessory
|