homebridge-melcloud-control 3.3.4 → 3.3.8
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/constants.json +13 -1
- package/src/deviceata.js +159 -127
- package/src/deviceatw.js +238 -102
- package/src/deviceerv.js +133 -131
- package/src/melcloud.js +2 -2
- package/src/melcloudata.js +2 -2
- package/src/melcloudatw.js +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -16,6 +16,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
16
16
|
- do not configure it manually, always using Config UI X
|
|
17
17
|
- required Homebridge v2.0.0 and above
|
|
18
18
|
|
|
19
|
+
## [3.3.5] - (15.09.2024)
|
|
20
|
+
|
|
21
|
+
## Changes
|
|
22
|
+
|
|
23
|
+
- fix[#162](https://github.com/grzegorz914/homebridge-melcloud-control/issues/162)
|
|
24
|
+
- cleanup
|
|
25
|
+
|
|
19
26
|
## [3.3.3] - (13.09.2024)
|
|
20
27
|
|
|
21
28
|
## Changes
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "3.3.
|
|
4
|
+
"version": "3.3.8",
|
|
5
5
|
"description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|
package/src/constants.json
CHANGED
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
"3",
|
|
79
79
|
"4",
|
|
80
80
|
"5",
|
|
81
|
+
"6",
|
|
81
82
|
"SWING"
|
|
82
83
|
],
|
|
83
84
|
"FanSpeed": [
|
|
@@ -90,6 +91,17 @@
|
|
|
90
91
|
"VERY STRONG",
|
|
91
92
|
"OFF"
|
|
92
93
|
],
|
|
94
|
+
"CurrentOperationModeHeatherCooler": [
|
|
95
|
+
"INACTIVE",
|
|
96
|
+
"IDLE",
|
|
97
|
+
"HEATING",
|
|
98
|
+
"COOLING"
|
|
99
|
+
],
|
|
100
|
+
"CurrentOperationModeThermostat": [
|
|
101
|
+
"INACTIVE",
|
|
102
|
+
"HEATING",
|
|
103
|
+
"COOLING"
|
|
104
|
+
],
|
|
93
105
|
"EffectiveFlags": {
|
|
94
106
|
"Power": 1,
|
|
95
107
|
"OperationMode": 2,
|
|
@@ -285,4 +297,4 @@
|
|
|
285
297
|
"Quest": 3,
|
|
286
298
|
"Owner": 4
|
|
287
299
|
}
|
|
288
|
-
}
|
|
300
|
+
}
|
package/src/deviceata.js
CHANGED
|
@@ -36,7 +36,6 @@ class DeviceAta extends EventEmitter {
|
|
|
36
36
|
this.deviceTypeText = deviceTypeText;
|
|
37
37
|
this.devicesFile = devicesFile;
|
|
38
38
|
this.refreshInterval = refreshInterval;
|
|
39
|
-
this.useFahrenheit = useFahrenheit;
|
|
40
39
|
this.startPrepareAccessory = true;
|
|
41
40
|
this.displayDeviceInfo = true;
|
|
42
41
|
|
|
@@ -97,6 +96,8 @@ class DeviceAta extends EventEmitter {
|
|
|
97
96
|
this.accessory.currentOperationMode = 0;
|
|
98
97
|
this.accessory.targetOperationMode = 0;
|
|
99
98
|
this.accessory.fanSpeed = 0;
|
|
99
|
+
this.accessory.useFahrenheit = useFahrenheit ? 1 : 0;
|
|
100
|
+
this.accessory.temperatureUnit = CONSTANTS.TemperatureDisplayUnits[this.accessory.useFahrenheit];
|
|
100
101
|
};
|
|
101
102
|
|
|
102
103
|
async start() {
|
|
@@ -210,7 +211,6 @@ class DeviceAta extends EventEmitter {
|
|
|
210
211
|
})
|
|
211
212
|
.on('deviceState', async (deviceData) => {
|
|
212
213
|
//device info
|
|
213
|
-
const displayMode = this.displayMode;
|
|
214
214
|
const hasAutomaticFanSpeed = deviceData.Device.HasAutomaticFanSpeed ?? false;
|
|
215
215
|
const airDirectionFunction = deviceData.Device.AirDirectionFunction ?? false;
|
|
216
216
|
const hasOutdoorTemperature = deviceData.Device.HasOutdoorTemperature ?? false;
|
|
@@ -223,16 +223,12 @@ class DeviceAta extends EventEmitter {
|
|
|
223
223
|
const modelSupportsAuto1 = deviceData.Device.ModelSupportsAuto ?? false;
|
|
224
224
|
const modelSupportsAuto = this.autoDryFanMode >= 1 && modelSupportsAuto1;
|
|
225
225
|
const modelSupportsDry = deviceData.Device.ModelSupportsDry ?? false;
|
|
226
|
-
const temperatureIncrement = deviceData.Device.TemperatureIncrement ?? 1;
|
|
227
|
-
const outdoorTemperature = deviceData.Device.OutdoorTemperature;
|
|
228
|
-
const temperatureUnit = CONSTANTS.TemperatureDisplayUnits[this.useFahrenheit];
|
|
229
226
|
|
|
230
227
|
//presets
|
|
231
228
|
const presetsOnServer = deviceData.Presets ?? [];
|
|
232
229
|
|
|
233
230
|
//device state
|
|
234
231
|
const power = deviceData.Device.Power ?? false;
|
|
235
|
-
const offline = deviceData.Device.Offline ?? false;
|
|
236
232
|
const inStandbyMode = deviceData.Device.InStandbyMode ?? false;
|
|
237
233
|
const roomTemperature = deviceData.Device.RoomTemperature;
|
|
238
234
|
const setTemperature = deviceData.Device.SetTemperature;
|
|
@@ -242,42 +238,42 @@ class DeviceAta extends EventEmitter {
|
|
|
242
238
|
const operationMode = deviceData.Device.OperationMode;
|
|
243
239
|
const vaneHorizontalDirection = deviceData.Device.VaneHorizontalDirection;
|
|
244
240
|
const vaneVerticalDirection = deviceData.Device.VaneVerticalDirection;
|
|
245
|
-
const hideVaneControls = deviceData.Device.HideVaneControls;
|
|
246
|
-
const hideDryModeControl = deviceData.Device.HideDryModeControl;
|
|
241
|
+
const hideVaneControls = deviceData.Device.HideVaneControls ?? false;
|
|
242
|
+
const hideDryModeControl = deviceData.Device.HideDryModeControl ?? false;
|
|
247
243
|
const prohibitSetTemperature = deviceData.Device.ProhibitSetTemperature ?? false;
|
|
248
244
|
const prohibitOperationMode = deviceData.Device.ProhibitOperationMode ?? false;
|
|
249
245
|
const prohibitPower = deviceData.Device.ProhibitPower ?? false;
|
|
246
|
+
const temperatureIncrement = deviceData.Device.TemperatureIncrement ?? 1;
|
|
247
|
+
const outdoorTemperature = deviceData.Device.OutdoorTemperature;
|
|
250
248
|
|
|
251
249
|
//accessory
|
|
252
|
-
this.accessory.
|
|
250
|
+
this.accessory.modelSupportsHeat = modelSupportsHeat;
|
|
251
|
+
this.accessory.modelSupportsDry = modelSupportsDry;
|
|
252
|
+
this.accessory.modelSupportsCool = modelSupportsCool;
|
|
253
|
+
this.accessory.modelSupportsAuto = modelSupportsAuto;
|
|
254
|
+
this.accessory.modelSupportsFanSpeed = modelSupportsFanSpeed;
|
|
255
|
+
this.accessory.hasAutomaticFanSpeed = hasAutomaticFanSpeed;
|
|
256
|
+
this.accessory.hasOutdoorTemperature = hasOutdoorTemperature;
|
|
257
|
+
this.accessory.numberOfFanSpeeds = numberOfFanSpeeds;
|
|
258
|
+
this.accessory.swingFunction = swingFunction;
|
|
259
|
+
|
|
260
|
+
this.accessory.presets = presetsOnServer;
|
|
261
|
+
|
|
253
262
|
this.accessory.power = power ? 1 : 0;
|
|
254
|
-
this.accessory.
|
|
263
|
+
this.accessory.inStandbyMode = inStandbyMode;
|
|
264
|
+
this.accessory.operationMode = operationMode;
|
|
265
|
+
this.accessory.setTemperature = setTemperature;
|
|
255
266
|
this.accessory.roomTemperature = roomTemperature;
|
|
256
267
|
this.accessory.outdoorTemperature = outdoorTemperature;
|
|
257
|
-
this.accessory.setTemperature = setTemperature;
|
|
258
268
|
this.accessory.defaultHeatingSetTemperature = defaultHeatingSetTemperature;
|
|
259
269
|
this.accessory.defaultCoolingSetTemperature = defaultCoolingSetTemperature;
|
|
260
270
|
this.accessory.fanSpeed = fanSpeed;
|
|
261
|
-
this.accessory.vaneHorizontal = vaneHorizontalDirection;
|
|
262
|
-
this.accessory.vaneVertical = vaneVerticalDirection;
|
|
263
271
|
this.accessory.swingMode = swingFunction && vaneHorizontalDirection === 12 && vaneVerticalDirection === 7 ? 1 : 0;
|
|
264
272
|
this.accessory.lockPhysicalControl = prohibitSetTemperature && prohibitOperationMode && prohibitPower ? 1 : 0;
|
|
265
273
|
this.accessory.temperatureIncrement = temperatureIncrement;
|
|
266
|
-
this.accessory.useFahrenheit = this.useFahrenheit;
|
|
267
|
-
this.accessory.temperatureUnit = temperatureUnit;
|
|
268
|
-
this.accessory.hasAutomaticFanSpeed = hasAutomaticFanSpeed;
|
|
269
|
-
this.accessory.airDirectionFunction = airDirectionFunction;
|
|
270
|
-
this.accessory.hasOutdoorTemperature = hasOutdoorTemperature;
|
|
271
|
-
this.accessory.swingFunction = swingFunction;
|
|
272
|
-
this.accessory.numberOfFanSpeeds = numberOfFanSpeeds;
|
|
273
|
-
this.accessory.modelSupportsHeat = modelSupportsHeat;
|
|
274
|
-
this.accessory.modelSupportsCool = modelSupportsCool;
|
|
275
|
-
this.accessory.modelSupportsAuto = modelSupportsAuto;
|
|
276
|
-
this.accessory.modelSupportsFanSpeed = modelSupportsFanSpeed;
|
|
277
|
-
this.accessory.modelSupportsDry = modelSupportsDry;
|
|
278
274
|
|
|
279
275
|
//operating mode
|
|
280
|
-
switch (displayMode) {
|
|
276
|
+
switch (this.displayMode) {
|
|
281
277
|
case 1: //Heater Cooler
|
|
282
278
|
//operating mode 0, HEAT, DRY, COOL, 4, 5, 6, FAN, AUTO, ISEE HEAT, ISEE DRY, ISEE COOL
|
|
283
279
|
switch (power) {
|
|
@@ -302,7 +298,20 @@ class DeviceAta extends EventEmitter {
|
|
|
302
298
|
this.accessory.targetOperationMode = this.autoDryFanMode === 3 ? 0 : this.heatDryFanMode === 3 ? 1 : this.coolDryFanMode === 3 ? 2 : this.accessory.targetOperationMode;
|
|
303
299
|
break;
|
|
304
300
|
case 8: //AUTO
|
|
305
|
-
|
|
301
|
+
const curentModeInAuto = roomTemperature < defaultHeatingSetTemperature ? 'HEATING' : roomTemperature > defaultCoolingSetTemperature ? 'COOLING' : '';
|
|
302
|
+
switch (curentModeInAuto) {
|
|
303
|
+
case 'HEATING': //HEATING
|
|
304
|
+
const heatingToFan = roomTemperature > defaultHeatingSetTemperature + 1;
|
|
305
|
+
this.accessory.currentOperationMode = heatingToFan ? 1 : 2;
|
|
306
|
+
break;
|
|
307
|
+
case 'COOLING': //COOLING
|
|
308
|
+
const coolingToFan = roomTemperature < defaultCoolingSetTemperature - 1;
|
|
309
|
+
this.accessory.currentOperationMode = coolingToFan ? 1 : 3;
|
|
310
|
+
break;
|
|
311
|
+
default: //FAN
|
|
312
|
+
this.accessory.currentOperationMode = roomTemperature <= defaultHeatingSetTemperature ? 2 : roomTemperature >= defaultCoolingSetTemperature ? 3 : 1;
|
|
313
|
+
break;
|
|
314
|
+
};
|
|
306
315
|
this.accessory.targetOperationMode = 0;
|
|
307
316
|
break;
|
|
308
317
|
case 9: //ISEE HEAT
|
|
@@ -365,14 +374,14 @@ class DeviceAta extends EventEmitter {
|
|
|
365
374
|
//update characteristics
|
|
366
375
|
if (this.melCloudService) {
|
|
367
376
|
this.melCloudService
|
|
368
|
-
.updateCharacteristic(Characteristic.Active,
|
|
377
|
+
.updateCharacteristic(Characteristic.Active, power ? 1 : 0)
|
|
369
378
|
.updateCharacteristic(Characteristic.CurrentHeaterCoolerState, this.accessory.currentOperationMode)
|
|
370
379
|
.updateCharacteristic(Characteristic.TargetHeaterCoolerState, this.accessory.targetOperationMode)
|
|
371
380
|
.updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature)
|
|
372
381
|
.updateCharacteristic(Characteristic.LockPhysicalControls, this.accessory.lockPhysicalControl)
|
|
373
382
|
.updateCharacteristic(Characteristic.TemperatureDisplayUnits, this.accessory.useFahrenheit);
|
|
374
|
-
const updateDefHeat =
|
|
375
|
-
const updateDefCool =
|
|
383
|
+
const updateDefHeat = modelSupportsHeat ? this.melCloudService.updateCharacteristic(Characteristic.HeatingThresholdTemperature, operationMode === 8 ? defaultHeatingSetTemperature : setTemperature) : false;
|
|
384
|
+
const updateDefCool = modelSupportsCool ? this.melCloudService.updateCharacteristic(Characteristic.CoolingThresholdTemperature, operationMode === 8 ? defaultCoolingSetTemperature : setTemperature) : false;
|
|
376
385
|
const updateRS = modelSupportsFanSpeed ? this.melCloudService.updateCharacteristic(Characteristic.RotationSpeed, this.accessory.fanSpeed) : false;
|
|
377
386
|
const updateSM = swingFunction ? this.melCloudService.updateCharacteristic(Characteristic.SwingMode, this.accessory.swingMode) : false;
|
|
378
387
|
};
|
|
@@ -384,7 +393,7 @@ class DeviceAta extends EventEmitter {
|
|
|
384
393
|
case true:
|
|
385
394
|
switch (operationMode) {
|
|
386
395
|
case 1: //HEAT
|
|
387
|
-
this.accessory.currentOperationMode = 1; //OFF,
|
|
396
|
+
this.accessory.currentOperationMode = 1; //OFF, HEATING, COOLING
|
|
388
397
|
this.accessory.targetOperationMode = 1; //OFF, HEAT, COOL, AUTO
|
|
389
398
|
break;
|
|
390
399
|
case 2: //DRY
|
|
@@ -400,7 +409,20 @@ class DeviceAta extends EventEmitter {
|
|
|
400
409
|
this.accessory.targetOperationMode = this.autoDryFanMode === 3 ? 3 : this.heatDryFanMode === 3 ? 1 : this.coolDryFanMode === 3 ? 2 : this.accessory.targetOperationMode;
|
|
401
410
|
break;
|
|
402
411
|
case 8: //AUTO
|
|
403
|
-
|
|
412
|
+
const curentModeInAuto = roomTemperature < defaultHeatingSetTemperature ? 'HEATING' : roomTemperature > defaultCoolingSetTemperature ? 'COOLING' : '';
|
|
413
|
+
switch (curentModeInAuto) {
|
|
414
|
+
case 'HEATING': //HEATING
|
|
415
|
+
const heatingToFan = roomTemperature > defaultHeatingSetTemperature + 1;
|
|
416
|
+
this.accessory.currentOperationMode = heatingToFan ? 0 : 1;
|
|
417
|
+
break;
|
|
418
|
+
case 'COOLING': //COOLING
|
|
419
|
+
const coolingToFan = roomTemperature < defaultCoolingSetTemperature - 1;
|
|
420
|
+
this.accessory.currentOperationMode = cooling ? 0 : 2;
|
|
421
|
+
break;
|
|
422
|
+
default: //FAN
|
|
423
|
+
this.accessory.currentOperationMode = roomTemperature <= defaultHeatingSetTemperature ? 1 : roomTemperature >= defaultCoolingSetTemperature ? 2 : 0;
|
|
424
|
+
break;
|
|
425
|
+
};
|
|
404
426
|
this.accessory.targetOperationMode = 3;
|
|
405
427
|
break;
|
|
406
428
|
case 9: //ISEE HEAT
|
|
@@ -422,12 +444,10 @@ class DeviceAta extends EventEmitter {
|
|
|
422
444
|
break;
|
|
423
445
|
case false:
|
|
424
446
|
this.accessory.currentOperationMode = 0;
|
|
425
|
-
this.accessory.targetOperationMode = 0;
|
|
426
447
|
break;
|
|
427
448
|
};
|
|
428
449
|
case false:
|
|
429
450
|
this.accessory.currentOperationMode = 0;
|
|
430
|
-
this.accessory.targetOperationMode = 0;
|
|
431
451
|
break;
|
|
432
452
|
};
|
|
433
453
|
this.accessory.operationModeSetPropsMinValue = 0
|
|
@@ -608,17 +628,18 @@ class DeviceAta extends EventEmitter {
|
|
|
608
628
|
//log current state
|
|
609
629
|
if (!this.disableLogInfo) {
|
|
610
630
|
this.emit('message', `Power: ${power ? 'ON' : 'OFF'}`);
|
|
611
|
-
this.emit('message', `
|
|
612
|
-
this.emit('message', `
|
|
613
|
-
|
|
614
|
-
const
|
|
615
|
-
const
|
|
616
|
-
const
|
|
631
|
+
this.emit('message', `Target operation mode: ${CONSTANTS.AirConditioner.DriveMode[operationMode]}`);
|
|
632
|
+
this.emit('message', `Current operation mode: ${this.displayMode === 1 ? CONSTANTS.AirConditioner.CurrentOperationModeHeatherCooler[this.accessory.currentOperationMode] : CONSTANTS.AirConditioner.CurrentOperationModeThermostat[this.accessory.currentOperationMode]}`);
|
|
633
|
+
this.emit('message', `Room temperature: ${roomTemperature}${this.accessory.temperatureUnit}`);
|
|
634
|
+
const info = hasOutdoorTemperature && deviceData.Device.OutdoorTemperature !== null ? this.emit('message', `Outdoor temperature: ${outdoorTemperature}${this.accessory.temperatureUnit}`) : false;
|
|
635
|
+
const info0 = operationMode !== 8 ? this.emit('message', `Target temperature: ${setTemperature}${this.accessory.temperatureUnit}`) : false;
|
|
636
|
+
const info1 = operationMode === 8 && modelSupportsHeat ? this.emit('message', `Heating threshold temperature: ${defaultHeatingSetTemperature}${this.accessory.temperatureUnit}`) : false;
|
|
637
|
+
const info2 = operationMode === 8 && modelSupportsCool ? this.emit('message', `Cooling threshold temperature: ${defaultCoolingSetTemperature}${this.accessory.temperatureUnit}`) : false;
|
|
617
638
|
const info3 = modelSupportsFanSpeed ? this.emit('message', `Fan speed mode: ${CONSTANTS.AirConditioner.FanSpeed[fanSpeed]}`) : false;
|
|
618
639
|
const info4 = vaneHorizontalDirection !== null ? this.emit('message', `Vane horizontal: ${CONSTANTS.AirConditioner.HorizontalVane[vaneHorizontalDirection]}`) : false;
|
|
619
640
|
const info5 = vaneVerticalDirection !== null ? this.emit('message', `Vane vertical: ${CONSTANTS.AirConditioner.VerticalVane[vaneVerticalDirection]}`) : false;
|
|
620
|
-
const info6 = swingFunction ? this.emit('message', `
|
|
621
|
-
this.emit('message', `Temperature display unit: ${temperatureUnit}`);
|
|
641
|
+
const info6 = swingFunction ? this.emit('message', `Air direction: ${CONSTANTS.AirConditioner.AirDirection[this.accessory.swingMode ? 7 : 0]}`) : false;
|
|
642
|
+
this.emit('message', `Temperature display unit: ${this.accessory.temperatureUnit}`);
|
|
622
643
|
this.emit('message', `Lock physical controls: ${this.accessory.lockPhysicalControl ? 'LOCKED' : 'UNLOCKED'}`);
|
|
623
644
|
};
|
|
624
645
|
|
|
@@ -626,7 +647,6 @@ class DeviceAta extends EventEmitter {
|
|
|
626
647
|
if (!this.startPrepareAccessory) {
|
|
627
648
|
return;
|
|
628
649
|
}
|
|
629
|
-
|
|
630
650
|
try {
|
|
631
651
|
const accessory = await this.prepareAccessory(this.accountInfo, deviceData, this.deviceId, this.deviceTypeText, this.deviceName, this.accountName);
|
|
632
652
|
this.emit('publishAccessory', accessory);
|
|
@@ -742,6 +762,20 @@ class DeviceAta extends EventEmitter {
|
|
|
742
762
|
//prepare accessory
|
|
743
763
|
async prepareAccessory(accountInfo, deviceData, deviceId, deviceTypeText, deviceName, accountName) {
|
|
744
764
|
try {
|
|
765
|
+
const modelSupportsHeat = this.accessory.modelSupportsHeat;
|
|
766
|
+
const modelSupportsDry = this.accessory.modelSupportsDry;
|
|
767
|
+
const modelSupportsCool = this.accessory.modelSupportsCool;
|
|
768
|
+
const modelSupportsAuto = this.accessory.modelSupportsAuto;
|
|
769
|
+
const modelSupportsFanSpeed = this.accessory.modelSupportsFanSpeed;
|
|
770
|
+
const hasAutomaticFanSpeed = this.accessory.hasAutomaticFanSpeed;
|
|
771
|
+
const hasOutdoorTemperature = this.accessory.hasOutdoorTemperature;
|
|
772
|
+
const numberOfFanSpeeds = this.accessory.numberOfFanSpeeds;
|
|
773
|
+
const swingFunction = this.accessory.swingFunction;
|
|
774
|
+
const presetsOnServer = this.accessory.presets;
|
|
775
|
+
const autoDryFanMode = [this.accessory.operationMode, 8, modelSupportsDry ? 2 : 8, 7][this.autoDryFanMode]; //NONE, AUTO - 8, DRY - 2, FAN - 7
|
|
776
|
+
const heatDryFanMode = [this.accessory.operationMode, 1, modelSupportsDry ? 2 : 1, 7][this.heatDryFanMode]; //NONE, HEAT - 1, DRY - 2, FAN - 7
|
|
777
|
+
const coolDryFanMode = [this.accessory.operationMode, 3, modelSupportsDry ? 2 : 3, 7][this.coolDryFanMode]; //NONE, COOL - 3, DRY - 2, FAN - 7
|
|
778
|
+
|
|
745
779
|
//accessory
|
|
746
780
|
const debug = this.enableDebugMode ? this.emit('debug', `Prepare accessory`) : false;
|
|
747
781
|
const accessoryName = deviceName;
|
|
@@ -758,25 +792,8 @@ class DeviceAta extends EventEmitter {
|
|
|
758
792
|
.setCharacteristic(Characteristic.FirmwareRevision, this.firmwareRevision);
|
|
759
793
|
|
|
760
794
|
//melcloud services
|
|
761
|
-
const displayMode = this.displayMode;
|
|
762
|
-
const temperatureSensor = this.temperatureSensor;
|
|
763
|
-
const temperatureSensorOutdoor = this.temperatureSensorOutdoor;
|
|
764
|
-
const hasAutomaticFanSpeed = this.accessory.hasAutomaticFanSpeed;
|
|
765
|
-
const modelSupportsHeat = this.accessory.modelSupportsHeat;
|
|
766
|
-
const modelSupportsCool = this.accessory.modelSupportsCool;
|
|
767
|
-
const modelSupportsAuto = this.accessory.modelSupportsAuto;
|
|
768
|
-
const modelSupportsFanSpeed = this.accessory.modelSupportsFanSpeed;
|
|
769
|
-
const modelSupportsDry = this.accessory.modelSupportsDry;
|
|
770
|
-
const numberOfFanSpeeds = this.accessory.numberOfFanSpeeds;
|
|
771
|
-
const swingFunction = this.accessory.swingFunction;
|
|
772
|
-
const hasOutdoorTemperature = this.accessory.hasOutdoorTemperature;
|
|
773
|
-
const presetsOnServer = this.accessory.presetsOnServer;
|
|
774
|
-
const autoDryFanMode = [deviceData.Device.OperationMode, 8, modelSupportsDry ? 2 : 8, 7][this.autoDryFanMode]; //NONE, AUTO - 8, DRY - 2, FAN - 7
|
|
775
|
-
const heatDryFanMode = [deviceData.Device.OperationMode, 1, modelSupportsDry ? 2 : 1, 7][this.heatDryFanMode]; //NONE, HEAT - 1, DRY - 2, FAN - 7
|
|
776
|
-
const coolDryFanMode = [deviceData.Device.OperationMode, 3, modelSupportsDry ? 2 : 3, 7][this.coolDryFanMode]; //NONE, COOL - 3, DRY - 2, FAN - 7
|
|
777
795
|
const serviceName = `${deviceTypeText} ${accessoryName}`;
|
|
778
|
-
|
|
779
|
-
switch (displayMode) {
|
|
796
|
+
switch (this.displayMode) {
|
|
780
797
|
case 1: //Heater Cooler
|
|
781
798
|
const debug = this.enableDebugMode ? this.emit('debug', `Prepare heater/cooler service`) : false;
|
|
782
799
|
this.melCloudService = new Service.HeaterCooler(serviceName, `HeaterCooler ${deviceId}`);
|
|
@@ -815,18 +832,16 @@ class DeviceAta extends EventEmitter {
|
|
|
815
832
|
switch (value) {
|
|
816
833
|
case 0: //AUTO - AUTO
|
|
817
834
|
deviceData.Device.OperationMode = autoDryFanMode;
|
|
818
|
-
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
819
835
|
break;
|
|
820
836
|
case 1: //HEAT - HEAT
|
|
821
837
|
deviceData.Device.OperationMode = heatDryFanMode;
|
|
822
|
-
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
823
838
|
break;
|
|
824
839
|
case 2: //COOL - COOL
|
|
825
840
|
deviceData.Device.OperationMode = coolDryFanMode;
|
|
826
|
-
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
827
841
|
break;
|
|
828
842
|
};
|
|
829
843
|
|
|
844
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
830
845
|
await this.melCloudAta.send(deviceData);
|
|
831
846
|
const operationModeText = CONSTANTS.AirConditioner.DriveMode[deviceData.Device.OperationMode];
|
|
832
847
|
const info = this.disableLogInfo ? false : this.emit('message', `Set operation mode: ${operationModeText}`);
|
|
@@ -887,7 +902,7 @@ class DeviceAta extends EventEmitter {
|
|
|
887
902
|
if (swingFunction) {
|
|
888
903
|
this.melCloudService.getCharacteristic(Characteristic.SwingMode)
|
|
889
904
|
.onGet(async () => {
|
|
890
|
-
//Vane Horizontal: Auto, 1, 2, 3, 4, 5, 12 = Swing //Vertical: Auto, 1, 2, 3, 4, 5, 7 = Swing
|
|
905
|
+
//Vane Horizontal: Auto, 1, 2, 3, 4, 5, 6, 12 = Swing //Vertical: Auto, 1, 2, 3, 4, 5, 7 = Swing
|
|
891
906
|
const value = this.accessory.swingMode;
|
|
892
907
|
return value;
|
|
893
908
|
})
|
|
@@ -897,53 +912,68 @@ class DeviceAta extends EventEmitter {
|
|
|
897
912
|
deviceData.Device.VaneVertical = value ? 7 : 0;
|
|
898
913
|
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal + CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
899
914
|
await this.melCloudAta.send(deviceData);
|
|
900
|
-
const info = this.disableLogInfo ? false : this.emit('message', `Set
|
|
915
|
+
const info = this.disableLogInfo ? false : this.emit('message', `Set air direction mode: ${CONSTANTS.AirConditioner.AirDirection[value ? 7 : 0]}`);
|
|
901
916
|
} catch (error) {
|
|
902
917
|
this.emit('warn', `Set vane swing mode error: ${error}`);
|
|
903
918
|
};
|
|
904
919
|
});
|
|
905
920
|
};
|
|
906
|
-
if (
|
|
907
|
-
this.melCloudService.getCharacteristic(Characteristic.
|
|
921
|
+
if (modelSupportsCool) {
|
|
922
|
+
this.melCloudService.getCharacteristic(Characteristic.CoolingThresholdTemperature)
|
|
908
923
|
.setProps({
|
|
909
|
-
minValue:
|
|
924
|
+
minValue: 16,
|
|
910
925
|
maxValue: 31,
|
|
911
926
|
minStep: this.accessory.temperatureIncrement
|
|
912
927
|
})
|
|
913
928
|
.onGet(async () => {
|
|
914
|
-
const value = this.accessory.
|
|
929
|
+
const value = this.accessory.operationMode === 8 ? this.accessory.defaultCoolingSetTemperature : this.accessory.setTemperature;
|
|
915
930
|
return value;
|
|
916
931
|
})
|
|
917
932
|
.onSet(async (value) => {
|
|
918
933
|
try {
|
|
919
|
-
|
|
934
|
+
switch (this.accessory.operationMode) {
|
|
935
|
+
case 8: //AUTO - AUTO
|
|
936
|
+
deviceData.Device.DefaultCoolingSetTemperature = value;
|
|
937
|
+
break;
|
|
938
|
+
default:
|
|
939
|
+
deviceData.Device.SetTemperature = value;
|
|
940
|
+
break
|
|
941
|
+
};
|
|
920
942
|
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
|
|
921
943
|
await this.melCloudAta.send(deviceData);
|
|
922
|
-
const info = this.disableLogInfo ? false : this.emit('message', `Set
|
|
944
|
+
const info = this.disableLogInfo ? false : this.emit('message', `Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
923
945
|
} catch (error) {
|
|
924
|
-
this.emit('warn', `Set
|
|
946
|
+
this.emit('warn', `Set cooling threshold temperature error: ${error}`);
|
|
925
947
|
};
|
|
926
948
|
});
|
|
927
949
|
};
|
|
928
|
-
if (
|
|
929
|
-
this.melCloudService.getCharacteristic(Characteristic.
|
|
950
|
+
if (modelSupportsHeat) {
|
|
951
|
+
this.melCloudService.getCharacteristic(Characteristic.HeatingThresholdTemperature)
|
|
930
952
|
.setProps({
|
|
931
|
-
minValue:
|
|
953
|
+
minValue: 10,
|
|
932
954
|
maxValue: 31,
|
|
933
955
|
minStep: this.accessory.temperatureIncrement
|
|
934
956
|
})
|
|
935
957
|
.onGet(async () => {
|
|
936
|
-
const value = this.accessory.
|
|
958
|
+
const value = this.accessory.operationMode === 8 ? this.accessory.defaultHeatingSetTemperature : this.accessory.setTemperature;
|
|
937
959
|
return value;
|
|
938
960
|
})
|
|
939
961
|
.onSet(async (value) => {
|
|
940
962
|
try {
|
|
941
|
-
|
|
963
|
+
switch (this.accessory.operationMode) {
|
|
964
|
+
case 8: //AUTO - AUTO
|
|
965
|
+
deviceData.Device.DefaultHeatingSetTemperature = value;
|
|
966
|
+
break;
|
|
967
|
+
default:
|
|
968
|
+
deviceData.Device.SetTemperature = value;
|
|
969
|
+
break
|
|
970
|
+
};
|
|
971
|
+
|
|
942
972
|
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
|
|
943
973
|
await this.melCloudAta.send(deviceData);
|
|
944
|
-
const info = this.disableLogInfo ? false : this.emit('message', `Set
|
|
974
|
+
const info = this.disableLogInfo ? false : this.emit('message', `Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
945
975
|
} catch (error) {
|
|
946
|
-
this.emit('warn', `Set
|
|
976
|
+
this.emit('warn', `Set heating threshold temperature error: ${error}`);
|
|
947
977
|
};
|
|
948
978
|
});
|
|
949
979
|
};
|
|
@@ -972,7 +1002,7 @@ class DeviceAta extends EventEmitter {
|
|
|
972
1002
|
})
|
|
973
1003
|
.onSet(async (value) => {
|
|
974
1004
|
try {
|
|
975
|
-
accountInfo.UseFahrenheit =
|
|
1005
|
+
accountInfo.UseFahrenheit = [false, true][value];
|
|
976
1006
|
await this.melCloud.send(accountInfo);
|
|
977
1007
|
const info = this.disableLogInfo ? false : this.emit('message', `Set temperature display unit: ${CONSTANTS.TemperatureDisplayUnits[value]}`);
|
|
978
1008
|
} catch (error) {
|
|
@@ -1055,49 +1085,51 @@ class DeviceAta extends EventEmitter {
|
|
|
1055
1085
|
this.emit('warn', `Set temperature error: ${error}`);
|
|
1056
1086
|
};
|
|
1057
1087
|
});
|
|
1058
|
-
if (modelSupportsAuto
|
|
1059
|
-
|
|
1060
|
-
.
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
.
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1088
|
+
if (modelSupportsAuto) {
|
|
1089
|
+
if (modelSupportsHeat) {
|
|
1090
|
+
this.melCloudService.getCharacteristic(Characteristic.HeatingThresholdTemperature)
|
|
1091
|
+
.setProps({
|
|
1092
|
+
minValue: 10,
|
|
1093
|
+
maxValue: 31,
|
|
1094
|
+
minStep: this.accessory.temperatureIncrement
|
|
1095
|
+
})
|
|
1096
|
+
.onGet(async () => {
|
|
1097
|
+
const value = this.accessory.defaultHeatingSetTemperature;
|
|
1098
|
+
return value;
|
|
1099
|
+
})
|
|
1100
|
+
.onSet(async (value) => {
|
|
1101
|
+
try {
|
|
1102
|
+
deviceData.Device.DefaultHeatingSetTemperature = value;
|
|
1103
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
|
|
1104
|
+
await this.melCloudAta.send(deviceData);
|
|
1105
|
+
const info = this.disableLogInfo ? false : this.emit('message', `Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
1106
|
+
} catch (error) {
|
|
1107
|
+
this.emit('warn', `Set heating threshold temperature error: ${error}`);
|
|
1108
|
+
};
|
|
1109
|
+
});
|
|
1110
|
+
};
|
|
1111
|
+
if (modelSupportsCool) {
|
|
1112
|
+
this.melCloudService.getCharacteristic(Characteristic.CoolingThresholdTemperature)
|
|
1113
|
+
.setProps({
|
|
1114
|
+
minValue: 16,
|
|
1115
|
+
maxValue: 31,
|
|
1116
|
+
minStep: this.accessory.temperatureIncrement
|
|
1117
|
+
})
|
|
1118
|
+
.onGet(async () => {
|
|
1119
|
+
const value = this.accessory.defaultCoolingSetTemperature;
|
|
1120
|
+
return value;
|
|
1121
|
+
})
|
|
1122
|
+
.onSet(async (value) => {
|
|
1123
|
+
try {
|
|
1124
|
+
deviceData.Device.DefaultCoolingSetTemperature = value;
|
|
1125
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
|
|
1126
|
+
await this.melCloudAta.send(deviceData);
|
|
1127
|
+
const info = this.disableLogInfo ? false : this.emit('message', `Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
1128
|
+
} catch (error) {
|
|
1129
|
+
this.emit('warn', `Set cooling threshold temperature error: ${error}`);
|
|
1130
|
+
};
|
|
1131
|
+
});
|
|
1132
|
+
};
|
|
1101
1133
|
};
|
|
1102
1134
|
this.melCloudService.getCharacteristic(Characteristic.TemperatureDisplayUnits)
|
|
1103
1135
|
.onGet(async () => {
|
|
@@ -1106,7 +1138,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1106
1138
|
})
|
|
1107
1139
|
.onSet(async (value) => {
|
|
1108
1140
|
try {
|
|
1109
|
-
accountInfo.UseFahrenheit =
|
|
1141
|
+
accountInfo.UseFahrenheit = [false, true][value];
|
|
1110
1142
|
await this.melCloud.send(accountInfo);
|
|
1111
1143
|
const info = this.disableLogInfo ? false : this.emit('message', `Set temperature display unit: ${CONSTANTS.TemperatureDisplayUnits[value]}`);
|
|
1112
1144
|
} catch (error) {
|
|
@@ -1118,7 +1150,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1118
1150
|
};
|
|
1119
1151
|
|
|
1120
1152
|
//temperature sensor services
|
|
1121
|
-
if (temperatureSensor && this.accessory.roomTemperature !== null) {
|
|
1153
|
+
if (this.temperatureSensor && this.accessory.roomTemperature !== null) {
|
|
1122
1154
|
const debug = this.enableDebugMode ? this.emit('debug', `Prepare room temperature sensor service`) : false;
|
|
1123
1155
|
this.roomTemperatureSensorService = new Service.TemperatureSensor(`${serviceName} Room`, `Room Temperature Sensor ${deviceId}`);
|
|
1124
1156
|
this.roomTemperatureSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
@@ -1136,7 +1168,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1136
1168
|
accessory.addService(this.roomTemperatureSensorService);
|
|
1137
1169
|
};
|
|
1138
1170
|
|
|
1139
|
-
if (temperatureSensorOutdoor && hasOutdoorTemperature && this.accessory.outdoorTemperature !== null) {
|
|
1171
|
+
if (this.temperatureSensorOutdoor && hasOutdoorTemperature && this.accessory.outdoorTemperature !== null) {
|
|
1140
1172
|
const debug = this.enableDebugMode ? this.emit('debug', `Prepare outdoor temperature sensor service`) : false;
|
|
1141
1173
|
this.outdoorTemperatureSensorService = new Service.TemperatureSensor(`${serviceName} Outdoor`, `Outdoor Temperature Sensor ${deviceId}`);
|
|
1142
1174
|
this.outdoorTemperatureSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|