homebridge-melcloud-control 4.0.0-beta.145 → 4.0.0-beta.146
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 +25 -15
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.146",
|
|
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,6 +151,8 @@ 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';
|
|
154
156
|
switch (key) {
|
|
155
157
|
case 'Power':
|
|
156
158
|
deviceData.Device[key] = value;
|
|
@@ -159,7 +161,7 @@ class DeviceAta extends EventEmitter {
|
|
|
159
161
|
break;
|
|
160
162
|
case 'OperationMode':
|
|
161
163
|
deviceData.Device[key] = value;
|
|
162
|
-
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.
|
|
164
|
+
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.OperationMode
|
|
163
165
|
set = await this.melCloudAta.send(this.accountType, deviceData, this.displayMode);
|
|
164
166
|
break;
|
|
165
167
|
case 'SetTemperature':
|
|
@@ -184,12 +186,12 @@ class DeviceAta extends EventEmitter {
|
|
|
184
186
|
break;
|
|
185
187
|
case 'VaneHorizontalDirection':
|
|
186
188
|
deviceData.Device[key] = value;
|
|
187
|
-
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags
|
|
189
|
+
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags[vaneHorizontalKey];
|
|
188
190
|
set = await this.melCloudAta.send(this.accountType, deviceData, this.displayMode);
|
|
189
191
|
break;
|
|
190
192
|
case 'VaneVerticalDirection':
|
|
191
193
|
deviceData.Device[key] = value;
|
|
192
|
-
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags
|
|
194
|
+
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags[vaneVerticalKey];
|
|
193
195
|
set = await this.melCloudAta.send(this.accountType, deviceData, this.displayMode);
|
|
194
196
|
break;
|
|
195
197
|
case 'HideVaneControls':
|
|
@@ -327,9 +329,11 @@ class DeviceAta extends EventEmitter {
|
|
|
327
329
|
case 2: //COOL - COOL
|
|
328
330
|
deviceData.Device.OperationMode = coolDryFanMode;
|
|
329
331
|
break;
|
|
332
|
+
default:
|
|
333
|
+
return;
|
|
330
334
|
};
|
|
331
335
|
|
|
332
|
-
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.
|
|
336
|
+
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.OperationMode;
|
|
333
337
|
await this.melCloudAta.send(this.accountType, deviceData, this.displayMode);
|
|
334
338
|
const operationModeText = AirConditioner.OperationMode[deviceData.Device.OperationMode];
|
|
335
339
|
if (this.logInfo) this.emit('info', `Set operation mode: ${operationModeText}`);
|
|
@@ -386,14 +390,16 @@ class DeviceAta extends EventEmitter {
|
|
|
386
390
|
if (supportsSwingFunction) {
|
|
387
391
|
this.melCloudService.getCharacteristic(Characteristic.SwingMode)
|
|
388
392
|
.onGet(async () => {
|
|
389
|
-
//Vane Horizontal: Auto, 1, 2, 3, 4, 5, 6, 12 = Swing //Vertical: Auto, 1, 2, 3, 4, 5, 7 = Swing
|
|
393
|
+
//Vane Horizontal: Auto, 1, 2, 3, 4, 5, 6, 7 = Sp;it, 12 = Swing //Vertical: Auto, 1, 2, 3, 4, 5, 7 = Swing
|
|
390
394
|
const value = this.accessory.swingMode;
|
|
391
395
|
return value;
|
|
392
396
|
})
|
|
393
397
|
.onSet(async (value) => {
|
|
394
398
|
try {
|
|
395
|
-
|
|
396
|
-
|
|
399
|
+
const vaneHorizontalKey = this.accountType === 'melcloud' ? 'VaneHorizontal' : 'VaneHorizontalDirection';
|
|
400
|
+
const vaneVerticalKey = this.accountType === 'melcloud' ? 'VaneVertical' : 'VaneVerticalDirection';
|
|
401
|
+
deviceData.Device[vaneHorizontalKey] = value ? 12 : 0;
|
|
402
|
+
deviceData.Device[vaneVerticalKey] = value ? 7 : 0;
|
|
397
403
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.VaneVerticalVaneHorizontal;
|
|
398
404
|
await this.melCloudAta.send(this.accountType, deviceData, this.displayMode);
|
|
399
405
|
if (this.logInfo) this.emit('info', `Set air direction mode: ${AirConditioner.AirDirection[value]}`);
|
|
@@ -639,14 +645,16 @@ class DeviceAta extends EventEmitter {
|
|
|
639
645
|
.onSet(async (state) => {
|
|
640
646
|
try {
|
|
641
647
|
const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
|
|
648
|
+
const vaneVerticalKey = this.accountType === 'melcloud' ? 'VaneVertical' : 'VaneVerticalDirection';
|
|
649
|
+
const vaneHorizontalKey = this.accountType === 'melcloud' ? 'VaneHorizontal' : 'VaneHorizontalDirection';
|
|
642
650
|
switch (state) {
|
|
643
651
|
case true:
|
|
644
652
|
preset.previousSettings = deviceData.Device;
|
|
645
653
|
deviceData.Device.Power = presetData.Power;
|
|
646
654
|
deviceData.Device.OperationMode = presetData.OperationMode;
|
|
647
655
|
deviceData.Device.SetTemperature = presetData.SetTemperature;
|
|
648
|
-
deviceData.Device
|
|
649
|
-
deviceData.Device
|
|
656
|
+
deviceData.Device[vaneHorizontalKey] = presetData[vaneHorizontalKey];
|
|
657
|
+
deviceData.Device[vaneVerticalKey] = presetData[vaneVerticalKey];
|
|
650
658
|
deviceData.Device[fanKey] = presetData[fanKey];
|
|
651
659
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Presets;
|
|
652
660
|
break;
|
|
@@ -654,8 +662,8 @@ class DeviceAta extends EventEmitter {
|
|
|
654
662
|
deviceData.Device.Power = preset.previousSettings.Power;
|
|
655
663
|
deviceData.Device.OperationMode = preset.previousSettings.OperationMode;
|
|
656
664
|
deviceData.Device.SetTemperature = preset.previousSettings.SetTemperature;
|
|
657
|
-
deviceData.Device
|
|
658
|
-
deviceData.Device
|
|
665
|
+
deviceData.Device[vaneHorizontalKey] = preset.previousSettings[vaneHorizontalKey];
|
|
666
|
+
deviceData.Device[vaneVerticalKey] = preset.previousSettings[vaneVerticalKey];
|
|
659
667
|
deviceData.Device[fanKey] = preset.previousSettings[fanKey];
|
|
660
668
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Presets;
|
|
661
669
|
break;
|
|
@@ -984,6 +992,8 @@ class DeviceAta extends EventEmitter {
|
|
|
984
992
|
//device state
|
|
985
993
|
const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
|
|
986
994
|
const tempStepKey = this.accountType === 'melcloud' ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
|
|
995
|
+
const vaneVerticalKey = this.accountType === 'melcloud' ? 'VaneVertical' : 'VaneVerticalDirection';
|
|
996
|
+
const vaneHorizontalKey = this.accountType === 'melcloud' ? 'VaneHorizontal' : 'VaneHorizontalDirection';
|
|
987
997
|
const power = deviceData.Device.Power ?? false;
|
|
988
998
|
const inStandbyMode = deviceData.Device.InStandbyMode ?? false;
|
|
989
999
|
const roomTemperature = deviceData.Device.RoomTemperature;
|
|
@@ -994,9 +1004,9 @@ class DeviceAta extends EventEmitter {
|
|
|
994
1004
|
const automaticFanSpeed = deviceData.Device.AutomaticFanSpeed;
|
|
995
1005
|
const fanSpeed = deviceData.Device[fanKey];
|
|
996
1006
|
const operationMode = deviceData.Device.OperationMode;
|
|
997
|
-
const vaneVerticalDirection = deviceData.Device
|
|
1007
|
+
const vaneVerticalDirection = deviceData.Device[vaneVerticalKey];
|
|
998
1008
|
const vaneVerticalSwing = deviceData.Device.VaneVerticalSwing;
|
|
999
|
-
const vaneHorizontalDirection = deviceData.Device
|
|
1009
|
+
const vaneHorizontalDirection = deviceData.Device[vaneHorizontalKey];
|
|
1000
1010
|
const vaneHorizontalSwing = deviceData.Device.VaneHorizontalSwing;
|
|
1001
1011
|
const prohibitSetTemperature = deviceData.Device.ProhibitSetTemperature ?? false;
|
|
1002
1012
|
const prohibitOperationMode = deviceData.Device.ProhibitOperationMode ?? false;
|
|
@@ -1191,8 +1201,8 @@ class DeviceAta extends EventEmitter {
|
|
|
1191
1201
|
preset.state = presetData ? (presetData.Power === power
|
|
1192
1202
|
&& presetData.SetTemperature === setTemperature
|
|
1193
1203
|
&& presetData.OperationMode === operationMode
|
|
1194
|
-
&& presetData
|
|
1195
|
-
&& presetData
|
|
1204
|
+
&& presetData[vaneHorizontalKey] === vaneHorizontalDirection
|
|
1205
|
+
&& presetData[vaneVerticalKey] === vaneVerticalDirection
|
|
1196
1206
|
&& presetData[fanKey] === fanSpeed) : false;
|
|
1197
1207
|
|
|
1198
1208
|
const characteristicType = preset.characteristicType;
|