homebridge-tasmota-control 1.6.15-beta.2 → 1.6.15-beta.21
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 +103 -43
- package/index.js +14 -14
- package/package.json +1 -1
- package/src/constants.js +21 -7
- package/src/mielhvac.js +166 -144
package/config.schema.json
CHANGED
|
@@ -399,6 +399,12 @@
|
|
|
399
399
|
"type": "string",
|
|
400
400
|
"default": "swing",
|
|
401
401
|
"oneOf": [
|
|
402
|
+
{
|
|
403
|
+
"title": "AIR DIRECTION",
|
|
404
|
+
"enum": [
|
|
405
|
+
"airdirection"
|
|
406
|
+
]
|
|
407
|
+
},
|
|
402
408
|
{
|
|
403
409
|
"title": "LEFT",
|
|
404
410
|
"enum": [
|
|
@@ -411,12 +417,24 @@
|
|
|
411
417
|
"left_middle"
|
|
412
418
|
]
|
|
413
419
|
},
|
|
420
|
+
{
|
|
421
|
+
"title": "LEFT CENTER",
|
|
422
|
+
"enum": [
|
|
423
|
+
"left_center"
|
|
424
|
+
]
|
|
425
|
+
},
|
|
414
426
|
{
|
|
415
427
|
"title": "CENTER",
|
|
416
428
|
"enum": [
|
|
417
429
|
"center"
|
|
418
430
|
]
|
|
419
431
|
},
|
|
432
|
+
{
|
|
433
|
+
"title": "RIGHT CENTER",
|
|
434
|
+
"enum": [
|
|
435
|
+
"right_center"
|
|
436
|
+
]
|
|
437
|
+
},
|
|
420
438
|
{
|
|
421
439
|
"title": "RIGHT MIDDLE",
|
|
422
440
|
"enum": [
|
|
@@ -519,7 +537,7 @@
|
|
|
519
537
|
"title": "Mode",
|
|
520
538
|
"type": "integer",
|
|
521
539
|
"minimum": 0,
|
|
522
|
-
"maximum":
|
|
540
|
+
"maximum": 63,
|
|
523
541
|
"default": 0,
|
|
524
542
|
"description": "Here select function.",
|
|
525
543
|
"oneOf": [
|
|
@@ -560,19 +578,19 @@
|
|
|
560
578
|
]
|
|
561
579
|
},
|
|
562
580
|
{
|
|
563
|
-
"title": "
|
|
581
|
+
"title": "VANE H LEFT",
|
|
564
582
|
"enum": [
|
|
565
|
-
|
|
583
|
+
10
|
|
566
584
|
]
|
|
567
585
|
},
|
|
568
586
|
{
|
|
569
|
-
"title": "VANE H LEFT",
|
|
587
|
+
"title": "VANE H LEFT MIDDLE",
|
|
570
588
|
"enum": [
|
|
571
589
|
11
|
|
572
590
|
]
|
|
573
591
|
},
|
|
574
592
|
{
|
|
575
|
-
"title": "VANE H LEFT
|
|
593
|
+
"title": "VANE H LEFT CENTER",
|
|
576
594
|
"enum": [
|
|
577
595
|
12
|
|
578
596
|
]
|
|
@@ -584,29 +602,35 @@
|
|
|
584
602
|
]
|
|
585
603
|
},
|
|
586
604
|
{
|
|
587
|
-
"title": "VANE H RIGHT
|
|
605
|
+
"title": "VANE H RIGHT CENTER",
|
|
588
606
|
"enum": [
|
|
589
607
|
14
|
|
590
608
|
]
|
|
591
609
|
},
|
|
592
610
|
{
|
|
593
|
-
"title": "VANE H RIGHT",
|
|
611
|
+
"title": "VANE H RIGHT MIDDLE",
|
|
594
612
|
"enum": [
|
|
595
613
|
15
|
|
596
614
|
]
|
|
597
615
|
},
|
|
598
616
|
{
|
|
599
|
-
"title": "VANE H
|
|
617
|
+
"title": "VANE H RIGHT",
|
|
600
618
|
"enum": [
|
|
601
619
|
16
|
|
602
620
|
]
|
|
603
621
|
},
|
|
604
622
|
{
|
|
605
|
-
"title": "VANE H
|
|
623
|
+
"title": "VANE H SPLIT",
|
|
606
624
|
"enum": [
|
|
607
625
|
17
|
|
608
626
|
]
|
|
609
627
|
},
|
|
628
|
+
{
|
|
629
|
+
"title": "VANE H SWING",
|
|
630
|
+
"enum": [
|
|
631
|
+
18
|
|
632
|
+
]
|
|
633
|
+
},
|
|
610
634
|
{
|
|
611
635
|
"title": "VANE V AUTO",
|
|
612
636
|
"enum": [
|
|
@@ -704,34 +728,52 @@
|
|
|
704
728
|
]
|
|
705
729
|
},
|
|
706
730
|
{
|
|
707
|
-
"title": "
|
|
708
|
-
"enum": [
|
|
709
|
-
43
|
|
710
|
-
]
|
|
711
|
-
},
|
|
712
|
-
{
|
|
713
|
-
"title": "LOCK CONTROL All (only as sensor now)",
|
|
731
|
+
"title": "LOCK CONTROL All",
|
|
714
732
|
"enum": [
|
|
715
733
|
50
|
|
716
734
|
]
|
|
717
735
|
},
|
|
718
736
|
{
|
|
719
|
-
"title": "LOCK CONTROL POWER
|
|
737
|
+
"title": "LOCK CONTROL POWER",
|
|
720
738
|
"enum": [
|
|
721
739
|
51
|
|
722
740
|
]
|
|
723
741
|
},
|
|
724
742
|
{
|
|
725
|
-
"title": "LOCK CONTROL MODE
|
|
743
|
+
"title": "LOCK CONTROL MODE",
|
|
726
744
|
"enum": [
|
|
727
745
|
52
|
|
728
746
|
]
|
|
729
747
|
},
|
|
730
748
|
{
|
|
731
|
-
"title": "LOCK CONTROL TEMPERATURE
|
|
749
|
+
"title": "LOCK CONTROL TEMPERATURE",
|
|
732
750
|
"enum": [
|
|
733
751
|
53
|
|
734
752
|
]
|
|
753
|
+
},
|
|
754
|
+
{
|
|
755
|
+
"title": "PURIFY",
|
|
756
|
+
"enum": [
|
|
757
|
+
60
|
|
758
|
+
]
|
|
759
|
+
},
|
|
760
|
+
{
|
|
761
|
+
"title": "ECONO COOL",
|
|
762
|
+
"enum": [
|
|
763
|
+
61
|
|
764
|
+
]
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
"title": "POWER FULL",
|
|
768
|
+
"enum": [
|
|
769
|
+
62
|
|
770
|
+
]
|
|
771
|
+
},
|
|
772
|
+
{
|
|
773
|
+
"title": "NIGHT MODE",
|
|
774
|
+
"enum": [
|
|
775
|
+
63
|
|
776
|
+
]
|
|
735
777
|
}
|
|
736
778
|
],
|
|
737
779
|
"required": false
|
|
@@ -833,25 +875,25 @@
|
|
|
833
875
|
]
|
|
834
876
|
},
|
|
835
877
|
{
|
|
836
|
-
"title": "
|
|
878
|
+
"title": "PURIFY",
|
|
837
879
|
"enum": [
|
|
838
880
|
6
|
|
839
881
|
]
|
|
840
882
|
},
|
|
841
883
|
{
|
|
842
|
-
"title": "VANE H
|
|
884
|
+
"title": "VANE H LEFT",
|
|
843
885
|
"enum": [
|
|
844
886
|
10
|
|
845
887
|
]
|
|
846
888
|
},
|
|
847
889
|
{
|
|
848
|
-
"title": "VANE H LEFT",
|
|
890
|
+
"title": "VANE H LEFT MIDDLE",
|
|
849
891
|
"enum": [
|
|
850
892
|
11
|
|
851
893
|
]
|
|
852
894
|
},
|
|
853
895
|
{
|
|
854
|
-
"title": "VANE H LEFT
|
|
896
|
+
"title": "VANE H LEFT CENTER",
|
|
855
897
|
"enum": [
|
|
856
898
|
12
|
|
857
899
|
]
|
|
@@ -863,29 +905,41 @@
|
|
|
863
905
|
]
|
|
864
906
|
},
|
|
865
907
|
{
|
|
866
|
-
"title": "VANE H RIGHT
|
|
908
|
+
"title": "VANE H RIGHT CENTER",
|
|
867
909
|
"enum": [
|
|
868
910
|
14
|
|
869
911
|
]
|
|
870
912
|
},
|
|
871
913
|
{
|
|
872
|
-
"title": "VANE H RIGHT",
|
|
914
|
+
"title": "VANE H RIGHT MIDDLE",
|
|
873
915
|
"enum": [
|
|
874
916
|
15
|
|
875
917
|
]
|
|
876
918
|
},
|
|
877
919
|
{
|
|
878
|
-
"title": "VANE H
|
|
920
|
+
"title": "VANE H RIGHT",
|
|
879
921
|
"enum": [
|
|
880
922
|
16
|
|
881
923
|
]
|
|
882
924
|
},
|
|
883
925
|
{
|
|
884
|
-
"title": "VANE H
|
|
926
|
+
"title": "VANE H SPLIT",
|
|
885
927
|
"enum": [
|
|
886
928
|
17
|
|
887
929
|
]
|
|
888
930
|
},
|
|
931
|
+
{
|
|
932
|
+
"title": "VANE H SWING",
|
|
933
|
+
"enum": [
|
|
934
|
+
18
|
|
935
|
+
]
|
|
936
|
+
},
|
|
937
|
+
{
|
|
938
|
+
"title": "VANE H AIR DIRECTION",
|
|
939
|
+
"enum": [
|
|
940
|
+
19
|
|
941
|
+
]
|
|
942
|
+
},
|
|
889
943
|
{
|
|
890
944
|
"title": "VANE V AUTO",
|
|
891
945
|
"enum": [
|
|
@@ -1013,97 +1067,103 @@
|
|
|
1013
1067
|
]
|
|
1014
1068
|
},
|
|
1015
1069
|
{
|
|
1016
|
-
"title": "OPERATION
|
|
1070
|
+
"title": "OPERATION STATUS NORMAL",
|
|
1017
1071
|
"enum": [
|
|
1018
1072
|
70
|
|
1019
1073
|
]
|
|
1020
1074
|
},
|
|
1021
1075
|
{
|
|
1022
|
-
"title": "OPERATION
|
|
1076
|
+
"title": "OPERATION STATUS FILTER",
|
|
1023
1077
|
"enum": [
|
|
1024
1078
|
71
|
|
1025
1079
|
]
|
|
1026
1080
|
},
|
|
1027
1081
|
{
|
|
1028
|
-
"title": "OPERATION
|
|
1082
|
+
"title": "OPERATION STATUS DEFROST",
|
|
1029
1083
|
"enum": [
|
|
1030
1084
|
72
|
|
1031
1085
|
]
|
|
1032
1086
|
},
|
|
1033
1087
|
{
|
|
1034
|
-
"title": "OPERATION
|
|
1088
|
+
"title": "OPERATION STATUS STANDBY",
|
|
1035
1089
|
"enum": [
|
|
1036
1090
|
73
|
|
1037
1091
|
]
|
|
1038
1092
|
},
|
|
1039
1093
|
{
|
|
1040
|
-
"title": "
|
|
1094
|
+
"title": "OPERATION STATUS PREHEAT",
|
|
1095
|
+
"enum": [
|
|
1096
|
+
74
|
|
1097
|
+
]
|
|
1098
|
+
},
|
|
1099
|
+
{
|
|
1100
|
+
"title": "FAN STATUS OFF",
|
|
1041
1101
|
"enum": [
|
|
1042
1102
|
80
|
|
1043
1103
|
]
|
|
1044
1104
|
},
|
|
1045
1105
|
{
|
|
1046
|
-
"title": "FAN
|
|
1106
|
+
"title": "FAN STATUS QUIET",
|
|
1047
1107
|
"enum": [
|
|
1048
1108
|
81
|
|
1049
1109
|
]
|
|
1050
1110
|
},
|
|
1051
1111
|
{
|
|
1052
|
-
"title": "FAN
|
|
1112
|
+
"title": "FAN STATUS 1",
|
|
1053
1113
|
"enum": [
|
|
1054
1114
|
82
|
|
1055
1115
|
]
|
|
1056
1116
|
},
|
|
1057
1117
|
{
|
|
1058
|
-
"title": "FAN
|
|
1118
|
+
"title": "FAN STATUS 2",
|
|
1059
1119
|
"enum": [
|
|
1060
1120
|
83
|
|
1061
1121
|
]
|
|
1062
1122
|
},
|
|
1063
1123
|
{
|
|
1064
|
-
"title": "FAN
|
|
1124
|
+
"title": "FAN STATUS 3",
|
|
1065
1125
|
"enum": [
|
|
1066
1126
|
84
|
|
1067
1127
|
]
|
|
1068
1128
|
},
|
|
1069
1129
|
{
|
|
1070
|
-
"title": "FAN
|
|
1130
|
+
"title": "FAN STATUS 4",
|
|
1071
1131
|
"enum": [
|
|
1072
1132
|
85
|
|
1073
1133
|
]
|
|
1074
1134
|
},
|
|
1075
1135
|
{
|
|
1076
|
-
"title": "FAN
|
|
1136
|
+
"title": "FAN STATUS 5",
|
|
1077
1137
|
"enum": [
|
|
1078
1138
|
86
|
|
1079
1139
|
]
|
|
1080
1140
|
},
|
|
1081
1141
|
{
|
|
1082
|
-
"title": "MODE
|
|
1142
|
+
"title": "MODE STATUS AUTO OFF",
|
|
1083
1143
|
"enum": [
|
|
1084
1144
|
90
|
|
1085
1145
|
]
|
|
1086
1146
|
},
|
|
1087
1147
|
{
|
|
1088
|
-
"title": "MODE
|
|
1148
|
+
"title": "MODE STATUS AUTO FAN",
|
|
1089
1149
|
"enum": [
|
|
1090
1150
|
91
|
|
1091
1151
|
]
|
|
1092
1152
|
},
|
|
1093
1153
|
{
|
|
1094
|
-
"title": "MODE
|
|
1154
|
+
"title": "MODE STATUS AUTO HEAT",
|
|
1095
1155
|
"enum": [
|
|
1096
1156
|
92
|
|
1097
1157
|
]
|
|
1098
1158
|
},
|
|
1099
1159
|
{
|
|
1100
|
-
"title": "MODE
|
|
1160
|
+
"title": "MODE STATUS AUTO COOL",
|
|
1101
1161
|
"enum": [
|
|
1102
1162
|
93
|
|
1103
1163
|
]
|
|
1104
1164
|
},
|
|
1105
1165
|
{
|
|
1106
|
-
"title": "MODE
|
|
1166
|
+
"title": "MODE STATUS AUTO LEADER",
|
|
1107
1167
|
"enum": [
|
|
1108
1168
|
94
|
|
1109
1169
|
]
|
package/index.js
CHANGED
|
@@ -158,20 +158,20 @@ class tasmotaPlatform {
|
|
|
158
158
|
});
|
|
159
159
|
|
|
160
160
|
//create impulse generator
|
|
161
|
-
const impulseGenerator = new ImpulseGenerator()
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
161
|
+
const impulseGenerator = new ImpulseGenerator()
|
|
162
|
+
.on('start', async () => {
|
|
163
|
+
try {
|
|
164
|
+
const startDone = await deviceType.start();
|
|
165
|
+
const stopImpulseGenerator = startDone ? await impulseGenerator.stop() : false;
|
|
166
|
+
|
|
167
|
+
//start impulse generator
|
|
168
|
+
const startImpulseGenerator = stopImpulseGenerator ? await deviceType.startImpulseGenerator() : false
|
|
169
|
+
} catch (error) {
|
|
170
|
+
const emitLog = disableLogError ? false : log.error(`Device: ${host} ${deviceName}, ${error}, trying again.`);
|
|
171
|
+
}
|
|
172
|
+
}).on('state', (state) => {
|
|
173
|
+
const emitLog = !enableDebugMode ? false : state ? log.info(`Device: ${host} ${deviceName}, Start impulse generator started.`) : log.info(`Device: ${host} ${deviceName}, Start impulse generator stopped.`);
|
|
174
|
+
});
|
|
175
175
|
|
|
176
176
|
//start impulse generator
|
|
177
177
|
await impulseGenerator.start([{ name: 'start', sampling: 45000 }]);
|
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",
|
|
@@ -57,17 +56,18 @@ export const MiElHVAC = {
|
|
|
57
56
|
"SetSwingH": {
|
|
58
57
|
"left": "HVACSetSwingH%20left",
|
|
59
58
|
"left_middle": "HVACSetSwingH%20left_middle",
|
|
59
|
+
"left_center": "HVACSetSwingH%20left_center",
|
|
60
60
|
"center": "HVACSetSwingH%20center",
|
|
61
|
+
"right_center": "HVACSetSwingH%20right_center",
|
|
61
62
|
"right_middle": "HVACSetSwingH%20right_middle",
|
|
62
63
|
"right": "HVACSetSwingH%20right",
|
|
63
64
|
"split": "HVACSetSwingH%20split",
|
|
64
65
|
"swing": "HVACSetSwingH%20swing",
|
|
65
66
|
},
|
|
66
67
|
"SetAirDirection": {
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"off": "HVACSetSwingH%20off"
|
|
68
|
+
"indirect": "HVACSetAirDirection%20indirect",
|
|
69
|
+
"direct": "HVACSetAirDirection%20direct",
|
|
70
|
+
"even": "HVACSetAirDirection%20even",
|
|
71
71
|
},
|
|
72
72
|
"SetProhibit": {
|
|
73
73
|
"off": "HVACSetProhibit%20off",
|
|
@@ -83,6 +83,18 @@ export const MiElHVAC = {
|
|
|
83
83
|
"c": "HVACSetDisplayUnit%20c",
|
|
84
84
|
"f": "HVACSetDisplayUnit%20f"
|
|
85
85
|
},
|
|
86
|
+
"SetPurify": {
|
|
87
|
+
"purify": "HVACSetPurify%20on"
|
|
88
|
+
},
|
|
89
|
+
"SetEconoCool": {
|
|
90
|
+
"econocool": "HVACSetEconoCool%20on"
|
|
91
|
+
},
|
|
92
|
+
"SetPowerFull": {
|
|
93
|
+
"powerfull": "HVACSetPowerFull%20on"
|
|
94
|
+
},
|
|
95
|
+
"SetNightMode": {
|
|
96
|
+
"nightmode": "HVACSetNightMode%20on"
|
|
97
|
+
},
|
|
86
98
|
"RemoteTemp": "HVACRemoteTemp%20",
|
|
87
99
|
"RemoteTempClearTime": "HVACRemoteTempClearTime%20",
|
|
88
100
|
"OperationMode": [
|
|
@@ -107,7 +119,7 @@ export const MiElHVAC = {
|
|
|
107
119
|
"1": "WEAK",
|
|
108
120
|
"2": "NORMAL",
|
|
109
121
|
"3": "STRONG",
|
|
110
|
-
"4": "
|
|
122
|
+
"4": "VERY STRONG",
|
|
111
123
|
"6": "OFF"
|
|
112
124
|
},
|
|
113
125
|
"VerticalVane": {
|
|
@@ -120,10 +132,12 @@ export const MiElHVAC = {
|
|
|
120
132
|
"swing": "SWING"
|
|
121
133
|
},
|
|
122
134
|
"HorizontalVane": {
|
|
123
|
-
"
|
|
135
|
+
"airdirection": "AIR DIRECTION",
|
|
124
136
|
"left_middle": "LEFT",
|
|
125
137
|
"left": "LEFT MIDDLE",
|
|
138
|
+
"left_center": "LEFT CENTER",
|
|
126
139
|
"center": "CENTER",
|
|
140
|
+
"right_center": "RIGHT CENTER",
|
|
127
141
|
"right_middle": "RIGHT MIDDLE",
|
|
128
142
|
"right": "RIGHT",
|
|
129
143
|
"split": "SPLIT",
|
package/src/mielhvac.js
CHANGED
|
@@ -205,24 +205,33 @@ class MiElHvac extends EventEmitter {
|
|
|
205
205
|
const temperatureUnit = statusSns.TempUnit === 'C' ? '°C' : 'F';
|
|
206
206
|
|
|
207
207
|
//mielhvac
|
|
208
|
-
const miElHvac = statusSns.MiElHVAC
|
|
208
|
+
const miElHvac = statusSns.MiElHVAC;
|
|
209
|
+
|
|
210
|
+
if (!miElHvac || Object.keys(miElHvac).length === 0) {
|
|
211
|
+
this.emit('warn', "Empty data received");
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
|
|
209
215
|
const power = miElHvac.Power === 'on' ? 1 : 0;
|
|
210
216
|
const roomTemperature = miElHvac.Temperature ?? null;
|
|
217
|
+
if (!roomTemperature) return null;
|
|
218
|
+
|
|
211
219
|
const outdoorTemperature = miElHvac.OutdoorTemperature ?? null;
|
|
212
220
|
const setTemperature = miElHvac.SetTemperature;
|
|
213
221
|
const operationMode = miElHvac.Mode ?? 'Unknown';
|
|
214
|
-
const
|
|
222
|
+
const operationModeStatus = miElHvac.ModeStatus ?? 'Unknown';
|
|
215
223
|
const fanSpeed = miElHvac.FanSpeed ?? 'Unknown';
|
|
216
|
-
const
|
|
224
|
+
const fanSpeedStatus = miElHvac.FanStatus ?? 'Unknown';
|
|
217
225
|
const vaneVerticalDirection = miElHvac.SwingV ?? 'Unknown';
|
|
218
226
|
const vaneHorizontalDirection = miElHvac.SwingH ?? 'Unknown';
|
|
219
227
|
const prohibit = miElHvac.Prohibit ?? 'Unknown';
|
|
228
|
+
const purify = miElHvac.Purify ?? 'Unknown';
|
|
220
229
|
const airDirection = miElHvac.AirDirection ?? 'Unknown';
|
|
221
230
|
const compressor = miElHvac.Compressor ?? 'Unknown';
|
|
222
231
|
const compressorFrequency = miElHvac.CompressorFrequency ?? 0;
|
|
223
232
|
const operationPower = miElHvac.OperationPower ?? 0;
|
|
224
233
|
const operationEnergy = miElHvac.OperationEnergy ?? 0;
|
|
225
|
-
const
|
|
234
|
+
const operationStatus = miElHvac.OperationStatus ?? 'Unknown';
|
|
226
235
|
const swingMode = vaneVerticalDirection === 'swing' && vaneHorizontalDirection === 'swing' ? 1 : 0;
|
|
227
236
|
const defaultCoolingSetTemperature = parseFloat(await this.readData(this.info.defaultCoolingSetTemperatureFile));
|
|
228
237
|
const defaultHeatingSetTemperature = parseFloat(await this.readData(this.info.defaultHeatingSetTemperatureFile));
|
|
@@ -250,19 +259,20 @@ class MiElHvac extends EventEmitter {
|
|
|
250
259
|
outdoorTemperature: outdoorTemperature,
|
|
251
260
|
setTemperature: setTemperature,
|
|
252
261
|
operationMode: operationMode,
|
|
253
|
-
|
|
262
|
+
operationModeStatus: operationModeStatus,
|
|
254
263
|
currentOperationMode: 0,
|
|
255
264
|
targetOperationMode: 0,
|
|
256
265
|
vaneVerticalDirection: vaneVerticalDirection,
|
|
257
266
|
vaneHorizontalDirection: vaneHorizontalDirection,
|
|
258
267
|
prohibit: prohibit,
|
|
268
|
+
purify: purify,
|
|
259
269
|
airDirection: airDirection,
|
|
260
270
|
swingMode: swingMode,
|
|
261
271
|
compressor: compressor,
|
|
262
272
|
compressorFrequency: compressorFrequency,
|
|
263
273
|
operationPower: operationPower,
|
|
264
274
|
operationEnergy: operationEnergy,
|
|
265
|
-
|
|
275
|
+
operationStatus: operationStatus,
|
|
266
276
|
defaultCoolingSetTemperature: defaultCoolingSetTemperature,
|
|
267
277
|
defaultHeatingSetTemperature: defaultHeatingSetTemperature,
|
|
268
278
|
remoteTemperatureSensorState: remoteTemperatureSensorState,
|
|
@@ -282,8 +292,8 @@ class MiElHvac extends EventEmitter {
|
|
|
282
292
|
hideVaneControls: hideVaneControls
|
|
283
293
|
};
|
|
284
294
|
|
|
285
|
-
// Map
|
|
286
|
-
const
|
|
295
|
+
// Map status to index safely, fallback to 0 if not found
|
|
296
|
+
const operationModeStatusMap = {
|
|
287
297
|
'manual': 0,
|
|
288
298
|
'heat': 2,
|
|
289
299
|
'dry': 1,
|
|
@@ -298,43 +308,43 @@ class MiElHvac extends EventEmitter {
|
|
|
298
308
|
'auto_leader': 4
|
|
299
309
|
};
|
|
300
310
|
|
|
301
|
-
const
|
|
311
|
+
const statusIndex = operationModeStatusMap[operationModeStatus] ?? 0;
|
|
302
312
|
switch (operationMode) {
|
|
303
313
|
case 'heat':
|
|
304
|
-
obj.currentOperationMode = [2, 1, 2, 3, 0][
|
|
314
|
+
obj.currentOperationMode = [2, 1, 2, 3, 0][statusIndex]; // INACTIVE, IDLE, HEATING, COOLING
|
|
305
315
|
obj.targetOperationMode = 1; // AUTO, HEAT, COOL
|
|
306
316
|
break;
|
|
307
317
|
case 'dry':
|
|
308
|
-
obj.currentOperationMode = [1, 1, 2, 3, 0][
|
|
318
|
+
obj.currentOperationMode = [1, 1, 2, 3, 0][statusIndex];
|
|
309
319
|
obj.targetOperationMode = this.autoDryFanMode === 2 ? 0 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : obj.targetOperationMode;
|
|
310
320
|
break;
|
|
311
321
|
case 'cool':
|
|
312
|
-
obj.currentOperationMode = [3, 1, 2, 3, 0][
|
|
322
|
+
obj.currentOperationMode = [3, 1, 2, 3, 0][statusIndex];
|
|
313
323
|
obj.targetOperationMode = 2;
|
|
314
324
|
break;
|
|
315
325
|
case 'fan':
|
|
316
|
-
obj.currentOperationMode = [1, 1, 2, 3, 0][
|
|
326
|
+
obj.currentOperationMode = [1, 1, 2, 3, 0][statusIndex];
|
|
317
327
|
obj.targetOperationMode = this.autoDryFanMode === 3 ? 0 : this.heatDryFanMode === 3 ? 1 : this.coolDryFanMode === 3 ? 2 : obj.targetOperationMode;
|
|
318
328
|
break;
|
|
319
329
|
case 'auto':
|
|
320
|
-
obj.currentOperationMode = [2, 1, 2, 3, 0][
|
|
330
|
+
obj.currentOperationMode = [2, 1, 2, 3, 0][statusIndex];
|
|
321
331
|
obj.targetOperationMode = 0;
|
|
322
332
|
break;
|
|
323
333
|
case 'heat_isee':
|
|
324
|
-
obj.currentOperationMode = [2, 1, 2, 3, 0][
|
|
334
|
+
obj.currentOperationMode = [2, 1, 2, 3, 0][statusIndex];
|
|
325
335
|
obj.targetOperationMode = 1;
|
|
326
336
|
break;
|
|
327
337
|
case 'dry_isee':
|
|
328
|
-
obj.currentOperationMode = [1, 1, 2, 3, 0][
|
|
338
|
+
obj.currentOperationMode = [1, 1, 2, 3, 0][statusIndex];
|
|
329
339
|
obj.targetOperationMode = this.autoDryFanMode === 2 ? 0 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : obj.targetOperationMode;
|
|
330
340
|
break;
|
|
331
341
|
case 'cool_isee':
|
|
332
|
-
obj.currentOperationMode = [3, 1, 2, 3, 0][
|
|
342
|
+
obj.currentOperationMode = [3, 1, 2, 3, 0][statusIndex];
|
|
333
343
|
obj.targetOperationMode = 2;
|
|
334
344
|
break;
|
|
335
345
|
default:
|
|
336
346
|
this.emit('warn', `Unknown operating mode: ${operationMode}`);
|
|
337
|
-
return;
|
|
347
|
+
return null;
|
|
338
348
|
}
|
|
339
349
|
|
|
340
350
|
// If power is off, force currentOperationMode to 0 (inactive)
|
|
@@ -347,60 +357,45 @@ class MiElHvac extends EventEmitter {
|
|
|
347
357
|
|
|
348
358
|
|
|
349
359
|
if (modelSupportsFanSpeed) {
|
|
350
|
-
// Map fan speed string to index
|
|
351
360
|
const fanSpeedMap = {
|
|
352
361
|
'auto': 0,
|
|
353
362
|
'quiet': 1,
|
|
354
363
|
'1': 2,
|
|
355
364
|
'2': 3,
|
|
356
365
|
'3': 4,
|
|
357
|
-
'4': 5
|
|
358
|
-
'5': 6 // Added for completeness if needed
|
|
366
|
+
'4': 5
|
|
359
367
|
};
|
|
360
368
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
369
|
+
const fanIndex = fanSpeedMap[fanSpeed];
|
|
370
|
+
obj.fanSpeed = 0;
|
|
371
|
+
obj.fanSpeedSetPropsMaxValue = 0;
|
|
372
|
+
|
|
373
|
+
if (typeof fanIndex === 'number') {
|
|
374
|
+
switch (numberOfFanSpeeds) {
|
|
375
|
+
case 2:
|
|
376
|
+
obj.fanSpeed = hasAutomaticFanSpeed ? [3, 1, 2][fanIndex] ?? 1 : [0, 1, 2][fanIndex] ?? 1;
|
|
377
|
+
obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 3 : 2;
|
|
378
|
+
break;
|
|
379
|
+
case 3:
|
|
380
|
+
obj.fanSpeed = hasAutomaticFanSpeed ? [4, 1, 2, 3][fanIndex] ?? 1 : [0, 1, 2, 3][fanIndex] ?? 1;
|
|
381
|
+
obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 4 : 3;
|
|
382
|
+
break;
|
|
383
|
+
case 4:
|
|
384
|
+
obj.fanSpeed = hasAutomaticFanSpeed ? [5, 1, 2, 3, 4][fanIndex] ?? 1 : [0, 1, 2, 3, 4][fanIndex] ?? 1;
|
|
385
|
+
obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 5 : 4;
|
|
386
|
+
break;
|
|
387
|
+
case 5:
|
|
388
|
+
obj.fanSpeed = hasAutomaticFanSpeed ? [6, 1, 2, 3, 4, 5][fanIndex] ?? 1 : [0, 1, 2, 3, 4, 5][fanIndex] ?? 1;
|
|
389
|
+
obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 6 : 5;
|
|
390
|
+
break;
|
|
391
|
+
default:
|
|
392
|
+
this.emit('warn', `Unknown fan speeds: ${numberOfFanSpeeds}`);
|
|
378
393
|
}
|
|
379
|
-
return arr;
|
|
380
|
-
};
|
|
381
394
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
obj.fanSpeed =
|
|
385
|
-
|
|
386
|
-
break;
|
|
387
|
-
case 3:
|
|
388
|
-
obj.fanSpeed = generateSpeedArray(4, hasAutomaticFanSpeed)[fanSpeedIndex];
|
|
389
|
-
obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 4 : 3;
|
|
390
|
-
break;
|
|
391
|
-
case 4:
|
|
392
|
-
obj.fanSpeed = generateSpeedArray(5, hasAutomaticFanSpeed)[fanSpeedIndex];
|
|
393
|
-
obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 5 : 4;
|
|
394
|
-
break;
|
|
395
|
-
case 5:
|
|
396
|
-
obj.fanSpeed = generateSpeedArray(6, hasAutomaticFanSpeed)[fanSpeedIndex];
|
|
397
|
-
obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 6 : 5;
|
|
398
|
-
break;
|
|
399
|
-
default:
|
|
400
|
-
// Fallback for unexpected fan speed count
|
|
401
|
-
obj.fanSpeed = 0;
|
|
402
|
-
obj.fanSpeedSetPropsMaxValue = 0;
|
|
403
|
-
break;
|
|
395
|
+
// Cap value to max
|
|
396
|
+
if (obj.fanSpeed > obj.fanSpeedSetPropsMaxValue) {
|
|
397
|
+
obj.fanSpeed = obj.fanSpeedSetPropsMaxValue;
|
|
398
|
+
}
|
|
404
399
|
}
|
|
405
400
|
}
|
|
406
401
|
|
|
@@ -482,17 +477,19 @@ class MiElHvac extends EventEmitter {
|
|
|
482
477
|
3: () => power && ['cool', 'cool_isee'].includes(operationMode),
|
|
483
478
|
4: () => power && operationMode === 'fan',
|
|
484
479
|
5: () => power && operationMode === 'auto',
|
|
485
|
-
6: () => power && operationMode === 'purify',
|
|
486
480
|
};
|
|
487
481
|
|
|
488
482
|
const vaneHMap = {
|
|
489
|
-
|
|
490
|
-
|
|
483
|
+
10: 'left',
|
|
484
|
+
11: 'left_middle',
|
|
485
|
+
12: 'left_center',
|
|
491
486
|
13: 'center',
|
|
492
|
-
14: '
|
|
493
|
-
15: '
|
|
494
|
-
16: '
|
|
495
|
-
17: '
|
|
487
|
+
14: 'right_center',
|
|
488
|
+
15: 'right_middle',
|
|
489
|
+
16: 'right',
|
|
490
|
+
17: 'split',
|
|
491
|
+
18: 'swing',
|
|
492
|
+
19: 'airdirection',
|
|
496
493
|
};
|
|
497
494
|
|
|
498
495
|
const vaneVMap = {
|
|
@@ -515,10 +512,9 @@ class MiElHvac extends EventEmitter {
|
|
|
515
512
|
};
|
|
516
513
|
|
|
517
514
|
const airDirMap = {
|
|
518
|
-
40:
|
|
519
|
-
41:
|
|
520
|
-
42:
|
|
521
|
-
43: () => power && !['indirect', 'direct', 'even'].includes(airDirection),
|
|
515
|
+
40: 'indirect',
|
|
516
|
+
41: 'direct',
|
|
517
|
+
42: 'even',
|
|
522
518
|
};
|
|
523
519
|
|
|
524
520
|
const prohibitMap = {
|
|
@@ -528,11 +524,25 @@ class MiElHvac extends EventEmitter {
|
|
|
528
524
|
53: 'temp',
|
|
529
525
|
};
|
|
530
526
|
|
|
527
|
+
const functionsMap = {
|
|
528
|
+
60: 'purify', //purify
|
|
529
|
+
61: 'econoCool', //econocool
|
|
530
|
+
62: 'powerFull', //powerfull
|
|
531
|
+
63: 'noghtMode', //nightmode
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
const functionsStateMap = {
|
|
535
|
+
60: 'on', //purify
|
|
536
|
+
61: 'on', //econocool
|
|
537
|
+
62: 'on', //powerfull
|
|
538
|
+
63: 'on', //nightmode
|
|
539
|
+
};
|
|
540
|
+
|
|
531
541
|
this.buttonsConfigured.forEach((button, index) => {
|
|
532
542
|
const mode = button.mode;
|
|
533
543
|
let state = false;
|
|
534
544
|
|
|
535
|
-
if (modeMap[mode]
|
|
545
|
+
if (modeMap[mode]) {
|
|
536
546
|
state = modeMap[mode]();
|
|
537
547
|
} else if (vaneHMap[mode]) {
|
|
538
548
|
state = power && vaneHorizontalDirection === vaneHMap[mode];
|
|
@@ -541,9 +551,11 @@ class MiElHvac extends EventEmitter {
|
|
|
541
551
|
} else if (fanSpeedMap[mode]) {
|
|
542
552
|
state = power && fanSpeed === fanSpeedMap[mode];
|
|
543
553
|
} else if (airDirMap[mode]) {
|
|
544
|
-
state = airDirMap[mode]
|
|
545
|
-
} else if (prohibitMap[mode]
|
|
546
|
-
state = prohibit === prohibitMap[mode];
|
|
554
|
+
state = power && airDirection === airDirMap[mode];
|
|
555
|
+
} else if (prohibitMap[mode]) {
|
|
556
|
+
state = power && prohibit === prohibitMap[mode];
|
|
557
|
+
} else if (stateMap[mode]) {
|
|
558
|
+
state = power && functionsMap[mode] === functionsStateMap[mode];
|
|
547
559
|
} else {
|
|
548
560
|
this.emit('warn', `Unknown button mode: ${mode} detected`);
|
|
549
561
|
}
|
|
@@ -575,15 +587,18 @@ class MiElHvac extends EventEmitter {
|
|
|
575
587
|
3: isOneOf(operationMode, ['cool', 'cool_isee']),
|
|
576
588
|
4: is(operationMode, 'fan'),
|
|
577
589
|
5: is(operationMode, 'auto'),
|
|
578
|
-
6: is(
|
|
590
|
+
6: is(purify, 'on'),
|
|
579
591
|
|
|
580
|
-
|
|
581
|
-
|
|
592
|
+
10: is(vaneHorizontalDirection, 'left'),
|
|
593
|
+
11: is(vaneHorizontalDirection, 'left_middle'),
|
|
594
|
+
12: is(vaneHorizontalDirection, 'left_center'),
|
|
582
595
|
13: is(vaneHorizontalDirection, 'center'),
|
|
583
|
-
14: is(vaneHorizontalDirection, '
|
|
584
|
-
15: is(vaneHorizontalDirection, '
|
|
585
|
-
16: is(vaneHorizontalDirection, '
|
|
586
|
-
17: is(vaneHorizontalDirection, '
|
|
596
|
+
14: is(vaneHorizontalDirection, 'right_center'),
|
|
597
|
+
15: is(vaneHorizontalDirection, 'right_middle'),
|
|
598
|
+
16: is(vaneHorizontalDirection, 'right'),
|
|
599
|
+
17: is(vaneHorizontalDirection, 'split'),
|
|
600
|
+
18: is(vaneHorizontalDirection, 'swing'),
|
|
601
|
+
19: is(vaneHorizontalDirection, 'airdirection'),
|
|
587
602
|
|
|
588
603
|
20: is(vaneVerticalDirection, 'auto'),
|
|
589
604
|
21: is(vaneVerticalDirection, 'up'),
|
|
@@ -605,7 +620,6 @@ class MiElHvac extends EventEmitter {
|
|
|
605
620
|
40: is(airDirection, 'indirect'),
|
|
606
621
|
41: is(airDirection, 'direct'),
|
|
607
622
|
42: is(airDirection, 'even'),
|
|
608
|
-
43: powerOn && !['indirect', 'direct', 'even'].includes(airDirection),
|
|
609
623
|
|
|
610
624
|
50: prohibit === 'all',
|
|
611
625
|
51: prohibit === 'power',
|
|
@@ -614,24 +628,25 @@ class MiElHvac extends EventEmitter {
|
|
|
614
628
|
|
|
615
629
|
60: remoteTemperatureSensorState,
|
|
616
630
|
|
|
617
|
-
70:
|
|
618
|
-
71:
|
|
619
|
-
72:
|
|
620
|
-
73:
|
|
631
|
+
70: operationStatus === 'normal',
|
|
632
|
+
71: operationStatus === 'filter',
|
|
633
|
+
72: operationStatus === 'defrost',
|
|
634
|
+
73: operationStatus === 'standby',
|
|
635
|
+
74: operationStatus === 'preheat',
|
|
621
636
|
|
|
622
|
-
80:
|
|
623
|
-
81:
|
|
624
|
-
82:
|
|
625
|
-
83:
|
|
626
|
-
84:
|
|
627
|
-
85:
|
|
628
|
-
86:
|
|
637
|
+
80: fanSpeedStatus === 'off',
|
|
638
|
+
81: fanSpeedStatus === 'quiet',
|
|
639
|
+
82: fanSpeedStatus === '1',
|
|
640
|
+
83: fanSpeedStatus === '2',
|
|
641
|
+
84: fanSpeedStatus === '3',
|
|
642
|
+
85: fanSpeedStatus === '4',
|
|
643
|
+
86: fanSpeedStatus === '5',
|
|
629
644
|
|
|
630
645
|
90: operationMode !== 'auto',
|
|
631
|
-
91:
|
|
632
|
-
92:
|
|
633
|
-
93:
|
|
634
|
-
94:
|
|
646
|
+
91: operationModeStatus === 'auto_fan',
|
|
647
|
+
92: operationModeStatus === 'auto_heat',
|
|
648
|
+
93: operationModeStatus === 'auto_cool',
|
|
649
|
+
94: operationModeStatus === 'auto_leader',
|
|
635
650
|
};
|
|
636
651
|
|
|
637
652
|
if (mode in sensorStates) {
|
|
@@ -664,12 +679,12 @@ class MiElHvac extends EventEmitter {
|
|
|
664
679
|
if (!this.disableLogInfo) {
|
|
665
680
|
this.emit('info', `Power: ${power ? 'ON' : 'OFF'}`);
|
|
666
681
|
const info = power ? this.emit('info', `Target operation mode: ${operationMode.toUpperCase()}`) : false;
|
|
667
|
-
const info1 = power ? this.emit('info', `Current operation mode: ${
|
|
682
|
+
const info1 = power ? this.emit('info', `Current operation mode: ${operationModeStatus.toUpperCase()}`) : false;
|
|
668
683
|
const info2 = power ? this.emit('info', `Target temperature: ${setTemperature}${temperatureUnit}`) : false;
|
|
669
684
|
const info3 = power ? this.emit('info', `Current temperature: ${roomTemperature}${temperatureUnit}`) : false;
|
|
670
685
|
const info4 = power && outdoorTemperature !== null ? this.emit('info', `Outdoor temperature: ${outdoorTemperature}${temperatureUnit}`) : false;
|
|
671
686
|
const info5 = power && modelSupportsFanSpeed ? this.emit('info', `Target Fan speed: ${fanSpeed.toUpperCase()}`) : false;
|
|
672
|
-
const info6 = power && modelSupportsFanSpeed ? this.emit('info', `Current Fan speed: ${
|
|
687
|
+
const info6 = power && modelSupportsFanSpeed ? this.emit('info', `Current Fan speed: ${fanSpeedStatus.toUpperCase()}`) : false;
|
|
673
688
|
const info7 = power && vaneHorizontalDirection !== 'Unknown' ? this.emit('info', `Vane horizontal: ${MiElHVAC.HorizontalVane[vaneHorizontalDirection] ?? vaneHorizontalDirection}`) : false;
|
|
674
689
|
const info8 = power && vaneVerticalDirection !== 'Unknown' ? this.emit('info', `Vane vertical: ${MiElHVAC.VerticalVane[vaneVerticalDirection] ?? vaneVerticalDirection}`) : false;
|
|
675
690
|
const info9 = power ? this.emit('info', `Swing mode: ${MiElHVAC.SwingMode[swingMode]}`) : false;
|
|
@@ -1058,58 +1073,59 @@ class MiElHvac extends EventEmitter {
|
|
|
1058
1073
|
0: () => state ? MiElHVAC.PowerOn : MiElHVAC.PowerOff,
|
|
1059
1074
|
|
|
1060
1075
|
// Modes
|
|
1061
|
-
1: () =>
|
|
1062
|
-
2: () =>
|
|
1063
|
-
3: () =>
|
|
1064
|
-
4: () =>
|
|
1065
|
-
5: () =>
|
|
1066
|
-
6: () => getModeCommand('purify'),
|
|
1076
|
+
1: () => getCommand('SetMode', 'heat'),
|
|
1077
|
+
2: () => getCommand('SetMode', 'dry'),
|
|
1078
|
+
3: () => getCommand('SetMode', 'cool'),
|
|
1079
|
+
4: () => getCommand('SetMode', 'fan'),
|
|
1080
|
+
5: () => getCommand('SetMode', 'auto'),
|
|
1067
1081
|
|
|
1068
1082
|
// Horizontal Swing
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1083
|
+
10: () => getCommand('SetSwingH', 'left'),
|
|
1084
|
+
11: () => getCommand('SetSwingH', 'left_middle'),
|
|
1085
|
+
12: () => getCommand('SetSwingH', 'left_center'),
|
|
1086
|
+
13: () => getCommand('SetSwingH', 'center'),
|
|
1087
|
+
14: () => getCommand('SetSwingH', 'right_center'),
|
|
1088
|
+
15: () => getCommand('SetSwingH', 'right_middle'),
|
|
1089
|
+
16: () => getCommand('SetSwingH', 'right'),
|
|
1090
|
+
17: () => getCommand('SetSwingH', 'split'),
|
|
1091
|
+
18: () => getCommand('SetSwingH', 'swing'),
|
|
1076
1092
|
|
|
1077
1093
|
// Vertical Swing
|
|
1078
|
-
20: () =>
|
|
1079
|
-
21: () =>
|
|
1080
|
-
22: () =>
|
|
1081
|
-
23: () =>
|
|
1082
|
-
24: () =>
|
|
1083
|
-
25: () =>
|
|
1084
|
-
26: () =>
|
|
1094
|
+
20: () => getCommand('SetSwingV', 'auto'),
|
|
1095
|
+
21: () => getCommand('SetSwingV', 'up'),
|
|
1096
|
+
22: () => getCommand('SetSwingV', 'up_middle'),
|
|
1097
|
+
23: () => getCommand('SetSwingV', 'center'),
|
|
1098
|
+
24: () => getCommand('SetSwingV', 'down_middle'),
|
|
1099
|
+
25: () => getCommand('SetSwingV', 'down'),
|
|
1100
|
+
26: () => getCommand('SetSwingV', 'swing'),
|
|
1085
1101
|
|
|
1086
1102
|
// Fan Speeds
|
|
1087
|
-
30: () =>
|
|
1088
|
-
31: () =>
|
|
1089
|
-
32: () =>
|
|
1090
|
-
33: () =>
|
|
1091
|
-
34: () =>
|
|
1092
|
-
35: () =>
|
|
1103
|
+
30: () => getCommand('SetFanSpeed', 'auto'),
|
|
1104
|
+
31: () => getCommand('SetFanSpeed', 'quiet'),
|
|
1105
|
+
32: () => getCommand('SetFanSpeed', '1'),
|
|
1106
|
+
33: () => getCommand('SetFanSpeed', '2'),
|
|
1107
|
+
34: () => getCommand('SetFanSpeed', '3'),
|
|
1108
|
+
35: () => getCommand('SetFanSpeed', '4'),
|
|
1093
1109
|
|
|
1094
1110
|
// Air Direction
|
|
1095
|
-
40: () =>
|
|
1096
|
-
41: () =>
|
|
1097
|
-
42: () =>
|
|
1098
|
-
43: () => getSwingCommand('SetAirDirection', 'off'),
|
|
1111
|
+
40: () => getCommand('SetAirDirection', 'indirect'),
|
|
1112
|
+
41: () => getCommand('SetAirDirection', 'direct'),
|
|
1113
|
+
42: () => getCommand('SetAirDirection', 'even'),
|
|
1099
1114
|
|
|
1100
1115
|
// Prohibit
|
|
1101
|
-
50: () =>
|
|
1102
|
-
51: () =>
|
|
1103
|
-
52: () =>
|
|
1104
|
-
53: () =>
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1116
|
+
50: () => getCommand('SetProhibit', 'all'),
|
|
1117
|
+
51: () => getCommand('SetProhibit', 'power'),
|
|
1118
|
+
52: () => getCommand('SetProhibit', 'mode'),
|
|
1119
|
+
53: () => getCommand('SetProhibit', 'temp'),
|
|
1120
|
+
|
|
1121
|
+
// Purify
|
|
1122
|
+
60: () => getCommand('SetPurify', 'purify'),
|
|
1123
|
+
61: () => getCommand('SetEconoCool', 'econocool'),
|
|
1124
|
+
62: () => getCommand('SetPowerFull', 'powerfull'),
|
|
1125
|
+
63: () => getCommand('SetNightMode', 'nightmode'),
|
|
1110
1126
|
};
|
|
1111
1127
|
|
|
1112
|
-
const
|
|
1128
|
+
const getCommand = (type, target) => {
|
|
1113
1129
|
const current = this.mielHvac[getCurrentKey(type)];
|
|
1114
1130
|
button.previousValue = state ? MiElHVAC[type][current] : button.previousValue;
|
|
1115
1131
|
return state ? MiElHVAC[type][target] : button.previousValue;
|
|
@@ -1117,11 +1133,16 @@ class MiElHvac extends EventEmitter {
|
|
|
1117
1133
|
|
|
1118
1134
|
const getCurrentKey = (type) => {
|
|
1119
1135
|
switch (type) {
|
|
1136
|
+
case 'SetMode': return 'operationMode';
|
|
1120
1137
|
case 'SetSwingH': return 'vaneHorizontalDirection';
|
|
1121
1138
|
case 'SetSwingV': return 'vaneVerticalDirection';
|
|
1122
1139
|
case 'SetFanSpeed': return 'fanSpeed';
|
|
1123
1140
|
case 'SetAirDirection': return 'airDirection';
|
|
1124
1141
|
case 'SetProhibit': return 'prohibit';
|
|
1142
|
+
case 'SetPurify': return 'purify';
|
|
1143
|
+
case 'SetEconoCool': return 'econoCool';
|
|
1144
|
+
case 'SetPowerFull': return 'powerFull';
|
|
1145
|
+
case 'SetNightMode': return 'nightMode';
|
|
1125
1146
|
default: return '';
|
|
1126
1147
|
}
|
|
1127
1148
|
};
|
|
@@ -1132,7 +1153,7 @@ class MiElHvac extends EventEmitter {
|
|
|
1132
1153
|
}
|
|
1133
1154
|
|
|
1134
1155
|
data = mappings[mode]();
|
|
1135
|
-
if (!this.mielHvac.power && state && mode > 0 && mode
|
|
1156
|
+
if (!this.mielHvac.power && state && mode > 0 && mode <= 63) {
|
|
1136
1157
|
await this.axiosInstance(MiElHVAC.PowerOn);
|
|
1137
1158
|
}
|
|
1138
1159
|
|
|
@@ -1231,7 +1252,8 @@ class MiElHvac extends EventEmitter {
|
|
|
1231
1252
|
async start() {
|
|
1232
1253
|
try {
|
|
1233
1254
|
//check device state
|
|
1234
|
-
await this.checkDeviceState();
|
|
1255
|
+
const checkState = await this.checkDeviceState();
|
|
1256
|
+
if (!checkState) return null;
|
|
1235
1257
|
|
|
1236
1258
|
//connect to deice success
|
|
1237
1259
|
this.emit('success', `Connect Success`)
|