homebridge-melcloud-control 4.0.0-beta.151 → 4.0.0-beta.153
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 +33 -41
- package/src/melcloudata.js +4 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.0.0-beta.
|
|
4
|
+
"version": "4.0.0-beta.153",
|
|
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/deviceata.js
CHANGED
|
@@ -151,8 +151,6 @@ class DeviceAta extends EventEmitter {
|
|
|
151
151
|
async setOverExternalIntegration(integration, deviceData, key, value) {
|
|
152
152
|
try {
|
|
153
153
|
let set = false
|
|
154
|
-
const vaneVerticalKey = this.accountType === 'melcloud' ? 'VaneVertical' : 'VaneVerticalDirection';
|
|
155
|
-
const vaneHorizontalKey = this.accountType === 'melcloud' ? 'VaneHorizontal' : 'VaneHorizontalDirection';
|
|
156
154
|
switch (key) {
|
|
157
155
|
case 'Power':
|
|
158
156
|
deviceData.Device[key] = value;
|
|
@@ -186,12 +184,12 @@ class DeviceAta extends EventEmitter {
|
|
|
186
184
|
break;
|
|
187
185
|
case 'VaneHorizontalDirection':
|
|
188
186
|
deviceData.Device[key] = value;
|
|
189
|
-
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags
|
|
187
|
+
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.VaneHorizontalDirection;
|
|
190
188
|
set = await this.melCloudAta.send(this.accountType, deviceData, this.displayMode);
|
|
191
189
|
break;
|
|
192
190
|
case 'VaneVerticalDirection':
|
|
193
191
|
deviceData.Device[key] = value;
|
|
194
|
-
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags
|
|
192
|
+
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.VaneVerticalDirection;
|
|
195
193
|
set = await this.melCloudAta.send(this.accountType, deviceData, this.displayMode);
|
|
196
194
|
break;
|
|
197
195
|
case 'HideVaneControls':
|
|
@@ -333,6 +331,7 @@ class DeviceAta extends EventEmitter {
|
|
|
333
331
|
return;
|
|
334
332
|
};
|
|
335
333
|
|
|
334
|
+
this.emit('warn', deviceData.Device.OperationMode);
|
|
336
335
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.OperationMode;
|
|
337
336
|
await this.melCloudAta.send(this.accountType, deviceData, this.displayMode);
|
|
338
337
|
const operationModeText = AirConditioner.OperationMode[deviceData.Device.OperationMode];
|
|
@@ -354,7 +353,7 @@ class DeviceAta extends EventEmitter {
|
|
|
354
353
|
minStep: 1
|
|
355
354
|
})
|
|
356
355
|
.onGet(async () => {
|
|
357
|
-
const value = this.accessory.
|
|
356
|
+
const value = this.accessory.currentFanSpeed; //AUTO, 1, 2, 3, 4, 5, 6, OFF
|
|
358
357
|
return value;
|
|
359
358
|
})
|
|
360
359
|
.onSet(async (value) => {
|
|
@@ -391,15 +390,13 @@ class DeviceAta extends EventEmitter {
|
|
|
391
390
|
this.melCloudService.getCharacteristic(Characteristic.SwingMode)
|
|
392
391
|
.onGet(async () => {
|
|
393
392
|
//Vane Horizontal: Auto, 1, 2, 3, 4, 5, 6, 7 = Sp;it, 12 = Swing //Vertical: Auto, 1, 2, 3, 4, 5, 7 = Swing
|
|
394
|
-
const value = this.accessory.
|
|
393
|
+
const value = this.accessory.currentSwingMode;
|
|
395
394
|
return value;
|
|
396
395
|
})
|
|
397
396
|
.onSet(async (value) => {
|
|
398
397
|
try {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
deviceData.Device[vaneHorizontalKey] = value ? 12 : 0;
|
|
402
|
-
deviceData.Device[vaneVerticalKey] = value ? 7 : 0;
|
|
398
|
+
deviceData.Device.VaneHorizontalDirection = value ? 12 : 0;
|
|
399
|
+
deviceData.Device.VaneVerticalDirection = value ? 7 : 0;
|
|
403
400
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.VaneVerticalVaneHorizontal;
|
|
404
401
|
await this.melCloudAta.send(this.accountType, deviceData, this.displayMode);
|
|
405
402
|
if (this.logInfo) this.emit('info', `Set air direction mode: ${AirConditioner.AirDirection[value]}`);
|
|
@@ -645,16 +642,14 @@ class DeviceAta extends EventEmitter {
|
|
|
645
642
|
.onSet(async (state) => {
|
|
646
643
|
try {
|
|
647
644
|
const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
|
|
648
|
-
const vaneVerticalKey = this.accountType === 'melcloud' ? 'VaneVertical' : 'VaneVerticalDirection';
|
|
649
|
-
const vaneHorizontalKey = this.accountType === 'melcloud' ? 'VaneHorizontal' : 'VaneHorizontalDirection';
|
|
650
645
|
switch (state) {
|
|
651
646
|
case true:
|
|
652
647
|
preset.previousSettings = deviceData.Device;
|
|
653
648
|
deviceData.Device.Power = presetData.Power;
|
|
654
649
|
deviceData.Device.OperationMode = presetData.OperationMode;
|
|
655
650
|
deviceData.Device.SetTemperature = presetData.SetTemperature;
|
|
656
|
-
deviceData.Device
|
|
657
|
-
deviceData.Device
|
|
651
|
+
deviceData.Device.VaneHorizontalDirection = presetData.VaneHorizontalDirection;
|
|
652
|
+
deviceData.Device.VaneVerticalDirection = presetData.VaneVerticalDirection;
|
|
658
653
|
deviceData.Device[fanKey] = presetData[fanKey];
|
|
659
654
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Presets;
|
|
660
655
|
break;
|
|
@@ -662,8 +657,8 @@ class DeviceAta extends EventEmitter {
|
|
|
662
657
|
deviceData.Device.Power = preset.previousSettings.Power;
|
|
663
658
|
deviceData.Device.OperationMode = preset.previousSettings.OperationMode;
|
|
664
659
|
deviceData.Device.SetTemperature = preset.previousSettings.SetTemperature;
|
|
665
|
-
deviceData.Device
|
|
666
|
-
deviceData.Device
|
|
660
|
+
deviceData.Device.VaneHorizontalDirection = preset.previousSettings.VaneHorizontalDirection;
|
|
661
|
+
deviceData.Device.VaneVerticalDirection = preset.previousSettings.VaneVerticalDirection;
|
|
667
662
|
deviceData.Device[fanKey] = preset.previousSettings[fanKey];
|
|
668
663
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Presets;
|
|
669
664
|
break;
|
|
@@ -990,10 +985,7 @@ class DeviceAta extends EventEmitter {
|
|
|
990
985
|
const maxTempCoolDryAuto = 31;
|
|
991
986
|
|
|
992
987
|
//device state
|
|
993
|
-
const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
|
|
994
988
|
const tempStepKey = this.accountType === 'melcloud' ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
|
|
995
|
-
const vaneVerticalKey = this.accountType === 'melcloud' ? 'VaneVertical' : 'VaneVerticalDirection';
|
|
996
|
-
const vaneHorizontalKey = this.accountType === 'melcloud' ? 'VaneHorizontal' : 'VaneHorizontalDirection';
|
|
997
989
|
const power = deviceData.Device.Power ?? false;
|
|
998
990
|
const inStandbyMode = deviceData.Device.InStandbyMode ?? false;
|
|
999
991
|
const roomTemperature = deviceData.Device.RoomTemperature;
|
|
@@ -1002,11 +994,11 @@ class DeviceAta extends EventEmitter {
|
|
|
1002
994
|
const defaultCoolingSetTemperature = deviceData.Device.DefaultCoolingSetTemperature ?? 23;
|
|
1003
995
|
const actualFanSpeed = deviceData.Device.ActualFanSpeed;
|
|
1004
996
|
const automaticFanSpeed = deviceData.Device.AutomaticFanSpeed;
|
|
1005
|
-
const
|
|
997
|
+
const setFanSpeed = deviceData.Device.SetFanSpeed;
|
|
1006
998
|
const operationMode = deviceData.Device.OperationMode;
|
|
1007
|
-
const vaneVerticalDirection = deviceData.Device
|
|
999
|
+
const vaneVerticalDirection = deviceData.Device.VaneVerticalDirection;
|
|
1008
1000
|
const vaneVerticalSwing = deviceData.Device.VaneVerticalSwing;
|
|
1009
|
-
const vaneHorizontalDirection = deviceData.Device
|
|
1001
|
+
const vaneHorizontalDirection = deviceData.Device.VaneHorizontalDirection;
|
|
1010
1002
|
const vaneHorizontalSwing = deviceData.Device.VaneHorizontalSwing;
|
|
1011
1003
|
const prohibitSetTemperature = deviceData.Device.ProhibitSetTemperature ?? false;
|
|
1012
1004
|
const prohibitOperationMode = deviceData.Device.ProhibitOperationMode ?? false;
|
|
@@ -1046,7 +1038,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1046
1038
|
automaticFanSpeed: automaticFanSpeed,
|
|
1047
1039
|
vaneVerticalSwing: vaneVerticalSwing,
|
|
1048
1040
|
vaneHorizontalSwing: vaneHorizontalSwing,
|
|
1049
|
-
|
|
1041
|
+
currentSwingMode: supportsSwingFunction && vaneHorizontalDirection === 12 && vaneVerticalDirection === 7 ? 1 : 0,
|
|
1050
1042
|
lockPhysicalControl: prohibitSetTemperature && prohibitOperationMode && prohibitPower ? 1 : 0,
|
|
1051
1043
|
temperatureStep: temperatureStep,
|
|
1052
1044
|
useFahrenheit: this.useFahrenheit,
|
|
@@ -1103,19 +1095,19 @@ class DeviceAta extends EventEmitter {
|
|
|
1103
1095
|
if (supportsFanSpeed) {
|
|
1104
1096
|
switch (numberOfFanSpeeds) {
|
|
1105
1097
|
case 2: //Fan speed mode 2
|
|
1106
|
-
obj.
|
|
1098
|
+
obj.currentFanSpeed = supportsAutomaticFanSpeed ? [3, 1, 2][setFanSpeed] : [0, 1, 2][setFanSpeed];
|
|
1107
1099
|
obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 3 : 2;
|
|
1108
1100
|
break;
|
|
1109
1101
|
case 3: //Fan speed mode 3
|
|
1110
|
-
obj.
|
|
1102
|
+
obj.currentFanSpeed = supportsAutomaticFanSpeed ? [4, 1, 2, 3][setFanSpeed] : [0, 1, 2, 3][setFanSpeed];
|
|
1111
1103
|
obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 4 : 3;
|
|
1112
1104
|
break;
|
|
1113
1105
|
case 4: //Fan speed mode 4
|
|
1114
|
-
obj.
|
|
1106
|
+
obj.currentFanSpeed = supportsAutomaticFanSpeed ? [5, 1, 2, 3, 4][setFanSpeed] : [0, 1, 2, 3, 4][setFanSpeed];
|
|
1115
1107
|
obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 5 : 4;
|
|
1116
1108
|
break;
|
|
1117
1109
|
case 5: //Fan speed mode 5
|
|
1118
|
-
obj.
|
|
1110
|
+
obj.currentFanSpeed = supportsAutomaticFanSpeed ? [6, 1, 2, 3, 4, 5][setFanSpeed] : [0, 1, 2, 3, 4, 5][setFanSpeed];
|
|
1119
1111
|
obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 6 : 5;
|
|
1120
1112
|
break;
|
|
1121
1113
|
};
|
|
@@ -1131,8 +1123,8 @@ class DeviceAta extends EventEmitter {
|
|
|
1131
1123
|
.updateCharacteristic(Characteristic.TemperatureDisplayUnits, obj.useFahrenheit)
|
|
1132
1124
|
.updateCharacteristic(Characteristic.CoolingThresholdTemperature, defaultCoolingSetTemperature);
|
|
1133
1125
|
if (supportsHeat) this.melCloudService?.updateCharacteristic(Characteristic.HeatingThresholdTemperature, defaultHeatingSetTemperature);
|
|
1134
|
-
if (supportsFanSpeed) this.melCloudService?.updateCharacteristic(Characteristic.RotationSpeed, obj.
|
|
1135
|
-
if (supportsSwingFunction) this.melCloudService?.updateCharacteristic(Characteristic.SwingMode, obj.
|
|
1126
|
+
if (supportsFanSpeed) this.melCloudService?.updateCharacteristic(Characteristic.RotationSpeed, obj.currentFanSpeed);
|
|
1127
|
+
if (supportsSwingFunction) this.melCloudService?.updateCharacteristic(Characteristic.SwingMode, obj.currentSwingMode);
|
|
1136
1128
|
break;
|
|
1137
1129
|
case 2: //Thermostat
|
|
1138
1130
|
switch (operationMode) {
|
|
@@ -1201,9 +1193,9 @@ class DeviceAta extends EventEmitter {
|
|
|
1201
1193
|
preset.state = presetData ? (presetData.Power === power
|
|
1202
1194
|
&& presetData.SetTemperature === setTemperature
|
|
1203
1195
|
&& presetData.OperationMode === operationMode
|
|
1204
|
-
&& presetData
|
|
1205
|
-
&& presetData
|
|
1206
|
-
&& presetData
|
|
1196
|
+
&& presetData.VaneHorizontalDirection === vaneHorizontalDirection
|
|
1197
|
+
&& presetData.VaneVerticalDirection === vaneVerticalDirection
|
|
1198
|
+
&& presetData.SetFanSpeed === setFanSpeed) : false;
|
|
1207
1199
|
|
|
1208
1200
|
const characteristicType = preset.characteristicType;
|
|
1209
1201
|
this.presetsServices?.[i]?.updateCharacteristic(characteristicType, preset.state);
|
|
@@ -1288,25 +1280,25 @@ class DeviceAta extends EventEmitter {
|
|
|
1288
1280
|
button.state = power ? (hideVaneControls === true) : false;
|
|
1289
1281
|
break;
|
|
1290
1282
|
case 30: //FAN SPEED MODE AUTO
|
|
1291
|
-
button.state = power ? (
|
|
1283
|
+
button.state = power ? (setFanSpeed === 0) : false;
|
|
1292
1284
|
break;
|
|
1293
1285
|
case 31: //FAN SPEED MODE 1
|
|
1294
|
-
button.state = power ? (
|
|
1286
|
+
button.state = power ? (setFanSpeed === 1) : false;
|
|
1295
1287
|
break;
|
|
1296
1288
|
case 32: //FAN SPEED MODE 2
|
|
1297
|
-
button.state = power ? (
|
|
1289
|
+
button.state = power ? (setFanSpeed === 2) : false;
|
|
1298
1290
|
break;
|
|
1299
1291
|
case 33: //FAN SPEED MODE 3
|
|
1300
|
-
button.state = power ? (
|
|
1292
|
+
button.state = power ? (setFanSpeed === 3) : false;
|
|
1301
1293
|
break;
|
|
1302
1294
|
case 34: //FAN SPEED MODE 4
|
|
1303
|
-
button.state = power ? (
|
|
1295
|
+
button.state = power ? (setFanSpeed === 4) : false;
|
|
1304
1296
|
break;
|
|
1305
1297
|
case 35: //FAN SPEED MODE 5
|
|
1306
|
-
button.state = power ? (
|
|
1298
|
+
button.state = power ? (setFanSpeed === 5) : false;
|
|
1307
1299
|
break;
|
|
1308
1300
|
case 36: //FAN SPEED MODE 6
|
|
1309
|
-
button.state = power ? (
|
|
1301
|
+
button.state = power ? (setFanSpeed === 6) : false;
|
|
1310
1302
|
break;
|
|
1311
1303
|
case 37: //PHYSICAL LOCK CONTROLS ALL
|
|
1312
1304
|
button.state = (obj.lockPhysicalControl === 1);
|
|
@@ -1339,11 +1331,11 @@ class DeviceAta extends EventEmitter {
|
|
|
1339
1331
|
this.emit('info', `Target temperature: ${setTemperature}${obj.temperatureUnit}`);
|
|
1340
1332
|
this.emit('info', `Current temperature: ${roomTemperature}${obj.temperatureUnit}`);
|
|
1341
1333
|
if (supportsOutdoorTemperature && outdoorTemperature !== null) this.emit('info', `Outdoor temperature: ${outdoorTemperature}${obj.temperatureUnit}`);
|
|
1342
|
-
if (supportsFanSpeed) this.emit('info', `Target fan speed: ${AirConditioner.FanSpeedMapHomekit[
|
|
1334
|
+
if (supportsFanSpeed) this.emit('info', `Target fan speed: ${AirConditioner.FanSpeedMapHomekit[setFanSpeed]}`);
|
|
1343
1335
|
if (supportsFanSpeed) this.emit('info', `Current fan speed: ${AirConditioner.FanSpeedMapHomekit[actualFanSpeed]}`);
|
|
1344
1336
|
if (vaneHorizontalDirection !== null) this.emit('info', `Vane horizontal: ${AirConditioner.VaneHorizontal[vaneHorizontalDirection]}`);
|
|
1345
1337
|
if (vaneVerticalDirection !== null) this.emit('info', `Vane vertical: ${AirConditioner.VaneVertical[vaneVerticalDirection]}`);
|
|
1346
|
-
if (supportsSwingFunction) this.emit('info', `Air direction: ${AirConditioner.AirDirection[obj.
|
|
1338
|
+
if (supportsSwingFunction) this.emit('info', `Air direction: ${AirConditioner.AirDirection[obj.currentSwingMode]}`);
|
|
1347
1339
|
this.emit('info', `Temperature display unit: ${obj.temperatureUnit}`);
|
|
1348
1340
|
this.emit('info', `Lock physical controls: ${obj.lockPhysicalControl ? 'LOCKED' : 'UNLOCKED'}`);
|
|
1349
1341
|
};
|
package/src/melcloudata.js
CHANGED
|
@@ -62,6 +62,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
62
62
|
const serialNumber = deviceData.SerialNumber || deviceData.DeviceID || '4.0.0';
|
|
63
63
|
|
|
64
64
|
//device
|
|
65
|
+
const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
|
|
65
66
|
const device = deviceData.Device ?? {};
|
|
66
67
|
const prohibitSetTemperature = device.ProhibitSetTemperature;
|
|
67
68
|
const prohibitOperationMode = device.ProhibitOperationMode;
|
|
@@ -71,8 +72,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
71
72
|
const outdoorTemperature = device.OutdoorTemperature;
|
|
72
73
|
const setTemperature = device.SetTemperature;
|
|
73
74
|
const actualFanSpeed = device.ActualFanSpeed;
|
|
74
|
-
const
|
|
75
|
-
const setFanSpeed = device.SetFanSpeed; // melcloud home only
|
|
75
|
+
const setFanSpeed = device[fanKey];
|
|
76
76
|
const automaticFanSpeed = device.AutomaticFanSpeed;
|
|
77
77
|
const vaneVerticalDirection = device.VaneVerticalDirection;
|
|
78
78
|
const vaneVerticalSwing = device.VaneVerticalSwing;
|
|
@@ -147,7 +147,6 @@ class MelCloudAta extends EventEmitter {
|
|
|
147
147
|
OutdoorTemperature: outdoorTemperature,
|
|
148
148
|
SetTemperature: setTemperature,
|
|
149
149
|
ActualFanSpeed: actualFanSpeed,
|
|
150
|
-
FanSpeed: fanSpeed,
|
|
151
150
|
SetFanSpeed: setFanSpeed,
|
|
152
151
|
AutomaticFanSpeed: automaticFanSpeed,
|
|
153
152
|
OperationMode: operationMode,
|
|
@@ -304,9 +303,10 @@ class MelCloudAta extends EventEmitter {
|
|
|
304
303
|
return;
|
|
305
304
|
};
|
|
306
305
|
|
|
306
|
+
deviceData.Device.Power = deviceData.Device.Power.toString();
|
|
307
307
|
deviceData.Device.SetTemperature = deviceData.Device.SetTemperature.toString();
|
|
308
|
-
deviceData.Device.OperationMode = AirConditioner.OperationModeMapEnumToString[deviceData.Device.OperationMode];
|
|
309
308
|
deviceData.Device.SetFanSpeed = deviceData.Device.SetFanSpeed.toString();
|
|
309
|
+
deviceData.Device.OperationMode = AirConditioner.OperationModeMapEnumToString[deviceData.Device.OperationMode];
|
|
310
310
|
deviceData.Device.VaneHorizontalDirection = AirConditioner.VaneHorizontalDirectionMapEnumToString[deviceData.Device.VaneHorizontalDirection];
|
|
311
311
|
deviceData.Device.VaneVerticalDirection = AirConditioner.VaneVerticalDirectionMapEnumToString[deviceData.Device.VaneVerticalDirection];
|
|
312
312
|
this.emit('warn', JSON.stringify(deviceData.Device, null, 2));
|