homebridge-melcloud-control 4.0.0-beta.520 → 4.0.0-beta.521
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 +66 -74
- package/src/melcloudata.js +2 -1
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.521",
|
|
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
|
@@ -154,71 +154,72 @@ class DeviceAta extends EventEmitter {
|
|
|
154
154
|
async setOverExternalIntegration(integration, deviceData, key, value) {
|
|
155
155
|
try {
|
|
156
156
|
let set = false
|
|
157
|
+
let effectiveFlags = null;
|
|
157
158
|
switch (key) {
|
|
158
159
|
case 'Power':
|
|
159
160
|
deviceData.Device[key] = value;
|
|
160
|
-
|
|
161
|
+
effectiveFlags = AirConditioner.EffectiveFlags.Power;
|
|
161
162
|
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
162
163
|
break;
|
|
163
164
|
case 'OperationMode':
|
|
164
165
|
deviceData.Device[key] = value;
|
|
165
|
-
|
|
166
|
+
effectiveFlags = AirConditioner.EffectiveFlags.OperationMode
|
|
166
167
|
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
167
168
|
break;
|
|
168
169
|
case 'SetTemperature':
|
|
169
170
|
deviceData.Device[key] = value;
|
|
170
|
-
|
|
171
|
+
effectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
171
172
|
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
172
173
|
break;
|
|
173
174
|
case 'DefaultCoolingSetTemperature':
|
|
174
175
|
deviceData.Device[key] = value;
|
|
175
|
-
|
|
176
|
+
effectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
176
177
|
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
177
178
|
break;
|
|
178
179
|
case 'DefaultHeatingSetTemperature':
|
|
179
180
|
deviceData.Device[key] = value;
|
|
180
|
-
|
|
181
|
+
effectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
181
182
|
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
182
183
|
break;
|
|
183
184
|
case 'FanSpeed':
|
|
184
185
|
deviceData.Device[key] = value;
|
|
185
|
-
|
|
186
|
+
effectiveFlags = AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
186
187
|
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
187
188
|
break;
|
|
188
189
|
case 'VaneHorizontalDirection':
|
|
189
190
|
deviceData.Device[key] = value;
|
|
190
|
-
|
|
191
|
+
effectiveFlags = AirConditioner.EffectiveFlags.VaneHorizontalDirection;
|
|
191
192
|
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
192
193
|
break;
|
|
193
194
|
case 'VaneVerticalDirection':
|
|
194
195
|
deviceData.Device[key] = value;
|
|
195
|
-
|
|
196
|
+
effectiveFlags = AirConditioner.EffectiveFlags.VaneVerticalDirection;
|
|
196
197
|
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
197
198
|
break;
|
|
198
199
|
case 'HideVaneControls':
|
|
199
200
|
deviceData[key] = value;
|
|
200
|
-
|
|
201
|
+
effectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
201
202
|
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
202
203
|
break;
|
|
203
204
|
case 'HideDryModeControl':
|
|
204
205
|
deviceData[key] = value;
|
|
205
|
-
|
|
206
|
+
effectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
206
207
|
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
207
208
|
break;
|
|
208
209
|
case 'ProhibitSetTemperature':
|
|
209
210
|
deviceData.Device[key] = value;
|
|
210
|
-
|
|
211
|
+
effectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
211
212
|
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
212
213
|
break;
|
|
213
214
|
case 'ProhibitOperationMode':
|
|
214
215
|
deviceData.Device[key] = value;
|
|
215
|
-
|
|
216
|
+
effectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
216
217
|
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
217
218
|
break;
|
|
218
219
|
case 'ProhibitPower':
|
|
219
220
|
deviceData.Device[key] = value;
|
|
220
|
-
|
|
221
|
-
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
221
|
+
effectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
222
|
+
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData, effectiveFlags);
|
|
222
223
|
break;
|
|
223
224
|
default:
|
|
224
225
|
this.emit('warn', `${integration}, received key: ${key}, value: ${value}`);
|
|
@@ -291,13 +292,11 @@ class DeviceAta extends EventEmitter {
|
|
|
291
292
|
return state;
|
|
292
293
|
})
|
|
293
294
|
.onSet(async (state) => {
|
|
294
|
-
|
|
295
|
-
if (state === deviceData.Device.Power) return;
|
|
295
|
+
if (!!state === deviceData.Device.Power) return;
|
|
296
296
|
|
|
297
297
|
try {
|
|
298
298
|
deviceData.Device.Power = state
|
|
299
|
-
|
|
300
|
-
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
299
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.Power);
|
|
301
300
|
if (this.logInfo) this.emit('info', `Set power: ${state ? 'ON' : 'OFF'}`);
|
|
302
301
|
} catch (error) {
|
|
303
302
|
if (this.logWarn) this.emit('warn', `Set power error: ${error}`);
|
|
@@ -335,8 +334,7 @@ class DeviceAta extends EventEmitter {
|
|
|
335
334
|
break;
|
|
336
335
|
};
|
|
337
336
|
|
|
338
|
-
|
|
339
|
-
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
337
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.OperationMode);
|
|
340
338
|
if (this.logInfo) this.emit('info', `Set operation mode: ${AirConditioner.OperationModeMapEnumToString[value]}`);
|
|
341
339
|
} catch (error) {
|
|
342
340
|
if (this.logWarn) this.emit('warn', `Set operation mode error: ${error}`);
|
|
@@ -377,8 +375,7 @@ class DeviceAta extends EventEmitter {
|
|
|
377
375
|
};
|
|
378
376
|
|
|
379
377
|
deviceData.Device[fanKey] = value
|
|
380
|
-
|
|
381
|
-
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
378
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.SetFanSpeed);
|
|
382
379
|
if (this.logInfo) this.emit('info', `Set fan speed mode: ${AirConditioner.FanSpeedMapEnumToString[value]}`);
|
|
383
380
|
} catch (error) {
|
|
384
381
|
if (this.logWarn) this.emit('warn', `Set fan speed mode error: ${error}`);
|
|
@@ -396,8 +393,7 @@ class DeviceAta extends EventEmitter {
|
|
|
396
393
|
try {
|
|
397
394
|
deviceData.Device.VaneHorizontalDirection = value ? 12 : 0;
|
|
398
395
|
deviceData.Device.VaneVerticalDirection = value ? 7 : 0;
|
|
399
|
-
|
|
400
|
-
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
396
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.VaneVerticalVaneHorizontal);
|
|
401
397
|
if (this.logInfo) this.emit('info', `Set air direction mode: ${AirConditioner.AirDirectionMapEnumToString[value]}`);
|
|
402
398
|
} catch (error) {
|
|
403
399
|
if (this.logWarn) this.emit('warn', `Set vane swing mode error: ${error}`);
|
|
@@ -418,8 +414,7 @@ class DeviceAta extends EventEmitter {
|
|
|
418
414
|
try {
|
|
419
415
|
const tempKey = this.accessory.operationMode === 8 ? 'DefaultCoolingSetTemperature' : 'SetTemperature';
|
|
420
416
|
deviceData.Device[tempKey] = value;
|
|
421
|
-
|
|
422
|
-
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
417
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.SetTemperature);
|
|
423
418
|
if (this.logInfo) this.emit('info', `Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
424
419
|
} catch (error) {
|
|
425
420
|
if (this.logWarn) this.emit('warn', `Set cooling threshold temperature error: ${error}`);
|
|
@@ -440,8 +435,7 @@ class DeviceAta extends EventEmitter {
|
|
|
440
435
|
try {
|
|
441
436
|
const tempKey = this.accessory.operationMode === 8 ? 'DefaultHeatingSetTemperature' : 'SetTemperature';
|
|
442
437
|
deviceData.Device[tempKey] = value;
|
|
443
|
-
|
|
444
|
-
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
438
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.SetTemperature);
|
|
445
439
|
if (this.logInfo) this.emit('info', `Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
446
440
|
} catch (error) {
|
|
447
441
|
if (this.logWarn) this.emit('warn', `Set heating threshold temperature error: ${error}`);
|
|
@@ -461,8 +455,7 @@ class DeviceAta extends EventEmitter {
|
|
|
461
455
|
deviceData.Device.ProhibitSetTemperature = value;
|
|
462
456
|
deviceData.Device.ProhibitOperationMode = value;
|
|
463
457
|
deviceData.Device.ProhibitPower = value;
|
|
464
|
-
|
|
465
|
-
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
458
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.Prohibit);
|
|
466
459
|
if (this.logInfo) this.emit('info', `Set local physical controls: ${value ? 'LOCK' : 'UNLOCK'}`);
|
|
467
460
|
} catch (error) {
|
|
468
461
|
if (this.logWarn) this.emit('warn', `Set lock physical controls error: ${error}`);
|
|
@@ -508,31 +501,32 @@ class DeviceAta extends EventEmitter {
|
|
|
508
501
|
})
|
|
509
502
|
.onSet(async (value) => {
|
|
510
503
|
try {
|
|
504
|
+
let effectiveFlags = null;
|
|
511
505
|
switch (value) {
|
|
512
506
|
case 0: //OFF - POWER OFF
|
|
513
507
|
value = deviceData.Device.OperationMode;
|
|
514
508
|
deviceData.Device.Power = false;
|
|
515
|
-
|
|
509
|
+
effectiveFlags = AirConditioner.EffectiveFlags.Power;
|
|
516
510
|
break;
|
|
517
511
|
case 1: //HEAT - HEAT
|
|
518
512
|
deviceData.Device.Power = true;
|
|
519
513
|
value = heatDryFanMode;
|
|
520
|
-
|
|
514
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerOperationModeSetTemperature;
|
|
521
515
|
break;
|
|
522
516
|
case 2: //COOL - COOL
|
|
523
517
|
value = coolDryFanMode;
|
|
524
518
|
deviceData.Device.Power = true;
|
|
525
|
-
|
|
519
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerOperationModeSetTemperature
|
|
526
520
|
break;
|
|
527
521
|
case 3: //AUTO - AUTO
|
|
528
522
|
value = autoDryFanMode;
|
|
529
523
|
deviceData.Device.Power = true;
|
|
530
|
-
|
|
524
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerOperationModeSetTemperature;
|
|
531
525
|
break;
|
|
532
526
|
};
|
|
533
527
|
|
|
534
528
|
deviceData.Device.OperationMode = value;
|
|
535
|
-
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
529
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, effectiveFlags);
|
|
536
530
|
const operationModeText = AirConditioner.OperationModeMapEnumToString[value];
|
|
537
531
|
if (this.logInfo) this.emit('info', `Set operation mode: ${operationModeText}`);
|
|
538
532
|
} catch (error) {
|
|
@@ -557,8 +551,7 @@ class DeviceAta extends EventEmitter {
|
|
|
557
551
|
.onSet(async (value) => {
|
|
558
552
|
try {
|
|
559
553
|
deviceData.Device.SetTemperature = value;
|
|
560
|
-
|
|
561
|
-
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
554
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.SetTemperature);
|
|
562
555
|
if (this.logInfo) this.emit('info', `Set temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
563
556
|
} catch (error) {
|
|
564
557
|
if (this.logWarn) this.emit('warn', `Set temperature error: ${error}`);
|
|
@@ -658,7 +651,6 @@ class DeviceAta extends EventEmitter {
|
|
|
658
651
|
deviceData.Device.VaneHorizontalDirection = presetData.VaneHorizontalDirection;
|
|
659
652
|
deviceData.Device.VaneVerticalDirection = presetData.VaneVerticalDirection;
|
|
660
653
|
deviceData.Device[fanKey] = presetData[fanKey];
|
|
661
|
-
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Presets;
|
|
662
654
|
break;
|
|
663
655
|
case false:
|
|
664
656
|
deviceData.Device.Power = preset.previousSettings.Power;
|
|
@@ -667,11 +659,10 @@ class DeviceAta extends EventEmitter {
|
|
|
667
659
|
deviceData.Device.VaneHorizontalDirection = preset.previousSettings.VaneHorizontalDirection;
|
|
668
660
|
deviceData.Device.VaneVerticalDirection = preset.previousSettings.VaneVerticalDirection;
|
|
669
661
|
deviceData.Device[fanKey] = preset.previousSettings[fanKey];
|
|
670
|
-
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Presets;
|
|
671
662
|
break;
|
|
672
663
|
};
|
|
673
664
|
|
|
674
|
-
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
665
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.Presets);
|
|
675
666
|
if (this.logInfo) this.emit('info', `${state ? 'Set:' : 'Unset:'} ${name}`);
|
|
676
667
|
} catch (error) {
|
|
677
668
|
if (this.logWarn) this.emit('warn', `Set preset error: ${error}`);
|
|
@@ -710,46 +701,47 @@ class DeviceAta extends EventEmitter {
|
|
|
710
701
|
.onSet(async (state) => {
|
|
711
702
|
try {
|
|
712
703
|
const key = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
|
|
704
|
+
let effectiveFlags = null;
|
|
713
705
|
switch (mode) {
|
|
714
706
|
case 0: //POWER ON,OFF
|
|
715
707
|
deviceData.Device.Power = state;
|
|
716
|
-
|
|
708
|
+
effectiveFlags = AirConditioner.EffectiveFlags.Power;
|
|
717
709
|
break;
|
|
718
710
|
case 1: //OPERATING MODE HEAT
|
|
719
711
|
button.previousValue = state ? deviceData.Device.OperationMode : button.previousValue ?? deviceData.Device.OperationMode;
|
|
720
712
|
deviceData.Device.Power = true;
|
|
721
713
|
deviceData.Device.OperationMode = state ? 1 : button.previousValue === 9 ? 1 : button.previousValue;
|
|
722
|
-
|
|
714
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerOperationModeSetTemperature;
|
|
723
715
|
break;
|
|
724
716
|
case 2: //OPERATING MODE DRY
|
|
725
717
|
button.previousValue = state ? deviceData.Device.OperationMode : button.previousValue ?? deviceData.Device.OperationMode;
|
|
726
718
|
deviceData.Device.Power = true;
|
|
727
719
|
deviceData.Device.OperationMode = state ? 2 : button.previousValue === 10 ? 2 : button.previousValue;
|
|
728
|
-
|
|
720
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerOperationModeSetTemperature;
|
|
729
721
|
break
|
|
730
722
|
case 3: //OPERATING MODE COOL
|
|
731
723
|
button.previousValue = state ? deviceData.Device.OperationMode : button.previousValue ?? deviceData.Device.OperationMode;
|
|
732
724
|
deviceData.Device.Power = true;
|
|
733
725
|
deviceData.Device.OperationMode = state ? 3 : button.previousValue === 11 ? 3 : button.previousValue;
|
|
734
|
-
|
|
726
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerOperationModeSetTemperature;
|
|
735
727
|
break;
|
|
736
728
|
case 4: //OPERATING MODE FAN
|
|
737
729
|
button.previousValue = state ? deviceData.Device.OperationMode : button.previousValue ?? deviceData.Device.OperationMode;
|
|
738
730
|
deviceData.Device.Power = true;
|
|
739
731
|
deviceData.Device.OperationMode = state ? 7 : button.previousValue;
|
|
740
|
-
|
|
732
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerOperationModeSetTemperature;
|
|
741
733
|
break;
|
|
742
734
|
case 5: //OPERATING MODE AUTO
|
|
743
735
|
button.previousValue = state ? deviceData.Device.OperationMode : button.previousValue ?? deviceData.Device.OperationMode;
|
|
744
736
|
deviceData.Device.Power = true;
|
|
745
737
|
deviceData.Device.OperationMode = state ? 8 : button.previousValue;
|
|
746
|
-
|
|
738
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerOperationModeSetTemperature;
|
|
747
739
|
break;
|
|
748
740
|
case 6: //OPERATING MODE PURIFY
|
|
749
741
|
button.previousValue = state ? deviceData.Device.OperationMode : button.previousValue ?? deviceData.Device.OperationMode;
|
|
750
742
|
deviceData.Device.Power = true;
|
|
751
743
|
deviceData.Device.OperationMode = state ? 12 : button.previousValue;
|
|
752
|
-
|
|
744
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerOperationModeSetTemperature;
|
|
753
745
|
break;
|
|
754
746
|
case 7: //OPERATING MODE DRY CONTROL HIDE
|
|
755
747
|
deviceData.HideDryModeControl = state;
|
|
@@ -758,91 +750,91 @@ class DeviceAta extends EventEmitter {
|
|
|
758
750
|
button.previousValue = state ? deviceData.Device.VaneHorizontalDirection : button.previousValue ?? deviceData.Device.VaneHorizontalDirection;
|
|
759
751
|
deviceData.Device.Power = true;
|
|
760
752
|
deviceData.Device.VaneHorizontalDirection = state ? 0 : button.previousValue;
|
|
761
|
-
|
|
753
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneHorizontal;
|
|
762
754
|
break;
|
|
763
755
|
case 11: //VANE H SWING MODE 1
|
|
764
756
|
button.previousValue = state ? deviceData.Device.VaneHorizontalDirection : button.previousValue ?? deviceData.Device.VaneHorizontalDirection;
|
|
765
757
|
deviceData.Device.Power = true;
|
|
766
758
|
deviceData.Device.VaneHorizontalDirection = state ? 1 : button.previousValue;
|
|
767
|
-
|
|
759
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneHorizontal;
|
|
768
760
|
break;
|
|
769
761
|
case 12: //VANE H SWING MODE 2
|
|
770
762
|
button.previousValue = state ? deviceData.Device.VaneHorizontalDirection : button.previousValue ?? deviceData.Device.VaneHorizontalDirection;
|
|
771
763
|
deviceData.Device.Power = true;
|
|
772
764
|
deviceData.Device.VaneHorizontalDirection = state ? 2 : button.previousValue;
|
|
773
|
-
|
|
765
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneHorizontal;
|
|
774
766
|
break;
|
|
775
767
|
case 13: //VANE H SWING MODE 3
|
|
776
768
|
button.previousValue = state ? deviceData.Device.VaneHorizontalDirection : button.previousValue ?? deviceData.Device.VaneHorizontalDirection;
|
|
777
769
|
deviceData.Device.Power = true;
|
|
778
770
|
deviceData.Device.VaneHorizontalDirection = state ? 3 : button.previousValue;
|
|
779
|
-
|
|
771
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneHorizontal;
|
|
780
772
|
break;
|
|
781
773
|
case 14: //VANE H SWING MODE 4
|
|
782
774
|
button.previousValue = state ? deviceData.Device.VaneHorizontalDirection : button.previousValue ?? deviceData.Device.VaneHorizontalDirection;
|
|
783
775
|
deviceData.Device.Power = true;
|
|
784
776
|
deviceData.Device.VaneHorizontalDirection = state ? 4 : button.previousValue;
|
|
785
|
-
|
|
777
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneHorizontal;
|
|
786
778
|
break;
|
|
787
779
|
case 15: //VANE H SWING MODE 5
|
|
788
780
|
button.previousValue = state ? deviceData.Device.VaneHorizontalDirection : button.previousValue ?? deviceData.Device.VaneHorizontalDirection;
|
|
789
781
|
deviceData.Device.Power = true;
|
|
790
782
|
deviceData.Device.VaneHorizontalDirection = state ? 5 : button.previousValue;
|
|
791
|
-
|
|
783
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneHorizontal;
|
|
792
784
|
break;
|
|
793
785
|
case 16: //VANE H SWING MODE SPLIT
|
|
794
786
|
button.previousValue = state ? deviceData.Device.VaneHorizontalDirection : button.previousValue ?? deviceData.Device.VaneHorizontalDirection;
|
|
795
787
|
deviceData.Device.Power = true;
|
|
796
788
|
deviceData.Device.VaneHorizontalDirection = state ? 8 : button.previousValue;
|
|
797
|
-
|
|
789
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneHorizontal;
|
|
798
790
|
break;
|
|
799
791
|
case 17: //VANE H SWING MODE SWING
|
|
800
792
|
button.previousValue = state ? deviceData.Device.VaneHorizontalDirection : button.previousValue ?? deviceData.Device.VaneHorizontalDirection;
|
|
801
793
|
deviceData.Device.Power = true;
|
|
802
794
|
deviceData.Device.VaneHorizontalDirection = state ? 12 : button.previousValue;
|
|
803
|
-
|
|
795
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneHorizontal;
|
|
804
796
|
break;
|
|
805
797
|
case 20: //VANE V SWING MODE AUTO
|
|
806
798
|
button.previousValue = state ? deviceData.Device.VaneVerticalDirection : button.previousValue ?? deviceData.Device.VaneVerticalDirection;
|
|
807
799
|
deviceData.Device.Power = true;
|
|
808
800
|
deviceData.Device.VaneVerticalDirection = state ? 0 : button.previousValue;
|
|
809
|
-
|
|
801
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneVertical;
|
|
810
802
|
break;
|
|
811
803
|
case 21: //VANE V SWING MODE 1
|
|
812
804
|
button.previousValue = state ? deviceData.Device.VaneVerticalDirection : button.previousValue ?? deviceData.Device.VaneVerticalDirection;
|
|
813
805
|
deviceData.Device.Power = true;
|
|
814
806
|
deviceData.Device.VaneVerticalDirection = state ? 1 : button.previousValue;
|
|
815
|
-
|
|
807
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneVertical;
|
|
816
808
|
break;
|
|
817
809
|
case 22: //VANE V SWING MODE 2
|
|
818
810
|
button.previousValue = state ? deviceData.Device.VaneVerticalDirection : button.previousValue ?? deviceData.Device.VaneVerticalDirection;
|
|
819
811
|
deviceData.Device.Power = true;
|
|
820
812
|
deviceData.Device.VaneVerticalDirection = state ? 2 : button.previousValue;
|
|
821
|
-
|
|
813
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneVertical;
|
|
822
814
|
break;
|
|
823
815
|
case 23: //VANE V SWING MODE 3
|
|
824
816
|
button.previousValue = state ? deviceData.Device.VaneVerticalDirection : button.previousValue ?? deviceData.Device.VaneVerticalDirection;
|
|
825
817
|
deviceData.Device.Power = true;
|
|
826
818
|
deviceData.Device.VaneVerticalDirection = state ? 3 : button.previousValue;
|
|
827
|
-
|
|
819
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneVertical;
|
|
828
820
|
break;
|
|
829
821
|
case 24: //VANE V SWING MODE 4
|
|
830
822
|
button.previousValue = state ? deviceData.Device.VaneVerticalDirection : button.previousValue ?? deviceData.Device.VaneVerticalDirection;
|
|
831
823
|
deviceData.Device.Power = true;
|
|
832
824
|
deviceData.Device.VaneVerticalDirection = state ? 4 : button.previousValue;
|
|
833
|
-
|
|
825
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneVertical;
|
|
834
826
|
break;
|
|
835
827
|
case 25: //VANE V SWING MODE 5
|
|
836
828
|
button.previousValue = state ? deviceData.Device.VaneVerticalDirection : button.previousValue ?? deviceData.Device.VaneVerticalDirection;
|
|
837
829
|
deviceData.Device.Power = true;
|
|
838
830
|
deviceData.Device.VaneVerticalDirection = state ? 5 : button.previousValue;
|
|
839
|
-
|
|
831
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneVertical;
|
|
840
832
|
break;
|
|
841
833
|
case 26: //VANE V SWING MODE SWING
|
|
842
834
|
button.previousValue = state ? deviceData.Device.VaneVerticalDirection : button.previousValue ?? deviceData.Device.VaneVerticalDirection;
|
|
843
835
|
deviceData.Device.Power = true;
|
|
844
836
|
deviceData.Device.VaneVerticalDirection = state ? 7 : button.previousValue;
|
|
845
|
-
|
|
837
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneVertical;
|
|
846
838
|
break;
|
|
847
839
|
case 27: //VANE H/V CONTROLS HIDE
|
|
848
840
|
deviceData.HideVaneControls = state;
|
|
@@ -851,68 +843,68 @@ class DeviceAta extends EventEmitter {
|
|
|
851
843
|
button.previousValue = state ? deviceData.Device[fanKey] : button.previousValue ?? deviceData.Device[fanKey];
|
|
852
844
|
deviceData.Device.Power = true;
|
|
853
845
|
deviceData.Device[fanKey] = state ? 0 : button.previousValue;
|
|
854
|
-
|
|
846
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerSetFanSpeed;
|
|
855
847
|
break;
|
|
856
848
|
case 31: //FAN SPEED MODE 1
|
|
857
849
|
button.previousValue = state ? deviceData.Device[fanKey] : button.previousValue ?? deviceData.Device[fanKey];
|
|
858
850
|
deviceData.Device.Power = true;
|
|
859
851
|
deviceData.Device[fanKey] = state ? 1 : button.previousValue;
|
|
860
|
-
|
|
852
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerSetFanSpeed;
|
|
861
853
|
break;
|
|
862
854
|
case 32: //FAN SPEED MODE 2
|
|
863
855
|
button.previousValue = state ? deviceData.Device[fanKey] : button.previousValue ?? deviceData.Device[fanKey];
|
|
864
856
|
deviceData.Device.Power = true;
|
|
865
857
|
deviceData.Device[fanKey] = state ? 2 : button.previousValue;
|
|
866
|
-
|
|
858
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerSetFanSpeed;
|
|
867
859
|
break;
|
|
868
860
|
case 33: //FAN SPEED MODE 3
|
|
869
861
|
button.previousValue = state ? deviceData.Device[fanKey] : button.previousValue ?? deviceData.Device[fanKey];
|
|
870
862
|
deviceData.Device.Power = true;
|
|
871
863
|
deviceData.Device[fanKey] = state ? 3 : button.previousValue;
|
|
872
|
-
|
|
864
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerSetFanSpeed;
|
|
873
865
|
break;
|
|
874
866
|
case 34: //FAN MODE 4
|
|
875
867
|
button.previousValue = state ? deviceData.Device[fanKey] : button.previousValue ?? deviceData.Device[fanKey];
|
|
876
868
|
deviceData.Device.Power = true;
|
|
877
869
|
deviceData.Device[fanKey] = state ? 4 : button.previousValue;
|
|
878
|
-
|
|
870
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerSetFanSpeed;
|
|
879
871
|
break;
|
|
880
872
|
case 35: //FAN SPEED MODE 5
|
|
881
873
|
button.previousValue = state ? deviceData.Device[fanKey] : button.previousValue ?? deviceData.Device[fanKey];
|
|
882
874
|
deviceData.Device.Power = true;
|
|
883
875
|
deviceData.Device[fanKey] = state ? 5 : button.previousValue;
|
|
884
|
-
|
|
876
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerSetFanSpeed;
|
|
885
877
|
break;
|
|
886
878
|
case 36: //FAN SPEED MODE 6
|
|
887
879
|
button.previousValue = state ? deviceData.Device[fanKey] : button.previousValue ?? deviceData.Device[fanKey];
|
|
888
880
|
deviceData.Device.Power = true;
|
|
889
881
|
deviceData.Device[fanKey] = state ? 6 : button.previousValue;
|
|
890
|
-
|
|
882
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerSetFanSpeed;
|
|
891
883
|
break;
|
|
892
884
|
case 37: //PHYSICAL LOCK CONTROLS
|
|
893
885
|
deviceData.Device.ProhibitSetTemperature = state;
|
|
894
886
|
deviceData.Device.ProhibitOperationMode = state;
|
|
895
887
|
deviceData.Device.ProhibitPower = state;
|
|
896
|
-
|
|
888
|
+
effectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
897
889
|
break;
|
|
898
890
|
case 38: //PHYSICAL LOCK CONTROLS POWER
|
|
899
891
|
deviceData.Device.ProhibitPower = state;
|
|
900
|
-
|
|
892
|
+
effectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
901
893
|
break;
|
|
902
894
|
case 39: //PHYSICAL LOCK CONTROLS MODE
|
|
903
895
|
deviceData.Device.ProhibitOperationMode = state;
|
|
904
|
-
|
|
896
|
+
effectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
905
897
|
break;
|
|
906
898
|
case 40: //PHYSICAL LOCK CONTROLS TEMP
|
|
907
899
|
deviceData.Device.ProhibitSetTemperature = state;
|
|
908
|
-
|
|
900
|
+
effectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
909
901
|
break;
|
|
910
902
|
default:
|
|
911
903
|
if (this.logWarn) this.emit('warn', `Unknown button mode: ${mode}`);
|
|
912
904
|
break;
|
|
913
905
|
};
|
|
914
906
|
|
|
915
|
-
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
907
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, effectiveFlags);
|
|
916
908
|
if (this.logInfo) this.emit('info', `${state ? `Set: ${name}` : `Unset: ${name}, Set: ${button.previousValue}`}`);
|
|
917
909
|
} catch (error) {
|
|
918
910
|
if (this.logWarn) this.emit('warn', `Set button error: ${error}`);
|
package/src/melcloudata.js
CHANGED
|
@@ -176,7 +176,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
176
176
|
};
|
|
177
177
|
};
|
|
178
178
|
|
|
179
|
-
async send(accountType, displayType, deviceData) {
|
|
179
|
+
async send(accountType, displayType, deviceData, effectiveFlags) {
|
|
180
180
|
try {
|
|
181
181
|
switch (accountType) {
|
|
182
182
|
case "melcloud":
|
|
@@ -195,6 +195,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
195
195
|
deviceData.Device.SetTemperature = (deviceData.Device.DefaultCoolingSetTemperature + deviceData.Device.DefaultHeatingSetTemperature) / 2;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
deviceData.Device.EffectiveFlags = effectiveFlags;
|
|
198
199
|
const payload = {
|
|
199
200
|
data: {
|
|
200
201
|
DeviceID: deviceData.Device.DeviceID,
|