homebridge-tasmota-control 1.6.15-beta.3 → 1.6.15-beta.30
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 +42 -62
- package/package.json +1 -1
- package/src/constants.js +23 -9
- package/src/deviceinfo.js +4 -5
- package/src/fans.js +59 -67
- package/src/impulsegenerator.js +12 -10
- package/src/lights.js +43 -51
- package/src/mielhvac.js +248 -228
- package/src/sensors.js +59 -67
- package/src/switches.js +30 -38
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
|
@@ -33,9 +33,7 @@ class tasmotaPlatform {
|
|
|
33
33
|
|
|
34
34
|
//check accessory is enabled
|
|
35
35
|
const disableAccessory = device.disableAccessory || false;
|
|
36
|
-
if (disableAccessory)
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
36
|
+
if (disableAccessory) continue;
|
|
39
37
|
|
|
40
38
|
const deviceName = device.name;
|
|
41
39
|
const host = device.host;
|
|
@@ -52,34 +50,29 @@ class tasmotaPlatform {
|
|
|
52
50
|
const loadNameFromDevice = device.loadNameFromDevice || false;
|
|
53
51
|
const refreshInterval = device.refreshInterval * 1000 || 5000;
|
|
54
52
|
const enableDebugMode = device.enableDebugMode || false;
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
const logLevel = {
|
|
54
|
+
debug: device.enableDebugMode,
|
|
55
|
+
info: !device.disableLogInfo,
|
|
56
|
+
success: !device.disableLogSuccess,
|
|
57
|
+
warn: !device.disableLogWarn,
|
|
58
|
+
error: !device.disableLogError,
|
|
59
|
+
devInfo: !device.disableLogDeviceInfo,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
if (logLevel.debug) log.info(`Device: ${host} ${deviceName}, debug: Did finish launching.`);
|
|
61
63
|
const newConfig = {
|
|
62
64
|
...device,
|
|
63
65
|
user: 'removed',
|
|
64
66
|
passwd: 'removed'
|
|
65
67
|
};
|
|
66
|
-
|
|
68
|
+
if (logLevel.debug) log.info(`Device: ${host} ${deviceName}, Config: ${JSON.stringify(newConfig, null, 2)}.`);
|
|
67
69
|
|
|
68
70
|
try {
|
|
69
71
|
//get device info
|
|
70
|
-
const deviceInfo = new DeviceInfo(url, auth, user, passwd, deviceName, loadNameFromDevice, enableDebugMode
|
|
71
|
-
.on('debug', (
|
|
72
|
-
|
|
73
|
-
})
|
|
74
|
-
.on('debug', (debug) => {
|
|
75
|
-
const emitLog = !enableDebugMode ? false : log.info(`Device: ${host} ${deviceName}, debug: ${debug}.`);
|
|
76
|
-
})
|
|
77
|
-
.on('warn', (warn) => {
|
|
78
|
-
const emitLog = disableLogWarn ? false : log.warn(`Device: ${host} ${deviceName}, ${warn}.`);
|
|
79
|
-
})
|
|
80
|
-
.on('error', (error) => {
|
|
81
|
-
const emitLog = disableLogError ? false : log.error(`Device: ${host} ${deviceName}, ${error}.`);
|
|
82
|
-
});
|
|
72
|
+
const deviceInfo = new DeviceInfo(url, auth, user, passwd, deviceName, loadNameFromDevice, enableDebugMode)
|
|
73
|
+
.on('debug', (msg) => logLevel.debug && log.info(`Device: ${host} ${deviceName}, debug: ${msg}`))
|
|
74
|
+
.on('warn', (msg) => logLevel.warn && log.warn(`Device: ${host} ${deviceName}, ${msg}`))
|
|
75
|
+
.on('error', (msg) => logLevel.error && log.error(`Device: ${host} ${deviceName}, ${msg}`));
|
|
83
76
|
|
|
84
77
|
const info = await deviceInfo.getInfo();
|
|
85
78
|
if (!info.serialNumber) {
|
|
@@ -111,7 +104,7 @@ class tasmotaPlatform {
|
|
|
111
104
|
}
|
|
112
105
|
});
|
|
113
106
|
} catch (error) {
|
|
114
|
-
log.error(`Device: ${host} ${deviceName}, Prepare files error: ${error}`);
|
|
107
|
+
if (logLevel.error) log.error(`Device: ${host} ${deviceName}, Prepare files error: ${error}`);
|
|
115
108
|
return;
|
|
116
109
|
}
|
|
117
110
|
|
|
@@ -130,55 +123,42 @@ class tasmotaPlatform {
|
|
|
130
123
|
deviceType = new Sensors(api, device, info, serialNumber, refreshInterval);
|
|
131
124
|
break;
|
|
132
125
|
default:
|
|
133
|
-
|
|
126
|
+
if (logLevel.warn) log.warn(`Device: ${host} ${deviceName}, unknown device: ${info.deviceTypes}.`);
|
|
134
127
|
return;
|
|
135
128
|
}
|
|
136
129
|
|
|
137
|
-
deviceType.on('
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
.on('
|
|
142
|
-
|
|
143
|
-
})
|
|
144
|
-
.on('success', (success) => {
|
|
145
|
-
const emitLog = disableLogSuccess ? false : log.success(`Device: ${host} ${deviceName}, ${success}.`);
|
|
146
|
-
})
|
|
147
|
-
.on('info', (info) => {
|
|
148
|
-
const emitLog = disableLogInfo ? false : log.info(`Device: ${host} ${deviceName}, ${info}.`);
|
|
149
|
-
})
|
|
150
|
-
.on('debug', (debug) => {
|
|
151
|
-
const emitLog = !enableDebugMode ? false : log.info(`Device: ${host} ${deviceName}, debug: ${debug}.`);
|
|
152
|
-
})
|
|
153
|
-
.on('warn', (warn) => {
|
|
154
|
-
const emitLog = disableLogWarn ? false : log.warn(`Device: ${host} ${deviceName}, ${warn}.`);
|
|
155
|
-
})
|
|
156
|
-
.on('error', (error) => {
|
|
157
|
-
const emitLog = disableLogError ? false : log.error(`Device: ${host} ${deviceName}, ${error}.`);
|
|
158
|
-
});
|
|
130
|
+
deviceType.on('devInfo', (msg) => logLevel.devInfo && log.info(msg))
|
|
131
|
+
.on('success', (msg) => logLevel.success && log.success(`Device: ${host} ${deviceName}, ${msg}`))
|
|
132
|
+
.on('info', (msg) => logLevel.info && log.info(`Device: ${host} ${deviceName}, ${msg}`))
|
|
133
|
+
.on('debug', (msg) => logLevel.debug && log.info(`Device: ${host} ${deviceName}, debug: ${msg}`))
|
|
134
|
+
.on('warn', (msg) => logLevel.warn && log.warn(`Device: ${host} ${deviceName}, ${msg}`))
|
|
135
|
+
.on('error', (msg) => logLevel.error && log.error(`Device: ${host} ${deviceName}, ${msg}`));
|
|
159
136
|
|
|
160
137
|
//create impulse generator
|
|
161
|
-
const impulseGenerator = new ImpulseGenerator()
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
138
|
+
const impulseGenerator = new ImpulseGenerator()
|
|
139
|
+
.on('start', async () => {
|
|
140
|
+
try {
|
|
141
|
+
const accessory = await deviceType.start()
|
|
142
|
+
if (accessory) {
|
|
143
|
+
api.publishExternalAccessories(PluginName, [accessory]);
|
|
144
|
+
if (logLevel.success) log.success(`Device: ${host} ${deviceName}, Published as external accessory.`);
|
|
145
|
+
|
|
146
|
+
await impulseGenerator.stop();
|
|
147
|
+
await deviceType.startImpulseGenerator();
|
|
148
|
+
}
|
|
149
|
+
} catch (error) {
|
|
150
|
+
if (logLevel.error) log.error(`Device: ${host} ${deviceName}, ${error}, trying again.`);
|
|
151
|
+
}
|
|
152
|
+
}).on('state', (state) => {
|
|
153
|
+
if (logLevel.debug) log.info(`Device: ${host} ${deviceName}, Start impulse generator ${state ? 'started' : 'stopped'}.`);
|
|
154
|
+
});
|
|
175
155
|
|
|
176
156
|
//start impulse generator
|
|
177
157
|
await impulseGenerator.start([{ name: 'start', sampling: 45000 }]);
|
|
178
158
|
i++;
|
|
179
159
|
}
|
|
180
160
|
} catch (error) {
|
|
181
|
-
|
|
161
|
+
if (logLevel.error) log.error(`Device: ${host} ${deviceName}, Did finish launching error: ${error}.`);
|
|
182
162
|
}
|
|
183
163
|
}
|
|
184
164
|
});
|
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,8 +83,20 @@ export const MiElHVAC = {
|
|
|
83
83
|
"c": "HVACSetDisplayUnit%20c",
|
|
84
84
|
"f": "HVACSetDisplayUnit%20f"
|
|
85
85
|
},
|
|
86
|
-
"
|
|
87
|
-
|
|
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
|
+
},
|
|
98
|
+
"SetRemoteTemp": "HVACSetRemoteTemp%20",
|
|
99
|
+
"SetRemoteTempClearTime": "HVACSetRemoteTempClearTime%20",
|
|
88
100
|
"OperationMode": [
|
|
89
101
|
"AUTO",
|
|
90
102
|
"HEAT",
|
|
@@ -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/deviceinfo.js
CHANGED
|
@@ -3,7 +3,7 @@ import EventEmitter from 'events';
|
|
|
3
3
|
import { ApiCommands, LightKeys, SensorKeys } from './constants.js';
|
|
4
4
|
|
|
5
5
|
class DeviceInfo extends EventEmitter {
|
|
6
|
-
constructor(url, auth, user, passwd, deviceName, loadNameFromDevice, enableDebugMode
|
|
6
|
+
constructor(url, auth, user, passwd, deviceName, loadNameFromDevice, enableDebugMode) {
|
|
7
7
|
super();
|
|
8
8
|
this.name = deviceName
|
|
9
9
|
this.loadNameFromDevice = loadNameFromDevice;
|
|
@@ -11,7 +11,6 @@ class DeviceInfo extends EventEmitter {
|
|
|
11
11
|
|
|
12
12
|
//axios instance
|
|
13
13
|
this.axiosInstance = axios.create({
|
|
14
|
-
method: 'GET',
|
|
15
14
|
baseURL: url,
|
|
16
15
|
timeout: 10000,
|
|
17
16
|
withCredentials: auth,
|
|
@@ -24,11 +23,11 @@ class DeviceInfo extends EventEmitter {
|
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
async getInfo() {
|
|
27
|
-
|
|
26
|
+
if (this.enableDebugMode) this.emit('debug', `Requesting info`);
|
|
28
27
|
try {
|
|
29
|
-
const deviceInfoData = await this.axiosInstance(ApiCommands.Status);
|
|
28
|
+
const deviceInfoData = await this.axiosInstance.get(ApiCommands.Status);
|
|
30
29
|
const deviceInfo = deviceInfoData.data ?? {};
|
|
31
|
-
|
|
30
|
+
if (this.enableDebugMode) this.emit('debug', `Info: ${JSON.stringify(deviceInfo, null, 2)}`);
|
|
32
31
|
await new Promise(resolve => setTimeout(resolve, 250));
|
|
33
32
|
|
|
34
33
|
//status
|