homebridge-melcloud-control 4.0.0-beta.144 → 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 +29 -16
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':
|
|
@@ -288,8 +290,11 @@ class DeviceAta extends EventEmitter {
|
|
|
288
290
|
return state;
|
|
289
291
|
})
|
|
290
292
|
.onSet(async (state) => {
|
|
293
|
+
state = state ? true : false;
|
|
294
|
+
if (state === deviceData.Device.Power) return;
|
|
295
|
+
|
|
291
296
|
try {
|
|
292
|
-
deviceData.Device.Power =
|
|
297
|
+
deviceData.Device.Power = state
|
|
293
298
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Power;
|
|
294
299
|
await this.melCloudAta.send(this.accountType, deviceData, this.displayMode);
|
|
295
300
|
if (this.logInfo) this.emit('info', `Set power: ${state ? 'ON' : 'OFF'}`);
|
|
@@ -324,9 +329,11 @@ class DeviceAta extends EventEmitter {
|
|
|
324
329
|
case 2: //COOL - COOL
|
|
325
330
|
deviceData.Device.OperationMode = coolDryFanMode;
|
|
326
331
|
break;
|
|
332
|
+
default:
|
|
333
|
+
return;
|
|
327
334
|
};
|
|
328
335
|
|
|
329
|
-
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.
|
|
336
|
+
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.OperationMode;
|
|
330
337
|
await this.melCloudAta.send(this.accountType, deviceData, this.displayMode);
|
|
331
338
|
const operationModeText = AirConditioner.OperationMode[deviceData.Device.OperationMode];
|
|
332
339
|
if (this.logInfo) this.emit('info', `Set operation mode: ${operationModeText}`);
|
|
@@ -383,14 +390,16 @@ class DeviceAta extends EventEmitter {
|
|
|
383
390
|
if (supportsSwingFunction) {
|
|
384
391
|
this.melCloudService.getCharacteristic(Characteristic.SwingMode)
|
|
385
392
|
.onGet(async () => {
|
|
386
|
-
//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
|
|
387
394
|
const value = this.accessory.swingMode;
|
|
388
395
|
return value;
|
|
389
396
|
})
|
|
390
397
|
.onSet(async (value) => {
|
|
391
398
|
try {
|
|
392
|
-
|
|
393
|
-
|
|
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;
|
|
394
403
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.VaneVerticalVaneHorizontal;
|
|
395
404
|
await this.melCloudAta.send(this.accountType, deviceData, this.displayMode);
|
|
396
405
|
if (this.logInfo) this.emit('info', `Set air direction mode: ${AirConditioner.AirDirection[value]}`);
|
|
@@ -636,14 +645,16 @@ class DeviceAta extends EventEmitter {
|
|
|
636
645
|
.onSet(async (state) => {
|
|
637
646
|
try {
|
|
638
647
|
const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
|
|
648
|
+
const vaneVerticalKey = this.accountType === 'melcloud' ? 'VaneVertical' : 'VaneVerticalDirection';
|
|
649
|
+
const vaneHorizontalKey = this.accountType === 'melcloud' ? 'VaneHorizontal' : 'VaneHorizontalDirection';
|
|
639
650
|
switch (state) {
|
|
640
651
|
case true:
|
|
641
652
|
preset.previousSettings = deviceData.Device;
|
|
642
653
|
deviceData.Device.Power = presetData.Power;
|
|
643
654
|
deviceData.Device.OperationMode = presetData.OperationMode;
|
|
644
655
|
deviceData.Device.SetTemperature = presetData.SetTemperature;
|
|
645
|
-
deviceData.Device
|
|
646
|
-
deviceData.Device
|
|
656
|
+
deviceData.Device[vaneHorizontalKey] = presetData[vaneHorizontalKey];
|
|
657
|
+
deviceData.Device[vaneVerticalKey] = presetData[vaneVerticalKey];
|
|
647
658
|
deviceData.Device[fanKey] = presetData[fanKey];
|
|
648
659
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Presets;
|
|
649
660
|
break;
|
|
@@ -651,8 +662,8 @@ class DeviceAta extends EventEmitter {
|
|
|
651
662
|
deviceData.Device.Power = preset.previousSettings.Power;
|
|
652
663
|
deviceData.Device.OperationMode = preset.previousSettings.OperationMode;
|
|
653
664
|
deviceData.Device.SetTemperature = preset.previousSettings.SetTemperature;
|
|
654
|
-
deviceData.Device
|
|
655
|
-
deviceData.Device
|
|
665
|
+
deviceData.Device[vaneHorizontalKey] = preset.previousSettings[vaneHorizontalKey];
|
|
666
|
+
deviceData.Device[vaneVerticalKey] = preset.previousSettings[vaneVerticalKey];
|
|
656
667
|
deviceData.Device[fanKey] = preset.previousSettings[fanKey];
|
|
657
668
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Presets;
|
|
658
669
|
break;
|
|
@@ -981,6 +992,8 @@ class DeviceAta extends EventEmitter {
|
|
|
981
992
|
//device state
|
|
982
993
|
const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
|
|
983
994
|
const tempStepKey = this.accountType === 'melcloud' ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
|
|
995
|
+
const vaneVerticalKey = this.accountType === 'melcloud' ? 'VaneVertical' : 'VaneVerticalDirection';
|
|
996
|
+
const vaneHorizontalKey = this.accountType === 'melcloud' ? 'VaneHorizontal' : 'VaneHorizontalDirection';
|
|
984
997
|
const power = deviceData.Device.Power ?? false;
|
|
985
998
|
const inStandbyMode = deviceData.Device.InStandbyMode ?? false;
|
|
986
999
|
const roomTemperature = deviceData.Device.RoomTemperature;
|
|
@@ -991,9 +1004,9 @@ class DeviceAta extends EventEmitter {
|
|
|
991
1004
|
const automaticFanSpeed = deviceData.Device.AutomaticFanSpeed;
|
|
992
1005
|
const fanSpeed = deviceData.Device[fanKey];
|
|
993
1006
|
const operationMode = deviceData.Device.OperationMode;
|
|
994
|
-
const vaneVerticalDirection = deviceData.Device
|
|
1007
|
+
const vaneVerticalDirection = deviceData.Device[vaneVerticalKey];
|
|
995
1008
|
const vaneVerticalSwing = deviceData.Device.VaneVerticalSwing;
|
|
996
|
-
const vaneHorizontalDirection = deviceData.Device
|
|
1009
|
+
const vaneHorizontalDirection = deviceData.Device[vaneHorizontalKey];
|
|
997
1010
|
const vaneHorizontalSwing = deviceData.Device.VaneHorizontalSwing;
|
|
998
1011
|
const prohibitSetTemperature = deviceData.Device.ProhibitSetTemperature ?? false;
|
|
999
1012
|
const prohibitOperationMode = deviceData.Device.ProhibitOperationMode ?? false;
|
|
@@ -1188,8 +1201,8 @@ class DeviceAta extends EventEmitter {
|
|
|
1188
1201
|
preset.state = presetData ? (presetData.Power === power
|
|
1189
1202
|
&& presetData.SetTemperature === setTemperature
|
|
1190
1203
|
&& presetData.OperationMode === operationMode
|
|
1191
|
-
&& presetData
|
|
1192
|
-
&& presetData
|
|
1204
|
+
&& presetData[vaneHorizontalKey] === vaneHorizontalDirection
|
|
1205
|
+
&& presetData[vaneVerticalKey] === vaneVerticalDirection
|
|
1193
1206
|
&& presetData[fanKey] === fanSpeed) : false;
|
|
1194
1207
|
|
|
1195
1208
|
const characteristicType = preset.characteristicType;
|