homebridge-tasmota-control 1.6.15-beta.3 → 1.6.15-beta.6
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/config.schema.json +7 -7
- package/package.json +1 -1
- package/src/constants.js +4 -2
- package/src/mielhvac.js +74 -84
package/config.schema.json
CHANGED
|
@@ -519,7 +519,7 @@
|
|
|
519
519
|
"title": "Mode",
|
|
520
520
|
"type": "integer",
|
|
521
521
|
"minimum": 0,
|
|
522
|
-
"maximum":
|
|
522
|
+
"maximum": 60,
|
|
523
523
|
"default": 0,
|
|
524
524
|
"description": "Here select function.",
|
|
525
525
|
"oneOf": [
|
|
@@ -559,12 +559,6 @@
|
|
|
559
559
|
5
|
|
560
560
|
]
|
|
561
561
|
},
|
|
562
|
-
{
|
|
563
|
-
"title": "MODE PURIFY (not implemented)",
|
|
564
|
-
"enum": [
|
|
565
|
-
6
|
|
566
|
-
]
|
|
567
|
-
},
|
|
568
562
|
{
|
|
569
563
|
"title": "VANE H LEFT",
|
|
570
564
|
"enum": [
|
|
@@ -732,6 +726,12 @@
|
|
|
732
726
|
"enum": [
|
|
733
727
|
53
|
|
734
728
|
]
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
"title": "PURIFY (not implemented)",
|
|
732
|
+
"enum": [
|
|
733
|
+
60
|
|
734
|
+
]
|
|
735
735
|
}
|
|
736
736
|
],
|
|
737
737
|
"required": false
|
package/package.json
CHANGED
package/src/constants.js
CHANGED
|
@@ -34,7 +34,6 @@ export const MiElHVAC = {
|
|
|
34
34
|
"cool": "HVACSetMode%20cool",
|
|
35
35
|
"fan": "HVACSetMode%20fan",
|
|
36
36
|
"auto": "HVACSetMode%20auto",
|
|
37
|
-
"purify": "HVACSetMode%20purify"
|
|
38
37
|
},
|
|
39
38
|
"SetFanSpeed": {
|
|
40
39
|
"auto": "HVACSetFanSpeed%20auto",
|
|
@@ -64,9 +63,9 @@ export const MiElHVAC = {
|
|
|
64
63
|
"swing": "HVACSetSwingH%20swing",
|
|
65
64
|
},
|
|
66
65
|
"SetAirDirection": {
|
|
67
|
-
"even": "HVACSetSwingH%20even",
|
|
68
66
|
"indirect": "HVACSetSwingH%20indirect",
|
|
69
67
|
"direct": "HVACSetSwingH%20direct",
|
|
68
|
+
"even": "HVACSetSwingH%20even",
|
|
70
69
|
"off": "HVACSetSwingH%20off"
|
|
71
70
|
},
|
|
72
71
|
"SetProhibit": {
|
|
@@ -83,6 +82,9 @@ export const MiElHVAC = {
|
|
|
83
82
|
"c": "HVACSetDisplayUnit%20c",
|
|
84
83
|
"f": "HVACSetDisplayUnit%20f"
|
|
85
84
|
},
|
|
85
|
+
"SetPurify": {
|
|
86
|
+
"purify": "HVACSetPurify%20purify"
|
|
87
|
+
},
|
|
86
88
|
"RemoteTemp": "HVACRemoteTemp%20",
|
|
87
89
|
"RemoteTempClearTime": "HVACRemoteTempClearTime%20",
|
|
88
90
|
"OperationMode": [
|
package/src/mielhvac.js
CHANGED
|
@@ -217,6 +217,7 @@ class MiElHvac extends EventEmitter {
|
|
|
217
217
|
const vaneVerticalDirection = miElHvac.SwingV ?? 'Unknown';
|
|
218
218
|
const vaneHorizontalDirection = miElHvac.SwingH ?? 'Unknown';
|
|
219
219
|
const prohibit = miElHvac.Prohibit ?? 'Unknown';
|
|
220
|
+
const purify = miElHvac.Purify ?? 'Unknown';
|
|
220
221
|
const airDirection = miElHvac.AirDirection ?? 'Unknown';
|
|
221
222
|
const compressor = miElHvac.Compressor ?? 'Unknown';
|
|
222
223
|
const compressorFrequency = miElHvac.CompressorFrequency ?? 0;
|
|
@@ -256,6 +257,7 @@ class MiElHvac extends EventEmitter {
|
|
|
256
257
|
vaneVerticalDirection: vaneVerticalDirection,
|
|
257
258
|
vaneHorizontalDirection: vaneHorizontalDirection,
|
|
258
259
|
prohibit: prohibit,
|
|
260
|
+
purify: purify,
|
|
259
261
|
airDirection: airDirection,
|
|
260
262
|
swingMode: swingMode,
|
|
261
263
|
compressor: compressor,
|
|
@@ -347,59 +349,43 @@ class MiElHvac extends EventEmitter {
|
|
|
347
349
|
|
|
348
350
|
|
|
349
351
|
if (modelSupportsFanSpeed) {
|
|
350
|
-
// Map fan speed string to index
|
|
351
352
|
const fanSpeedMap = {
|
|
352
353
|
'auto': 0,
|
|
353
354
|
'quiet': 1,
|
|
354
355
|
'1': 2,
|
|
355
356
|
'2': 3,
|
|
356
357
|
'3': 4,
|
|
357
|
-
'4': 5
|
|
358
|
+
'4': 5
|
|
358
359
|
};
|
|
359
360
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
361
|
+
const fanIndex = fanSpeedMap[fanSpeed];
|
|
362
|
+
obj.fanSpeed = 0;
|
|
363
|
+
obj.fanSpeedSetPropsMaxValue = 0;
|
|
364
|
+
|
|
365
|
+
if (typeof fanIndex === 'number') {
|
|
366
|
+
switch (numberOfFanSpeeds) {
|
|
367
|
+
case 2:
|
|
368
|
+
obj.fanSpeed = hasAutomaticFanSpeed ? [3, 1, 2][fanIndex] ?? 1 : [0, 1, 2][fanIndex] ?? 1;
|
|
369
|
+
obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 3 : 2;
|
|
370
|
+
break;
|
|
371
|
+
case 3:
|
|
372
|
+
obj.fanSpeed = hasAutomaticFanSpeed ? [4, 1, 2, 3][fanIndex] ?? 1 : [0, 1, 2, 3][fanIndex] ?? 1;
|
|
373
|
+
obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 4 : 3;
|
|
374
|
+
break;
|
|
375
|
+
case 4:
|
|
376
|
+
obj.fanSpeed = hasAutomaticFanSpeed ? [5, 1, 2, 3, 4][fanIndex] ?? 1 : [0, 1, 2, 3, 4][fanIndex] ?? 1;
|
|
377
|
+
obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 5 : 4;
|
|
378
|
+
break;
|
|
379
|
+
case 5:
|
|
380
|
+
obj.fanSpeed = hasAutomaticFanSpeed ? [6, 1, 2, 3, 4, 5][fanIndex] ?? 1 : [0, 1, 2, 3, 4, 5][fanIndex] ?? 1;
|
|
381
|
+
obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 6 : 5;
|
|
382
|
+
break;
|
|
377
383
|
}
|
|
378
|
-
return arr;
|
|
379
|
-
};
|
|
380
384
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
obj.fanSpeed =
|
|
384
|
-
|
|
385
|
-
break;
|
|
386
|
-
case 3:
|
|
387
|
-
obj.fanSpeed = generateSpeedArray(4, hasAutomaticFanSpeed)[fanSpeedIndex];
|
|
388
|
-
obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 4 : 3;
|
|
389
|
-
break;
|
|
390
|
-
case 4:
|
|
391
|
-
obj.fanSpeed = generateSpeedArray(5, hasAutomaticFanSpeed)[fanSpeedIndex];
|
|
392
|
-
obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 5 : 4;
|
|
393
|
-
break;
|
|
394
|
-
case 5:
|
|
395
|
-
obj.fanSpeed = generateSpeedArray(6, hasAutomaticFanSpeed)[fanSpeedIndex];
|
|
396
|
-
obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 6 : 5;
|
|
397
|
-
break;
|
|
398
|
-
default:
|
|
399
|
-
// Fallback for unexpected fan speed count
|
|
400
|
-
obj.fanSpeed = 0;
|
|
401
|
-
obj.fanSpeedSetPropsMaxValue = 0;
|
|
402
|
-
break;
|
|
385
|
+
// Cap value to max
|
|
386
|
+
if (obj.fanSpeed > obj.fanSpeedSetPropsMaxValue) {
|
|
387
|
+
obj.fanSpeed = obj.fanSpeedSetPropsMaxValue;
|
|
388
|
+
}
|
|
403
389
|
}
|
|
404
390
|
}
|
|
405
391
|
|
|
@@ -481,7 +467,6 @@ class MiElHvac extends EventEmitter {
|
|
|
481
467
|
3: () => power && ['cool', 'cool_isee'].includes(operationMode),
|
|
482
468
|
4: () => power && operationMode === 'fan',
|
|
483
469
|
5: () => power && operationMode === 'auto',
|
|
484
|
-
6: () => power && operationMode === 'purify',
|
|
485
470
|
};
|
|
486
471
|
|
|
487
472
|
const vaneHMap = {
|
|
@@ -527,6 +512,10 @@ class MiElHvac extends EventEmitter {
|
|
|
527
512
|
53: 'temp',
|
|
528
513
|
};
|
|
529
514
|
|
|
515
|
+
const purifyMap = {
|
|
516
|
+
60: () => power && purify === 'on',
|
|
517
|
+
};
|
|
518
|
+
|
|
530
519
|
this.buttonsConfigured.forEach((button, index) => {
|
|
531
520
|
const mode = button.mode;
|
|
532
521
|
let state = false;
|
|
@@ -543,6 +532,8 @@ class MiElHvac extends EventEmitter {
|
|
|
543
532
|
state = airDirMap[mode]();
|
|
544
533
|
} else if (prohibitMap[mode] !== undefined) {
|
|
545
534
|
state = prohibit === prohibitMap[mode];
|
|
535
|
+
} else if (purifyMap[mode] !== undefined) {
|
|
536
|
+
state = purify === purifyMap[mode];
|
|
546
537
|
} else {
|
|
547
538
|
this.emit('warn', `Unknown button mode: ${mode} detected`);
|
|
548
539
|
}
|
|
@@ -1057,58 +1048,55 @@ class MiElHvac extends EventEmitter {
|
|
|
1057
1048
|
0: () => state ? MiElHVAC.PowerOn : MiElHVAC.PowerOff,
|
|
1058
1049
|
|
|
1059
1050
|
// Modes
|
|
1060
|
-
1: () =>
|
|
1061
|
-
2: () =>
|
|
1062
|
-
3: () =>
|
|
1063
|
-
4: () =>
|
|
1064
|
-
5: () =>
|
|
1065
|
-
6: () => getModeCommand('purify'),
|
|
1051
|
+
1: () => getCommand('SetMode', 'heat'),
|
|
1052
|
+
2: () => getCommand('SetMode', 'dry'),
|
|
1053
|
+
3: () => getCommand('SetMode', 'cool'),
|
|
1054
|
+
4: () => getCommand('SetMode', 'fan'),
|
|
1055
|
+
5: () => getCommand('SetMode', 'auto'),
|
|
1066
1056
|
|
|
1067
1057
|
// Horizontal Swing
|
|
1068
|
-
11: () =>
|
|
1069
|
-
12: () =>
|
|
1070
|
-
13: () =>
|
|
1071
|
-
14: () =>
|
|
1072
|
-
15: () =>
|
|
1073
|
-
16: () =>
|
|
1074
|
-
17: () =>
|
|
1058
|
+
11: () => getCommand('SetSwingH', 'left'),
|
|
1059
|
+
12: () => getCommand('SetSwingH', 'left_middle'),
|
|
1060
|
+
13: () => getCommand('SetSwingH', 'center'),
|
|
1061
|
+
14: () => getCommand('SetSwingH', 'right_middle'),
|
|
1062
|
+
15: () => getCommand('SetSwingH', 'right'),
|
|
1063
|
+
16: () => getCommand('SetSwingH', 'split'),
|
|
1064
|
+
17: () => getCommand('SetSwingH', 'swing'),
|
|
1075
1065
|
|
|
1076
1066
|
// Vertical Swing
|
|
1077
|
-
20: () =>
|
|
1078
|
-
21: () =>
|
|
1079
|
-
22: () =>
|
|
1080
|
-
23: () =>
|
|
1081
|
-
24: () =>
|
|
1082
|
-
25: () =>
|
|
1083
|
-
26: () =>
|
|
1067
|
+
20: () => getCommand('SetSwingV', 'auto'),
|
|
1068
|
+
21: () => getCommand('SetSwingV', 'up'),
|
|
1069
|
+
22: () => getCommand('SetSwingV', 'up_middle'),
|
|
1070
|
+
23: () => getCommand('SetSwingV', 'center'),
|
|
1071
|
+
24: () => getCommand('SetSwingV', 'down_middle'),
|
|
1072
|
+
25: () => getCommand('SetSwingV', 'down'),
|
|
1073
|
+
26: () => getCommand('SetSwingV', 'swing'),
|
|
1084
1074
|
|
|
1085
1075
|
// Fan Speeds
|
|
1086
|
-
30: () =>
|
|
1087
|
-
31: () =>
|
|
1088
|
-
32: () =>
|
|
1089
|
-
33: () =>
|
|
1090
|
-
34: () =>
|
|
1091
|
-
35: () =>
|
|
1076
|
+
30: () => getCommand('SetFanSpeed', 'auto'),
|
|
1077
|
+
31: () => getCommand('SetFanSpeed', 'quiet'),
|
|
1078
|
+
32: () => getCommand('SetFanSpeed', '1'),
|
|
1079
|
+
33: () => getCommand('SetFanSpeed', '2'),
|
|
1080
|
+
34: () => getCommand('SetFanSpeed', '3'),
|
|
1081
|
+
35: () => getCommand('SetFanSpeed', '4'),
|
|
1092
1082
|
|
|
1093
1083
|
// Air Direction
|
|
1094
|
-
40: () =>
|
|
1095
|
-
41: () =>
|
|
1096
|
-
42: () =>
|
|
1097
|
-
43: () =>
|
|
1084
|
+
40: () => getCommand('SetAirDirection', 'indirect'),
|
|
1085
|
+
41: () => getCommand('SetAirDirection', 'direct'),
|
|
1086
|
+
42: () => getCommand('SetAirDirection', 'even'),
|
|
1087
|
+
43: () => getCommand('SetAirDirection', 'off'),
|
|
1098
1088
|
|
|
1099
1089
|
// Prohibit
|
|
1100
|
-
50: () =>
|
|
1101
|
-
51: () =>
|
|
1102
|
-
52: () =>
|
|
1103
|
-
53: () =>
|
|
1104
|
-
};
|
|
1090
|
+
50: () => getCommand('SetProhibit', 'all'),
|
|
1091
|
+
51: () => getCommand('SetProhibit', 'power'),
|
|
1092
|
+
52: () => getCommand('SetProhibit', 'mode'),
|
|
1093
|
+
53: () => getCommand('SetProhibit', 'temp'),
|
|
1105
1094
|
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
return state ? MiElHVAC.SetMode[target] : button.previousValue;
|
|
1095
|
+
// Purify
|
|
1096
|
+
60: () => getCommand('SetPurify', 'purify'),
|
|
1109
1097
|
};
|
|
1110
1098
|
|
|
1111
|
-
const
|
|
1099
|
+
const getCommand = (type, target) => {
|
|
1112
1100
|
const current = this.mielHvac[getCurrentKey(type)];
|
|
1113
1101
|
button.previousValue = state ? MiElHVAC[type][current] : button.previousValue;
|
|
1114
1102
|
return state ? MiElHVAC[type][target] : button.previousValue;
|
|
@@ -1116,11 +1104,13 @@ class MiElHvac extends EventEmitter {
|
|
|
1116
1104
|
|
|
1117
1105
|
const getCurrentKey = (type) => {
|
|
1118
1106
|
switch (type) {
|
|
1107
|
+
case 'SetMode': return 'operationMode';
|
|
1119
1108
|
case 'SetSwingH': return 'vaneHorizontalDirection';
|
|
1120
1109
|
case 'SetSwingV': return 'vaneVerticalDirection';
|
|
1121
1110
|
case 'SetFanSpeed': return 'fanSpeed';
|
|
1122
1111
|
case 'SetAirDirection': return 'airDirection';
|
|
1123
1112
|
case 'SetProhibit': return 'prohibit';
|
|
1113
|
+
case 'SetPurify': return 'purify';
|
|
1124
1114
|
default: return '';
|
|
1125
1115
|
}
|
|
1126
1116
|
};
|
|
@@ -1131,7 +1121,7 @@ class MiElHvac extends EventEmitter {
|
|
|
1131
1121
|
}
|
|
1132
1122
|
|
|
1133
1123
|
data = mappings[mode]();
|
|
1134
|
-
if (!this.mielHvac.power && state && mode > 0 && mode
|
|
1124
|
+
if (!this.mielHvac.power && state && mode > 0 && mode <= 60) {
|
|
1135
1125
|
await this.axiosInstance(MiElHVAC.PowerOn);
|
|
1136
1126
|
}
|
|
1137
1127
|
|