homebridge-melcloud-control 3.8.0 → 3.8.2-beta.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.
- package/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/deviceata.js +165 -157
- package/src/deviceatw.js +106 -100
- package/src/deviceerv.js +150 -141
package/src/deviceerv.js
CHANGED
|
@@ -42,6 +42,10 @@ class DeviceErv extends EventEmitter {
|
|
|
42
42
|
this.mqtt = mqtt;
|
|
43
43
|
this.mqttConnected = false;
|
|
44
44
|
|
|
45
|
+
//variables
|
|
46
|
+
this.useFahrenheit = useFahrenheit ? 1 : 0;
|
|
47
|
+
this.temperatureUnit = TemperatureDisplayUnits[this.useFahrenheit];
|
|
48
|
+
|
|
45
49
|
//function
|
|
46
50
|
this.melCloud = melCloud; //function
|
|
47
51
|
|
|
@@ -87,9 +91,7 @@ class DeviceErv extends EventEmitter {
|
|
|
87
91
|
this.deviceData = {};
|
|
88
92
|
|
|
89
93
|
//accessory
|
|
90
|
-
this.
|
|
91
|
-
this.accessory.useFahrenheit = useFahrenheit ? 1 : 0;
|
|
92
|
-
this.accessory.temperatureUnit = TemperatureDisplayUnits[this.accessory.useFahrenheit];
|
|
94
|
+
this.mielHvac = {};
|
|
93
95
|
};
|
|
94
96
|
|
|
95
97
|
async externalIntegrations() {
|
|
@@ -247,18 +249,18 @@ class DeviceErv extends EventEmitter {
|
|
|
247
249
|
//prepare accessory
|
|
248
250
|
async prepareAccessory(accountInfo, deviceData, deviceId, deviceTypeText, deviceName, accountName) {
|
|
249
251
|
try {
|
|
250
|
-
const presetsOnServer = this.
|
|
251
|
-
const hasRoomTemperature = this.
|
|
252
|
-
const hasSupplyTemperature = this.
|
|
253
|
-
const hasOutdoorTemperature = this.
|
|
254
|
-
const hasCoolOperationMode = this.
|
|
255
|
-
const hasHeatOperationMode = this.
|
|
256
|
-
const hasAutoVentilationMode = this.
|
|
257
|
-
const hasBypassVentilationMode = this.
|
|
258
|
-
const hasAutomaticFanSpeed = this.
|
|
259
|
-
const hasCO2Sensor = this.
|
|
260
|
-
const hasPM25Sensor = this.
|
|
261
|
-
const numberOfFanSpeeds = this.
|
|
252
|
+
const presetsOnServer = this.mielHvac.presets;
|
|
253
|
+
const hasRoomTemperature = this.mielHvac.hasRoomTemperature;
|
|
254
|
+
const hasSupplyTemperature = this.mielHvac.hasSupplyTemperature;
|
|
255
|
+
const hasOutdoorTemperature = this.mielHvac.hasOutdoorTemperature;
|
|
256
|
+
const hasCoolOperationMode = this.mielHvac.hasCoolOperationMode;
|
|
257
|
+
const hasHeatOperationMode = this.mielHvac.hasHeatOperationMode;
|
|
258
|
+
const hasAutoVentilationMode = this.mielHvac.hasAutoVentilationMode;
|
|
259
|
+
const hasBypassVentilationMode = this.mielHvac.hasBypassVentilationMode;
|
|
260
|
+
const hasAutomaticFanSpeed = this.mielHvac.hasAutomaticFanSpeed;
|
|
261
|
+
const hasCO2Sensor = this.mielHvac.hasCO2Sensor;
|
|
262
|
+
const hasPM25Sensor = this.mielHvac.hasPM25Sensor;
|
|
263
|
+
const numberOfFanSpeeds = this.mielHvac.numberOfFanSpeeds;
|
|
262
264
|
|
|
263
265
|
//accessory
|
|
264
266
|
const debug = this.enableDebugMode ? this.emit('debug', `Prepare accessory`) : false;
|
|
@@ -285,7 +287,7 @@ class DeviceErv extends EventEmitter {
|
|
|
285
287
|
this.melCloudService.setPrimaryService(true);
|
|
286
288
|
this.melCloudService.getCharacteristic(Characteristic.Active)
|
|
287
289
|
.onGet(async () => {
|
|
288
|
-
const state = this.
|
|
290
|
+
const state = this.mielHvac.power;
|
|
289
291
|
return state;
|
|
290
292
|
})
|
|
291
293
|
.onSet(async (state) => {
|
|
@@ -300,17 +302,17 @@ class DeviceErv extends EventEmitter {
|
|
|
300
302
|
});
|
|
301
303
|
this.melCloudService.getCharacteristic(Characteristic.CurrentHeaterCoolerState)
|
|
302
304
|
.onGet(async () => {
|
|
303
|
-
const value = this.
|
|
305
|
+
const value = this.mielHvac.currentOperationMode;
|
|
304
306
|
return value;
|
|
305
307
|
});
|
|
306
308
|
this.melCloudService.getCharacteristic(Characteristic.TargetHeaterCoolerState)
|
|
307
309
|
.setProps({
|
|
308
|
-
minValue: this.
|
|
309
|
-
maxValue: this.
|
|
310
|
-
validValues: this.
|
|
310
|
+
minValue: this.mielHvac.operationModeSetPropsMinValue,
|
|
311
|
+
maxValue: this.mielHvac.operationModeSetPropsMaxValue,
|
|
312
|
+
validValues: this.mielHvac.operationModeSetPropsValidValues
|
|
311
313
|
})
|
|
312
314
|
.onGet(async () => {
|
|
313
|
-
const value = this.
|
|
315
|
+
const value = this.mielHvac.targetOperationMode ?? 0; //LOSSNAY, BYPASS, AUTO
|
|
314
316
|
return value;
|
|
315
317
|
})
|
|
316
318
|
.onSet(async (value) => {
|
|
@@ -337,17 +339,17 @@ class DeviceErv extends EventEmitter {
|
|
|
337
339
|
});
|
|
338
340
|
this.melCloudService.getCharacteristic(Characteristic.CurrentTemperature)
|
|
339
341
|
.onGet(async () => {
|
|
340
|
-
const value = this.
|
|
342
|
+
const value = this.mielHvac.roomTemperature;
|
|
341
343
|
return value;
|
|
342
344
|
});
|
|
343
345
|
this.melCloudService.getCharacteristic(Characteristic.RotationSpeed)
|
|
344
346
|
.setProps({
|
|
345
347
|
minValue: 0,
|
|
346
|
-
maxValue: this.
|
|
348
|
+
maxValue: this.mielHvac.fanSpeedSetPropsMaxValue,
|
|
347
349
|
minStep: 1
|
|
348
350
|
})
|
|
349
351
|
.onGet(async () => {
|
|
350
|
-
const value = this.
|
|
352
|
+
const value = this.mielHvac.fanSpeed; //STOP, 1, 2, 3, 4, OFF
|
|
351
353
|
return value;
|
|
352
354
|
})
|
|
353
355
|
.onSet(async (value) => {
|
|
@@ -382,12 +384,12 @@ class DeviceErv extends EventEmitter {
|
|
|
382
384
|
if (hasAutoVentilationMode && hasCoolOperationMode) {
|
|
383
385
|
this.melCloudService.getCharacteristic(Characteristic.CoolingThresholdTemperature)
|
|
384
386
|
.setProps({
|
|
385
|
-
minValue: this.
|
|
386
|
-
maxValue: this.
|
|
387
|
-
minStep: this.
|
|
387
|
+
minValue: this.mielHvac.minTempCoolDry,
|
|
388
|
+
maxValue: this.mielHvac.maxTempCoolDry,
|
|
389
|
+
minStep: this.mielHvac.temperatureIncrement
|
|
388
390
|
})
|
|
389
391
|
.onGet(async () => {
|
|
390
|
-
const value = this.
|
|
392
|
+
const value = this.mielHvac.ventilationMode === 2 ? this.mielHvac.defaultHeatingSetTemperature : this.mielHvac.setTemperature;
|
|
391
393
|
return value;
|
|
392
394
|
})
|
|
393
395
|
.onSet(async (value) => {
|
|
@@ -395,7 +397,7 @@ class DeviceErv extends EventEmitter {
|
|
|
395
397
|
deviceData.Device.DefaultCoolingSetTemperature = value;
|
|
396
398
|
deviceData.Device.EffectiveFlags = Ventilation.EffectiveFlags.SetTemperature;
|
|
397
399
|
await this.melCloudErv.send(deviceData, this.displayMode);
|
|
398
|
-
const info = this.disableLogInfo ? false : this.emit('message', `Set cooling threshold temperature: ${value}${this.
|
|
400
|
+
const info = this.disableLogInfo ? false : this.emit('message', `Set cooling threshold temperature: ${value}${this.mielHvac.temperatureUnit}`);
|
|
399
401
|
} catch (error) {
|
|
400
402
|
this.emit('warn', `Set cooling threshold temperature error: ${error}`);
|
|
401
403
|
};
|
|
@@ -405,12 +407,12 @@ class DeviceErv extends EventEmitter {
|
|
|
405
407
|
if (hasAutoVentilationMode && hasHeatOperationMode) {
|
|
406
408
|
this.melCloudService.getCharacteristic(Characteristic.HeatingThresholdTemperature)
|
|
407
409
|
.setProps({
|
|
408
|
-
minValue: this.
|
|
409
|
-
maxValue: this.
|
|
410
|
-
minStep: this.
|
|
410
|
+
minValue: this.mielHvac.minTempHeat,
|
|
411
|
+
maxValue: this.mielHvac.maxTempHeat,
|
|
412
|
+
minStep: this.mielHvac.temperatureIncrement
|
|
411
413
|
})
|
|
412
414
|
.onGet(async () => {
|
|
413
|
-
const value = this.
|
|
415
|
+
const value = this.mielHvac.ventilationMode === 2 ? this.mielHvac.defaultHeatingSetTemperature : this.mielHvac.setTemperature;
|
|
414
416
|
return value;
|
|
415
417
|
})
|
|
416
418
|
.onSet(async (value) => {
|
|
@@ -418,7 +420,7 @@ class DeviceErv extends EventEmitter {
|
|
|
418
420
|
deviceData.Device.DefaultHeatingSetTemperature = value;
|
|
419
421
|
deviceData.Device.EffectiveFlags = Ventilation.EffectiveFlags.SetTemperature;
|
|
420
422
|
await this.melCloudErv.send(deviceData, this.displayMode);
|
|
421
|
-
const info = this.disableLogInfo ? false : this.emit('message', `Set heating threshold temperature: ${value}${this.
|
|
423
|
+
const info = this.disableLogInfo ? false : this.emit('message', `Set heating threshold temperature: ${value}${this.mielHvac.temperatureUnit}`);
|
|
422
424
|
} catch (error) {
|
|
423
425
|
this.emit('warn', `Set heating threshold temperature error: ${error}`);
|
|
424
426
|
};
|
|
@@ -426,7 +428,7 @@ class DeviceErv extends EventEmitter {
|
|
|
426
428
|
};
|
|
427
429
|
//this.melCloudService.getCharacteristic(Characteristic.LockPhysicalControls)
|
|
428
430
|
// .onGet(async () => {
|
|
429
|
-
// const value = this.
|
|
431
|
+
// const value = this.mielHvac.lockPhysicalControl;
|
|
430
432
|
// const info = this.disableLogInfo ? false : this.emit('message', `Lock physical controls: ${value ? 'LOCKED' : 'UNLOCKED'}`);
|
|
431
433
|
// return value;
|
|
432
434
|
// })
|
|
@@ -443,14 +445,14 @@ class DeviceErv extends EventEmitter {
|
|
|
443
445
|
// });
|
|
444
446
|
this.melCloudService.getCharacteristic(Characteristic.TemperatureDisplayUnits)
|
|
445
447
|
.onGet(async () => {
|
|
446
|
-
const value = this.
|
|
448
|
+
const value = this.mielHvac.useFahrenheit;
|
|
447
449
|
return value;
|
|
448
450
|
})
|
|
449
451
|
.onSet(async (value) => {
|
|
450
452
|
try {
|
|
451
453
|
accountInfo.UseFahrenheit = [false, true][value];
|
|
452
454
|
await this.melCloud.send(accountInfo);
|
|
453
|
-
this.
|
|
455
|
+
this.mielHvac.useFahrenheit = value;
|
|
454
456
|
const info = this.disableLogInfo ? false : this.emit('message', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
455
457
|
} catch (error) {
|
|
456
458
|
this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
@@ -464,17 +466,17 @@ class DeviceErv extends EventEmitter {
|
|
|
464
466
|
this.melCloudService.setPrimaryService(true);
|
|
465
467
|
this.melCloudService.getCharacteristic(Characteristic.CurrentHeatingCoolingState)
|
|
466
468
|
.onGet(async () => {
|
|
467
|
-
const value = this.
|
|
469
|
+
const value = this.mielHvac.currentOperationMode;
|
|
468
470
|
return value;
|
|
469
471
|
});
|
|
470
472
|
this.melCloudService.getCharacteristic(Characteristic.TargetHeatingCoolingState)
|
|
471
473
|
.setProps({
|
|
472
|
-
minValue: this.
|
|
473
|
-
maxValue: this.
|
|
474
|
-
validValues: this.
|
|
474
|
+
minValue: this.mielHvac.operationModeSetPropsMinValue,
|
|
475
|
+
maxValue: this.mielHvac.operationModeSetPropsMaxValue,
|
|
476
|
+
validValues: this.mielHvac.operationModeSetPropsValidValues
|
|
475
477
|
})
|
|
476
478
|
.onGet(async () => {
|
|
477
|
-
const value = this.
|
|
479
|
+
const value = this.mielHvac.targetOperationMode ?? 0; //LOSSNAY, BYPASS, AUTO
|
|
478
480
|
return value;
|
|
479
481
|
})
|
|
480
482
|
.onSet(async (value) => {
|
|
@@ -510,17 +512,17 @@ class DeviceErv extends EventEmitter {
|
|
|
510
512
|
});
|
|
511
513
|
this.melCloudService.getCharacteristic(Characteristic.CurrentTemperature)
|
|
512
514
|
.onGet(async () => {
|
|
513
|
-
const value = this.
|
|
515
|
+
const value = this.mielHvac.roomTemperature;
|
|
514
516
|
return value;
|
|
515
517
|
});
|
|
516
518
|
this.melCloudService.getCharacteristic(Characteristic.TargetTemperature)
|
|
517
519
|
.setProps({
|
|
518
|
-
minValue: this.
|
|
519
|
-
maxValue: this.
|
|
520
|
-
minStep: this.
|
|
520
|
+
minValue: this.mielHvac.minTempHeat,
|
|
521
|
+
maxValue: this.mielHvac.maxTempHeat,
|
|
522
|
+
minStep: this.mielHvac.temperatureIncrement
|
|
521
523
|
})
|
|
522
524
|
.onGet(async () => {
|
|
523
|
-
const value = this.
|
|
525
|
+
const value = this.mielHvac.setTemperature;
|
|
524
526
|
return value;
|
|
525
527
|
})
|
|
526
528
|
.onSet(async (value) => {
|
|
@@ -528,21 +530,21 @@ class DeviceErv extends EventEmitter {
|
|
|
528
530
|
deviceData.Device.SetTemperature = value;
|
|
529
531
|
deviceData.Device.EffectiveFlags = Ventilation.EffectiveFlags.SetTemperature;
|
|
530
532
|
await this.melCloudErv.send(deviceData, this.displayMode);
|
|
531
|
-
const info = this.disableLogInfo ? false : this.emit('message', `Set temperature: ${value}${this.
|
|
533
|
+
const info = this.disableLogInfo ? false : this.emit('message', `Set temperature: ${value}${this.mielHvac.temperatureUnit}`);
|
|
532
534
|
} catch (error) {
|
|
533
535
|
this.emit('warn', `Set temperature error: ${error}`);
|
|
534
536
|
};
|
|
535
537
|
});
|
|
536
538
|
this.melCloudService.getCharacteristic(Characteristic.TemperatureDisplayUnits)
|
|
537
539
|
.onGet(async () => {
|
|
538
|
-
const value = this.
|
|
540
|
+
const value = this.mielHvac.useFahrenheit;
|
|
539
541
|
return value;
|
|
540
542
|
})
|
|
541
543
|
.onSet(async (value) => {
|
|
542
544
|
try {
|
|
543
545
|
accountInfo.UseFahrenheit = [false, true][value];
|
|
544
546
|
await this.melCloud.send(accountInfo);
|
|
545
|
-
this.
|
|
547
|
+
this.mielHvac.useFahrenheit = value;
|
|
546
548
|
const info = this.disableLogInfo ? false : this.emit('message', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
547
549
|
} catch (error) {
|
|
548
550
|
this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
@@ -553,7 +555,7 @@ class DeviceErv extends EventEmitter {
|
|
|
553
555
|
};
|
|
554
556
|
|
|
555
557
|
//temperature sensor service room
|
|
556
|
-
if (this.temperatureSensor && hasRoomTemperature && this.
|
|
558
|
+
if (this.temperatureSensor && hasRoomTemperature && this.mielHvac.roomTemperature !== null) {
|
|
557
559
|
const debug = this.enableDebugMode ? this.emit('debug', `Prepare room temperature sensor service`) : false;
|
|
558
560
|
this.roomTemperatureSensorService = new Service.TemperatureSensor(`${serviceName} Room`, `Room Temperature Sensor ${deviceId}`);
|
|
559
561
|
this.roomTemperatureSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
@@ -565,14 +567,14 @@ class DeviceErv extends EventEmitter {
|
|
|
565
567
|
minStep: 0.5
|
|
566
568
|
})
|
|
567
569
|
.onGet(async () => {
|
|
568
|
-
const state = this.
|
|
570
|
+
const state = this.mielHvac.roomTemperature;
|
|
569
571
|
return state;
|
|
570
572
|
})
|
|
571
573
|
accessory.addService(this.roomTemperatureSensorService);
|
|
572
574
|
};
|
|
573
575
|
|
|
574
576
|
//temperature sensor service supply
|
|
575
|
-
if (this.temperatureSensorSupply && hasSupplyTemperature && this.
|
|
577
|
+
if (this.temperatureSensorSupply && hasSupplyTemperature && this.mielHvac.supplyTemperature !== null) {
|
|
576
578
|
const debug = this.enableDebugMode ? this.emit('debug', `Prepare supply temperature sensor service`) : false;
|
|
577
579
|
this.supplyTemperatureSensorService = new Service.TemperatureSensor(`${serviceName} Supply`, `Supply Temperature Sensor ${deviceId}`);
|
|
578
580
|
this.supplyTemperatureSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
@@ -584,14 +586,14 @@ class DeviceErv extends EventEmitter {
|
|
|
584
586
|
minStep: 0.5
|
|
585
587
|
})
|
|
586
588
|
.onGet(async () => {
|
|
587
|
-
const state = this.
|
|
589
|
+
const state = this.mielHvac.supplyTemperature;
|
|
588
590
|
return state;
|
|
589
591
|
})
|
|
590
592
|
accessory.addService(this.supplyTemperatureSensorService);
|
|
591
593
|
};
|
|
592
594
|
|
|
593
595
|
//temperature sensor service outdoor
|
|
594
|
-
if (this.temperatureSensorOutdoor && hasOutdoorTemperature && this.
|
|
596
|
+
if (this.temperatureSensorOutdoor && hasOutdoorTemperature && this.mielHvac.outdoorTemperature !== null) {
|
|
595
597
|
const debug = this.enableDebugMode ? this.emit('debug', `Prepare outdoor temperature sensor service`) : false;
|
|
596
598
|
this.outdoorTemperatureSensorService = new Service.TemperatureSensor(`${serviceName} Outdoor`, `Outdoor Temperature Sensor ${deviceId}`);
|
|
597
599
|
this.outdoorTemperatureSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
@@ -603,7 +605,7 @@ class DeviceErv extends EventEmitter {
|
|
|
603
605
|
minStep: 0.5
|
|
604
606
|
})
|
|
605
607
|
.onGet(async () => {
|
|
606
|
-
const state = this.
|
|
608
|
+
const state = this.mielHvac.outdoorTemperature;
|
|
607
609
|
return state;
|
|
608
610
|
})
|
|
609
611
|
accessory.addService(this.outdoorTemperatureSensorService);
|
|
@@ -615,7 +617,7 @@ class DeviceErv extends EventEmitter {
|
|
|
615
617
|
this.coreMaintenanceService.setCharacteristic(Characteristic.ConfiguredName, `${serviceName} Core Maintenance`);
|
|
616
618
|
this.coreMaintenanceService.getCharacteristic(Characteristic.FilterChangeIndication)
|
|
617
619
|
.onGet(async () => {
|
|
618
|
-
const value = this.
|
|
620
|
+
const value = this.mielHvac.coreMaintenanceRequired;
|
|
619
621
|
return value;
|
|
620
622
|
});
|
|
621
623
|
this.coreMaintenanceService.getCharacteristic(Characteristic.ResetFilterIndication)
|
|
@@ -629,7 +631,7 @@ class DeviceErv extends EventEmitter {
|
|
|
629
631
|
this.filterMaintenanceService.setCharacteristic(Characteristic.ConfiguredName, `${serviceName} Filter Maintenance`);
|
|
630
632
|
this.filterMaintenanceService.getCharacteristic(Characteristic.FilterChangeIndication)
|
|
631
633
|
.onGet(async () => {
|
|
632
|
-
const value = this.
|
|
634
|
+
const value = this.mielHvac.filterMaintenanceRequired;
|
|
633
635
|
return value;
|
|
634
636
|
});
|
|
635
637
|
this.filterMaintenanceService.getCharacteristic(Characteristic.ResetFilterIndication)
|
|
@@ -644,12 +646,12 @@ class DeviceErv extends EventEmitter {
|
|
|
644
646
|
this.carbonDioxideSensorService.setCharacteristic(Characteristic.ConfiguredName, `${serviceName} CO2 Sensor`);
|
|
645
647
|
this.carbonDioxideSensorService.getCharacteristic(Characteristic.CarbonDioxideDetected)
|
|
646
648
|
.onGet(async () => {
|
|
647
|
-
const value = this.
|
|
649
|
+
const value = this.mielHvac.roomCO2Detected;
|
|
648
650
|
return value;
|
|
649
651
|
});
|
|
650
652
|
this.carbonDioxideSensorService.getCharacteristic(Characteristic.CarbonDioxideLevel)
|
|
651
653
|
.onGet(async () => {
|
|
652
|
-
const value = this.
|
|
654
|
+
const value = this.mielHvac.roomCO2Level;
|
|
653
655
|
return value;
|
|
654
656
|
});
|
|
655
657
|
accessory.addService(this.carbonDioxideSensorService);
|
|
@@ -662,12 +664,12 @@ class DeviceErv extends EventEmitter {
|
|
|
662
664
|
this.airQualitySensorService.setCharacteristic(Characteristic.ConfiguredName, `${serviceName} PM2.5 Sensor`);
|
|
663
665
|
this.airQualitySensorService.getCharacteristic(Characteristic.AirQuality)
|
|
664
666
|
.onGet(async () => {
|
|
665
|
-
const value = this.
|
|
667
|
+
const value = this.mielHvac.pM25AirQuality;
|
|
666
668
|
return value;
|
|
667
669
|
});
|
|
668
670
|
this.airQualitySensorService.getCharacteristic(Characteristic.PM2_5Density)
|
|
669
671
|
.onGet(async () => {
|
|
670
|
-
const value = this.
|
|
672
|
+
const value = this.mielHvac.pM25Level;
|
|
671
673
|
return value;
|
|
672
674
|
});
|
|
673
675
|
accessory.addService(this.airQualitySensorService);
|
|
@@ -936,92 +938,98 @@ class DeviceErv extends EventEmitter {
|
|
|
936
938
|
const ventilationMode = deviceData.Device.VentilationMode;
|
|
937
939
|
|
|
938
940
|
//accessory
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
941
|
+
const obj = {
|
|
942
|
+
presets: presetsOnServer,
|
|
943
|
+
hasRoomTemperature: hasRoomTemperature,
|
|
944
|
+
hasSupplyTemperature: hasSupplyTemperature,
|
|
945
|
+
hasOutdoorTemperature: hasOutdoorTemperature,
|
|
946
|
+
hasCoolOperationMode: hasCoolOperationMode,
|
|
947
|
+
hasHeatOperationMode: hasHeatOperationMode,
|
|
948
|
+
hasCO2Sensor: hasCO2Sensor,
|
|
949
|
+
roomCO2Level: roomCO2Level,
|
|
950
|
+
roomCO2Detected: roomCO2Detected,
|
|
951
|
+
hasPM25Sensor: hasPM25Sensor,
|
|
952
|
+
pM25SensorStatus: pM25SensorStatus,
|
|
953
|
+
pM25Level: pM25Level,
|
|
954
|
+
pM25AirQuality: pM25AirQuality,
|
|
955
|
+
hasAutoVentilationMode: hasAutoVentilationMode,
|
|
956
|
+
hasBypassVentilationMode: hasBypassVentilationMode,
|
|
957
|
+
hasAutomaticFanSpeed: hasAutomaticFanSpeed,
|
|
958
|
+
coreMaintenanceRequired: coreMaintenanceRequired,
|
|
959
|
+
filterMaintenanceRequired: filterMaintenanceRequired,
|
|
960
|
+
actualVentilationMode: actualVentilationMode,
|
|
961
|
+
numberOfFanSpeeds: numberOfFanSpeeds,
|
|
962
|
+
power: power ? 1 : 0,
|
|
963
|
+
operationMode: operationMode,
|
|
964
|
+
currentOperationMode: 0,
|
|
965
|
+
targetOperationMode: 0,
|
|
966
|
+
ventilationMode: ventilationMode,
|
|
967
|
+
roomTemperature: roomTemperature,
|
|
968
|
+
supplyTemperature: supplyTemperature,
|
|
969
|
+
outdoorTemperature: outdoorTemperature,
|
|
970
|
+
setTemperature: setTemperature,
|
|
971
|
+
defaultHeatingSetTemperature: defaultHeatingSetTemperature,
|
|
972
|
+
defaultCoolingSetTemperature: defaultCoolingSetTemperature,
|
|
973
|
+
lockPhysicalControl: 0,
|
|
974
|
+
temperatureIncrement: temperatureIncrement,
|
|
975
|
+
minTempHeat: minTempHeat,
|
|
976
|
+
temperatureIncrement: maxTempHeat,
|
|
977
|
+
minTempCoolDry: minTempCoolDry,
|
|
978
|
+
maxTempCoolDry: maxTempCoolDry,
|
|
979
|
+
useFahrenheit: this.useFahrenheit,
|
|
980
|
+
temperatureUnit: this.useFahrenheit,
|
|
981
|
+
};
|
|
974
982
|
|
|
975
983
|
//ventilation mode - 0, HEAT, 2, COOL, 4, 5, 6, FAN, AUTO
|
|
976
984
|
switch (this.displayMode) {
|
|
977
985
|
case 1: //Heater Cooler
|
|
978
986
|
switch (ventilationMode) {
|
|
979
987
|
case 0: //LOSSNAY
|
|
980
|
-
|
|
981
|
-
|
|
988
|
+
obj.currentOperationMode = 2; //INACTIVE, IDLE, HEATING, COOLIN
|
|
989
|
+
obj.targetOperationMode = 1; //AUTO, HEAT, COOL
|
|
982
990
|
break;
|
|
983
991
|
case 1: //BYPASS
|
|
984
|
-
|
|
985
|
-
|
|
992
|
+
obj.currentOperationMode = 3;
|
|
993
|
+
obj.targetOperationMode = 2;
|
|
986
994
|
break;
|
|
987
995
|
case 2: //AUTO
|
|
988
996
|
switch (actualVentilationMode) {
|
|
989
997
|
case 0: //LOSSNAY
|
|
990
|
-
|
|
998
|
+
obj.currentOperationMode = 2;
|
|
991
999
|
break;
|
|
992
1000
|
case 1: //BYPASS
|
|
993
|
-
|
|
1001
|
+
obj.currentOperationMode = 3;
|
|
994
1002
|
break;
|
|
995
1003
|
default:
|
|
996
1004
|
this.emit('warn', `Unknown actual ventilation mode: ${actualVentilationMode}`);
|
|
997
1005
|
break;
|
|
998
1006
|
};
|
|
999
|
-
|
|
1007
|
+
obj.targetOperationMode = 0;
|
|
1000
1008
|
break;
|
|
1001
1009
|
default:
|
|
1002
1010
|
this.emit('warn', `Unknown ventilation mode: ${ventilationMode}`);
|
|
1003
1011
|
break;
|
|
1004
1012
|
};
|
|
1005
1013
|
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1014
|
+
obj.currentOperationMode = !power ? 0 : obj.currentOperationMode;
|
|
1015
|
+
obj.operationModeSetPropsMinValue = hasAutoVentilationMode ? 0 : 1;
|
|
1016
|
+
obj.operationModeSetPropsMaxValue = hasAutoVentilationMode ? 2 : 2;
|
|
1017
|
+
obj.operationModeSetPropsValidValues = hasAutoVentilationMode ? (hasBypassVentilationMode ? [0, 1, 2] : [0, 2]) : (hasBypassVentilationMode ? [1, 2] : [2]);
|
|
1010
1018
|
|
|
1011
1019
|
//fan speed mode
|
|
1012
|
-
|
|
1020
|
+
obj.fanSpeedSetPropsMaxValue = 2;
|
|
1013
1021
|
switch (numberOfFanSpeeds) {
|
|
1014
1022
|
case 2: //Fan speed mode 2
|
|
1015
|
-
|
|
1016
|
-
|
|
1023
|
+
obj.fanSpeed = hasAutomaticFanSpeed ? [3, 1, 2][setFanSpeed] : [0, 1, 2][setFanSpeed];
|
|
1024
|
+
obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 3 : 2;
|
|
1017
1025
|
break;
|
|
1018
1026
|
case 3: //Fan speed mode 3
|
|
1019
|
-
this.
|
|
1020
|
-
|
|
1027
|
+
this.obj.fanSpeed = hasAutomaticFanSpeed ? [4, 1, 2, 3][setFanSpeed] : [0, 1, 2, 3][setFanSpeed];
|
|
1028
|
+
obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 4 : 3;
|
|
1021
1029
|
break;
|
|
1022
1030
|
case 4: //Fan speed mode 4
|
|
1023
|
-
|
|
1024
|
-
|
|
1031
|
+
obj.fanSpeed = hasAutomaticFanSpeed ? [5, 1, 2, 3, 4][setFanSpeed] : [0, 1, 2, 3, 4][setFanSpeed];
|
|
1032
|
+
obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 5 : 4;
|
|
1025
1033
|
break;
|
|
1026
1034
|
};
|
|
1027
1035
|
|
|
@@ -1029,12 +1037,12 @@ class DeviceErv extends EventEmitter {
|
|
|
1029
1037
|
if (this.melCloudService) {
|
|
1030
1038
|
this.melCloudService
|
|
1031
1039
|
.updateCharacteristic(Characteristic.Active, power)
|
|
1032
|
-
.updateCharacteristic(Characteristic.CurrentHeaterCoolerState,
|
|
1033
|
-
.updateCharacteristic(Characteristic.TargetHeaterCoolerState,
|
|
1040
|
+
.updateCharacteristic(Characteristic.CurrentHeaterCoolerState, obj.currentOperationMode)
|
|
1041
|
+
.updateCharacteristic(Characteristic.TargetHeaterCoolerState, obj.targetOperationMode)
|
|
1034
1042
|
.updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature)
|
|
1035
|
-
.updateCharacteristic(Characteristic.RotationSpeed,
|
|
1036
|
-
.updateCharacteristic(Characteristic.LockPhysicalControls,
|
|
1037
|
-
.updateCharacteristic(Characteristic.TemperatureDisplayUnits,
|
|
1043
|
+
.updateCharacteristic(Characteristic.RotationSpeed, obj.fanSpeed)
|
|
1044
|
+
.updateCharacteristic(Characteristic.LockPhysicalControls, obj.lockPhysicalControl)
|
|
1045
|
+
.updateCharacteristic(Characteristic.TemperatureDisplayUnits, obj.useFahrenheit);
|
|
1038
1046
|
const updateDefCool = hasCoolOperationMode ? this.melCloudService.updateCharacteristic(Characteristic.CoolingThresholdTemperature, defaultCoolingSetTemperature) : false;
|
|
1039
1047
|
const updateDefHeat = hasHeatOperationMode ? this.melCloudService.updateCharacteristic(Characteristic.HeatingThresholdTemperature, defaultHeatingSetTemperature) : false;
|
|
1040
1048
|
};
|
|
@@ -1043,49 +1051,50 @@ class DeviceErv extends EventEmitter {
|
|
|
1043
1051
|
//operation mode - 0, HEAT, 2, COOL, 4, 5, 6, FAN, AUTO
|
|
1044
1052
|
switch (ventilationMode) {
|
|
1045
1053
|
case 0: //LOSSNAY
|
|
1046
|
-
|
|
1047
|
-
|
|
1054
|
+
obj.currentOperationMode = 1; //OFF, HEAT, COOL
|
|
1055
|
+
obj.targetOperationMode = 1; //OFF, HEAT, COOL, AUTO
|
|
1048
1056
|
break;
|
|
1049
1057
|
case 1: //BYPASS
|
|
1050
|
-
|
|
1051
|
-
|
|
1058
|
+
obj.currentOperationMode = 2;
|
|
1059
|
+
obj.targetOperationMode = 2;
|
|
1052
1060
|
break;
|
|
1053
1061
|
case 2: //AUTO
|
|
1054
1062
|
switch (actualVentilationMode) {
|
|
1055
1063
|
case 0: //LOSSNAY
|
|
1056
|
-
|
|
1064
|
+
obj.currentOperationMode = 1;
|
|
1057
1065
|
break;
|
|
1058
1066
|
case 1: //BYPASS
|
|
1059
|
-
|
|
1067
|
+
obj.currentOperationMode = 2;
|
|
1060
1068
|
break;
|
|
1061
1069
|
default:
|
|
1062
1070
|
this.emit('warn', `Unknown actual ventilation mode: ${actualVentilationMode}`);
|
|
1063
1071
|
break;
|
|
1064
1072
|
};
|
|
1065
|
-
|
|
1073
|
+
obj.targetOperationMode = 3;
|
|
1066
1074
|
break;
|
|
1067
1075
|
default:
|
|
1068
1076
|
this.emit('warn', `Unknown ventilation mode: ${ventilationMode}`);
|
|
1069
1077
|
break;
|
|
1070
1078
|
};
|
|
1071
1079
|
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1080
|
+
obj.currentOperationMode = !power ? 0 : obj.currentOperationMode;
|
|
1081
|
+
obj.targetOperationMode = !power ? 0 : obj.targetOperationMode;
|
|
1082
|
+
obj.operationModeSetPropsMinValue = hasAutoVentilationMode ? 0 : 0;
|
|
1083
|
+
obj.operationModeSetPropsMaxValue = hasAutoVentilationMode ? 3 : 2;
|
|
1084
|
+
obj.operationModeSetPropsValidValues = hasAutoVentilationMode ? (hasBypassVentilationMode ? [0, 1, 2, 3] : [0, 2, 3]) : (hasBypassVentilationMode ? [0, 1, 2] : [0, 2]);
|
|
1077
1085
|
|
|
1078
1086
|
//update characteristics
|
|
1079
1087
|
if (this.melCloudService) {
|
|
1080
1088
|
this.melCloudService
|
|
1081
|
-
.updateCharacteristic(Characteristic.CurrentHeatingCoolingState,
|
|
1082
|
-
.updateCharacteristic(Characteristic.TargetHeatingCoolingState,
|
|
1089
|
+
.updateCharacteristic(Characteristic.CurrentHeatingCoolingState, obj.currentOperationMode)
|
|
1090
|
+
.updateCharacteristic(Characteristic.TargetHeatingCoolingState, obj.targetOperationMode)
|
|
1083
1091
|
.updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature)
|
|
1084
1092
|
.updateCharacteristic(Characteristic.TargetTemperature, setTemperature)
|
|
1085
|
-
.updateCharacteristic(Characteristic.TemperatureDisplayUnits,
|
|
1093
|
+
.updateCharacteristic(Characteristic.TemperatureDisplayUnits, obj.useFahrenheit);
|
|
1086
1094
|
};
|
|
1087
1095
|
break;
|
|
1088
1096
|
};
|
|
1097
|
+
this.mielHvac = obj;
|
|
1089
1098
|
|
|
1090
1099
|
//update temperature sensors
|
|
1091
1100
|
if (this.roomTemperatureSensorService) {
|
|
@@ -1184,7 +1193,7 @@ class DeviceErv extends EventEmitter {
|
|
|
1184
1193
|
button.state = power ? (setFanSpeed === 4) : false;
|
|
1185
1194
|
break;
|
|
1186
1195
|
case 15: //PHYSICAL LOCK CONTROLS
|
|
1187
|
-
button.state = (
|
|
1196
|
+
button.state = (obj.lockPhysicalControl === 1);
|
|
1188
1197
|
break;
|
|
1189
1198
|
case 16: //ROOM TEMP HIDE
|
|
1190
1199
|
button.state = (hideRoomTemperature === true);
|
|
@@ -1214,12 +1223,12 @@ class DeviceErv extends EventEmitter {
|
|
|
1214
1223
|
this.emit('message', `Power: ${power ? 'ON' : 'OFF'}`);
|
|
1215
1224
|
this.emit('message', `Target ventilation mode: ${Ventilation.OperationMode[ventilationMode]}`);
|
|
1216
1225
|
this.emit('message', `Current ventilation mode: ${Ventilation.OperationMode[actualVentilationMode]}`);
|
|
1217
|
-
this.emit('message', `Target temperature: ${setTemperature}${
|
|
1218
|
-
this.emit('message', `Room temperature: ${roomTemperature}${
|
|
1219
|
-
const info1 = hasSupplyTemperature && deviceData.Device.SupplyTemperature !== null ? this.emit('message', `Supply temperature: ${roomTemperature}${
|
|
1220
|
-
const info2 = hasOutdoorTemperature && deviceData.Device.OutdoorTemperature !== null ? this.emit('message', `Outdoor temperature: ${roomTemperature}${
|
|
1226
|
+
this.emit('message', `Target temperature: ${setTemperature}${obj.temperatureUnit}`);
|
|
1227
|
+
this.emit('message', `Room temperature: ${roomTemperature}${obj.temperatureUnit}`);
|
|
1228
|
+
const info1 = hasSupplyTemperature && deviceData.Device.SupplyTemperature !== null ? this.emit('message', `Supply temperature: ${roomTemperature}${obj.temperatureUnit}`) : false;
|
|
1229
|
+
const info2 = hasOutdoorTemperature && deviceData.Device.OutdoorTemperature !== null ? this.emit('message', `Outdoor temperature: ${roomTemperature}${obj.temperatureUnit}`) : false;
|
|
1221
1230
|
this.emit('message', `Fan speed mode: ${Ventilation.FanSpeed[setFanSpeed]}`);
|
|
1222
|
-
this.emit('message', `Temperature display unit: ${
|
|
1231
|
+
this.emit('message', `Temperature display unit: ${obj.temperatureUnit}`);
|
|
1223
1232
|
this.emit('message', `Core maintenance: ${Ventilation.CoreMaintenance[coreMaintenanceRequired]}`);
|
|
1224
1233
|
this.emit('message', `Filter maintenance: ${Ventilation.FilterMaintenance[filterMaintenanceRequired]}`);
|
|
1225
1234
|
const info5 = hasCO2Sensor ? this.emit('message', `CO2 detected: ${Ventilation.Co2Detected[roomCO2Detected]}`) : false;
|