homebridge-melcloud-control 3.1.16 → 3.1.18
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 +3 -3
- package/package.json +1 -1
- package/src/deviceata.js +212 -231
- package/src/deviceatw.js +12 -21
- package/src/deviceerv.js +84 -98
package/config.schema.json
CHANGED
|
@@ -237,8 +237,8 @@
|
|
|
237
237
|
"title": "Control",
|
|
238
238
|
"type": "integer",
|
|
239
239
|
"minimum": 0,
|
|
240
|
-
"maximum":
|
|
241
|
-
"default":
|
|
240
|
+
"maximum": 2,
|
|
241
|
+
"default": 1,
|
|
242
242
|
"oneOf": [
|
|
243
243
|
{
|
|
244
244
|
"title": "None/Disabled",
|
|
@@ -255,7 +255,7 @@
|
|
|
255
255
|
{
|
|
256
256
|
"title": "Thermostat",
|
|
257
257
|
"enum": [
|
|
258
|
-
|
|
258
|
+
2
|
|
259
259
|
]
|
|
260
260
|
}
|
|
261
261
|
],
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "3.1.
|
|
4
|
+
"version": "3.1.18",
|
|
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
|
@@ -236,8 +236,8 @@ class DeviceAta extends EventEmitter {
|
|
|
236
236
|
const setTemperature = deviceData.Device.SetTemperature;
|
|
237
237
|
const fanSpeed = deviceData.Device.FanSpeed;
|
|
238
238
|
const operationMode = deviceData.Device.OperationMode;
|
|
239
|
-
const
|
|
240
|
-
const
|
|
239
|
+
const vaneHorizontalDirection = deviceData.Device.VaneHorizontalDirection;
|
|
240
|
+
const VaneVerticalDirection = deviceData.Device.VaneVerticalDirection;
|
|
241
241
|
const hideVaneControls = deviceData.Device.HideVaneControls;
|
|
242
242
|
const hideDryModeControl = deviceData.Device.HideDryModeControl;
|
|
243
243
|
const prohibitSetTemperature = deviceData.Device.ProhibitSetTemperature ?? false;
|
|
@@ -252,9 +252,9 @@ class DeviceAta extends EventEmitter {
|
|
|
252
252
|
this.accessory.outdoorTemperature = outdoorTemperature;
|
|
253
253
|
this.accessory.setTemperature = setTemperature;
|
|
254
254
|
this.accessory.fanSpeed = fanSpeed;
|
|
255
|
-
this.accessory.vaneHorizontal =
|
|
256
|
-
this.accessory.vaneVertical =
|
|
257
|
-
this.accessory.swingMode = swingFunction &&
|
|
255
|
+
this.accessory.vaneHorizontal = vaneHorizontalDirection;
|
|
256
|
+
this.accessory.vaneVertical = VaneVerticalDirection;
|
|
257
|
+
this.accessory.swingMode = swingFunction && vaneHorizontalDirection === 12 && VaneVerticalDirection === 7 ? 1 : 0;
|
|
258
258
|
this.accessory.lockPhysicalControl = prohibitSetTemperature && prohibitOperationMode && prohibitPower ? 1 : 0;
|
|
259
259
|
this.accessory.temperatureIncrement = temperatureIncrement;
|
|
260
260
|
this.accessory.useFahrenheit = this.useFahrenheit;
|
|
@@ -459,8 +459,8 @@ class DeviceAta extends EventEmitter {
|
|
|
459
459
|
preset.state = presetData ? (presetData.Power === power
|
|
460
460
|
&& presetData.SetTemperature === setTemperature
|
|
461
461
|
&& presetData.OperationMode === operationMode
|
|
462
|
-
&& presetData.VaneHorizontal ===
|
|
463
|
-
&& presetData.VaneVertical ===
|
|
462
|
+
&& presetData.VaneHorizontal === vaneHorizontalDirection
|
|
463
|
+
&& presetData.VaneVertical === VaneVerticalDirection
|
|
464
464
|
&& presetData.FanSpeed === fanSpeed) : false;
|
|
465
465
|
|
|
466
466
|
if (this.presetsServices) {
|
|
@@ -502,49 +502,49 @@ class DeviceAta extends EventEmitter {
|
|
|
502
502
|
button.state = power ? (hideDryModeControl === true) : false;
|
|
503
503
|
break;
|
|
504
504
|
case 10: //VANE H SWING MODE AUTO
|
|
505
|
-
button.state = power ? (
|
|
505
|
+
button.state = power ? (vaneHorizontalDirection === 0) : false;
|
|
506
506
|
break;
|
|
507
507
|
case 11: //VANE H SWING MODE 1
|
|
508
|
-
button.state = power ? (
|
|
508
|
+
button.state = power ? (vaneHorizontalDirection === 1) : false;
|
|
509
509
|
break;
|
|
510
510
|
case 12: //VANE H SWING MODE 2
|
|
511
|
-
button.state = power ? (
|
|
511
|
+
button.state = power ? (vaneHorizontalDirection === 2) : false;
|
|
512
512
|
break;
|
|
513
513
|
case 13: //VANE H SWING MODE 3
|
|
514
|
-
button.state = power ? (
|
|
514
|
+
button.state = power ? (vaneHorizontalDirection === 3) : false;
|
|
515
515
|
break;
|
|
516
516
|
case 14: //VANE H SWING MODE 4
|
|
517
|
-
button.state = power ? (
|
|
517
|
+
button.state = power ? (vaneHorizontalDirection === 4) : false;
|
|
518
518
|
break;
|
|
519
519
|
case 15: //VANE H SWING MODE 5
|
|
520
|
-
button.state = power ? (
|
|
520
|
+
button.state = power ? (vaneHorizontalDirection === 5) : false;
|
|
521
521
|
break;
|
|
522
522
|
case 16: //VANE H SWING MODE SPLIT
|
|
523
|
-
button.state = power ? (
|
|
523
|
+
button.state = power ? (vaneHorizontalDirection === 8) : false;
|
|
524
524
|
break;
|
|
525
525
|
case 17: //VANE H SWING MODE SWING
|
|
526
|
-
button.state = power ? (
|
|
526
|
+
button.state = power ? (vaneHorizontalDirection === 12) : false;
|
|
527
527
|
break;
|
|
528
528
|
case 20: //VANE V SWING MODE AUTO
|
|
529
|
-
button.state = power ? (
|
|
529
|
+
button.state = power ? (VaneVerticalDirection === 0) : false;
|
|
530
530
|
break;
|
|
531
531
|
case 21: //VANE V SWING MODE 1
|
|
532
|
-
button.state = power ? (
|
|
532
|
+
button.state = power ? (VaneVerticalDirection === 1) : false;
|
|
533
533
|
break;
|
|
534
534
|
case 22: //VANE V SWING MODE 2
|
|
535
|
-
button.state = power ? (
|
|
535
|
+
button.state = power ? (VaneVerticalDirection === 2) : false;
|
|
536
536
|
break;
|
|
537
537
|
case 23: //VANE V SWING MODE 3
|
|
538
|
-
button.state = power ? (
|
|
538
|
+
button.state = power ? (VaneVerticalDirection === 3) : false;
|
|
539
539
|
break;
|
|
540
540
|
case 24: //VANE V SWING MODE 4
|
|
541
|
-
button.state = power ? (
|
|
541
|
+
button.state = power ? (VaneVerticalDirection === 4) : false;
|
|
542
542
|
break;
|
|
543
543
|
case 25: //VANE V SWING MODE 5
|
|
544
|
-
button.state = power ? (
|
|
544
|
+
button.state = power ? (VaneVerticalDirection === 5) : false;
|
|
545
545
|
break;
|
|
546
546
|
case 26: //VANE V SWING MODE SWING
|
|
547
|
-
button.state = power ? (
|
|
547
|
+
button.state = power ? (VaneVerticalDirection === 7) : false;
|
|
548
548
|
break;
|
|
549
549
|
case 27: //VANE H/V CONTROLS HIDE
|
|
550
550
|
button.state = power ? (hideVaneControls === true) : false;
|
|
@@ -821,6 +821,11 @@ class DeviceAta extends EventEmitter {
|
|
|
821
821
|
this.emit('warn', `Set operation mode error: ${error}`);
|
|
822
822
|
};
|
|
823
823
|
});
|
|
824
|
+
this.melCloudService.getCharacteristic(Characteristic.CurrentTemperature)
|
|
825
|
+
.onGet(async () => {
|
|
826
|
+
const value = this.accessory.roomTemperature;
|
|
827
|
+
return value;
|
|
828
|
+
});
|
|
824
829
|
if (modelSupportsFanSpeed) {
|
|
825
830
|
this.melCloudService.getCharacteristic(Characteristic.RotationSpeed)
|
|
826
831
|
.setProps({
|
|
@@ -885,16 +890,6 @@ class DeviceAta extends EventEmitter {
|
|
|
885
890
|
};
|
|
886
891
|
});
|
|
887
892
|
};
|
|
888
|
-
this.melCloudService.getCharacteristic(Characteristic.CurrentTemperature)
|
|
889
|
-
.setProps({
|
|
890
|
-
minValue: -35,
|
|
891
|
-
maxValue: 150,
|
|
892
|
-
minStep: 0.5
|
|
893
|
-
})
|
|
894
|
-
.onGet(async () => {
|
|
895
|
-
const value = this.accessory.roomTemperature;
|
|
896
|
-
return value;
|
|
897
|
-
});
|
|
898
893
|
this.melCloudService.getCharacteristic(Characteristic.HeatingThresholdTemperature)
|
|
899
894
|
.setProps({
|
|
900
895
|
minValue: 0,
|
|
@@ -971,7 +966,7 @@ class DeviceAta extends EventEmitter {
|
|
|
971
966
|
break;
|
|
972
967
|
case 2: //Thermostat
|
|
973
968
|
const debug1 = this.enableDebugMode ? this.emit('debug', `Prepare thermostat service`) : false;
|
|
974
|
-
this.melCloudService =
|
|
969
|
+
this.melCloudService = new Service.Thermostat(serviceName, `Thermostat ${deviceId}`);
|
|
975
970
|
this.melCloudService.getCharacteristic(Characteristic.CurrentHeatingCoolingState)
|
|
976
971
|
.onGet(async () => {
|
|
977
972
|
const value = this.accessory.currentOperationMode;;
|
|
@@ -1019,11 +1014,6 @@ class DeviceAta extends EventEmitter {
|
|
|
1019
1014
|
};
|
|
1020
1015
|
});
|
|
1021
1016
|
this.melCloudService.getCharacteristic(Characteristic.CurrentTemperature)
|
|
1022
|
-
.setProps({
|
|
1023
|
-
minValue: -35,
|
|
1024
|
-
maxValue: 150,
|
|
1025
|
-
minStep: 0.5
|
|
1026
|
-
})
|
|
1027
1017
|
.onGet(async () => {
|
|
1028
1018
|
const value = this.accessory.roomTemperature;
|
|
1029
1019
|
return value;
|
|
@@ -1062,6 +1052,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1062
1052
|
this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
1063
1053
|
};
|
|
1064
1054
|
});
|
|
1055
|
+
accessory.addService(this.melCloudService);
|
|
1065
1056
|
break;
|
|
1066
1057
|
};
|
|
1067
1058
|
|
|
@@ -1115,9 +1106,6 @@ class DeviceAta extends EventEmitter {
|
|
|
1115
1106
|
//get preset name
|
|
1116
1107
|
const presetName = preset.name;
|
|
1117
1108
|
|
|
1118
|
-
//get preset display type
|
|
1119
|
-
const displayType = button.displayType;
|
|
1120
|
-
|
|
1121
1109
|
//get preset name prefix
|
|
1122
1110
|
const presetNamePrefix = preset.namePrefix;
|
|
1123
1111
|
|
|
@@ -1131,9 +1119,8 @@ class DeviceAta extends EventEmitter {
|
|
|
1131
1119
|
.onGet(async () => {
|
|
1132
1120
|
const state = preset.state;
|
|
1133
1121
|
return state;
|
|
1134
|
-
})
|
|
1135
|
-
|
|
1136
|
-
presetService.onSet(async (state) => {
|
|
1122
|
+
})
|
|
1123
|
+
.onSet(async (state) => {
|
|
1137
1124
|
try {
|
|
1138
1125
|
switch (state) {
|
|
1139
1126
|
case true:
|
|
@@ -1141,9 +1128,9 @@ class DeviceAta extends EventEmitter {
|
|
|
1141
1128
|
deviceData.Device.SetTemperature = presetData.SetTemperature;
|
|
1142
1129
|
deviceData.Device.Power = presetData.Power;
|
|
1143
1130
|
deviceData.Device.OperationMode = presetData.OperationMode;
|
|
1144
|
-
deviceData.Device.
|
|
1145
|
-
deviceData.Device.
|
|
1146
|
-
deviceData.Device.
|
|
1131
|
+
deviceData.Device.VaneHorizontalDirection = presetData.VaneHorizontal;
|
|
1132
|
+
deviceData.Device.VaneVerticalDirection = presetData.VaneVertical;
|
|
1133
|
+
deviceData.Device.FanSpeed = presetData.FanSpeed;
|
|
1147
1134
|
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power;
|
|
1148
1135
|
break;
|
|
1149
1136
|
case false:
|
|
@@ -1157,7 +1144,6 @@ class DeviceAta extends EventEmitter {
|
|
|
1157
1144
|
this.emit('warn', `Set preset error: ${error}`);
|
|
1158
1145
|
};
|
|
1159
1146
|
});
|
|
1160
|
-
};
|
|
1161
1147
|
previousPresets.push(deviceData.Device);
|
|
1162
1148
|
this.presetsServices.push(presetService);
|
|
1163
1149
|
accessory.addService(presetService);
|
|
@@ -1175,9 +1161,6 @@ class DeviceAta extends EventEmitter {
|
|
|
1175
1161
|
//get button mode
|
|
1176
1162
|
const mode = button.mode;
|
|
1177
1163
|
|
|
1178
|
-
//get button display type
|
|
1179
|
-
const displayType = button.displayType;
|
|
1180
|
-
|
|
1181
1164
|
//get button name
|
|
1182
1165
|
const buttonName = button.name;
|
|
1183
1166
|
|
|
@@ -1196,187 +1179,185 @@ class DeviceAta extends EventEmitter {
|
|
|
1196
1179
|
return state;
|
|
1197
1180
|
})
|
|
1198
1181
|
.onSet(async (state) => {
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
break;
|
|
1373
|
-
};
|
|
1374
|
-
|
|
1375
|
-
await this.melCloudAta.send(deviceData);
|
|
1376
|
-
const info = this.disableLogInfo ? false : this.emit('message', `Set: ${buttonName}`);
|
|
1377
|
-
} catch (error) {
|
|
1378
|
-
this.emit('warn', `Set button error: ${error}`);
|
|
1182
|
+
try {
|
|
1183
|
+
switch (mode) {
|
|
1184
|
+
case 0: //POWER ON,OFF
|
|
1185
|
+
deviceData.Device.Power = state;
|
|
1186
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power;
|
|
1187
|
+
break;
|
|
1188
|
+
case 1: //OPERATING MODE HEAT
|
|
1189
|
+
deviceData.Device.Power = true;
|
|
1190
|
+
deviceData.Device.OperationMode = 1;
|
|
1191
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
1192
|
+
break;
|
|
1193
|
+
case 2: //OPERATING MODE DRY
|
|
1194
|
+
deviceData.Device.Power = true;
|
|
1195
|
+
deviceData.Device.OperationMode = 2;
|
|
1196
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
1197
|
+
break
|
|
1198
|
+
case 3: //OPERATING MODE COOL
|
|
1199
|
+
deviceData.Device.Power = true;
|
|
1200
|
+
deviceData.Device.OperationMode = 3;
|
|
1201
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
1202
|
+
break;
|
|
1203
|
+
case 4: //OPERATING MODE FAN
|
|
1204
|
+
deviceData.Device.Power = true;
|
|
1205
|
+
deviceData.Device.OperationMode = 7;
|
|
1206
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
1207
|
+
break;
|
|
1208
|
+
case 5: //OPERATING MODE AUTO
|
|
1209
|
+
deviceData.Device.Power = true;
|
|
1210
|
+
deviceData.Device.OperationMode = 8;
|
|
1211
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
1212
|
+
break;
|
|
1213
|
+
case 6: //OPERATING MODE PURIFY
|
|
1214
|
+
deviceData.Device.Power = true;
|
|
1215
|
+
deviceData.Device.OperationMode = 9;
|
|
1216
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
1217
|
+
break;
|
|
1218
|
+
case 7: //OPERATING MODE DRY CONTROL HIDE
|
|
1219
|
+
deviceData.Device.HideDryModeControl = state;
|
|
1220
|
+
break;
|
|
1221
|
+
case 10: //VANE H SWING MODE AUTO
|
|
1222
|
+
deviceData.Device.Power = true;
|
|
1223
|
+
deviceData.Device.VaneHorizontalDirection = 0;
|
|
1224
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
1225
|
+
break;
|
|
1226
|
+
case 11: //VANE H SWING MODE 1
|
|
1227
|
+
deviceData.Device.Power = true;
|
|
1228
|
+
deviceData.Device.VaneHorizontalDirection = 1;
|
|
1229
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
1230
|
+
break;
|
|
1231
|
+
case 12: //VANE H SWING MODE 2
|
|
1232
|
+
deviceData.Device.Power = true;
|
|
1233
|
+
deviceData.Device.VaneHorizontalDirection = 2;
|
|
1234
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
1235
|
+
break;
|
|
1236
|
+
case 13: //VANE H SWING MODE 3
|
|
1237
|
+
deviceData.Device.Power = true;
|
|
1238
|
+
deviceData.Device.VaneHorizontalDirection = 3;
|
|
1239
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
1240
|
+
break;
|
|
1241
|
+
case 14: //VANE H SWING MODE 4
|
|
1242
|
+
deviceData.Device.Power = true;
|
|
1243
|
+
deviceData.Device.VaneHorizontalDirection = 4;
|
|
1244
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
1245
|
+
break;
|
|
1246
|
+
case 15: //VANE H SWING MODE 5
|
|
1247
|
+
deviceData.Device.Power = true;
|
|
1248
|
+
deviceData.Device.VaneHorizontalDirection = 5;
|
|
1249
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
1250
|
+
break;
|
|
1251
|
+
case 16: //VANE H SWING MODE SPLIT
|
|
1252
|
+
deviceData.Device.Power = true;
|
|
1253
|
+
deviceData.Device.VaneHorizontalDirection = 8;
|
|
1254
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
1255
|
+
break;
|
|
1256
|
+
case 17: //VANE H SWING MODE SWING
|
|
1257
|
+
deviceData.Device.Power = true;
|
|
1258
|
+
deviceData.Device.VaneHorizontalDirection = 12;
|
|
1259
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
1260
|
+
break;
|
|
1261
|
+
case 20: //VANE V SWING MODE AUTO
|
|
1262
|
+
deviceData.Device.Power = true;
|
|
1263
|
+
deviceData.Device.VaneVerticalDirection = 0;
|
|
1264
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
1265
|
+
break;
|
|
1266
|
+
case 21: //VANE V SWING MODE 1
|
|
1267
|
+
deviceData.Device.Power = true;
|
|
1268
|
+
deviceData.Device.VaneVerticalDirection = 1;
|
|
1269
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
1270
|
+
break;
|
|
1271
|
+
case 22: //VANE V SWING MODE 2
|
|
1272
|
+
deviceData.Device.Power = true;
|
|
1273
|
+
deviceData.Device.VaneVerticalDirection = 2;
|
|
1274
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
1275
|
+
break;
|
|
1276
|
+
case 23: //VANE V SWING MODE 3
|
|
1277
|
+
deviceData.Device.Power = true;
|
|
1278
|
+
deviceData.Device.VaneVerticalDirection = 3;
|
|
1279
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
1280
|
+
break;
|
|
1281
|
+
case 24: //VANE V SWING MODE 4
|
|
1282
|
+
deviceData.Device.Power = true;
|
|
1283
|
+
deviceData.Device.VaneVerticalDirection = 4;
|
|
1284
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
1285
|
+
break;
|
|
1286
|
+
case 25: //VANE V SWING MODE 5
|
|
1287
|
+
deviceData.Device.Power = true;
|
|
1288
|
+
deviceData.Device.VaneVerticalDirection = 5;
|
|
1289
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
1290
|
+
break;
|
|
1291
|
+
case 26: //VANE V SWING MODE SWING
|
|
1292
|
+
deviceData.Device.Power = true;
|
|
1293
|
+
deviceData.Device.VaneVerticalDirection = 7;
|
|
1294
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
1295
|
+
break;
|
|
1296
|
+
case 27: //VANE H/V CONTROLS HIDE
|
|
1297
|
+
deviceData.Device.HideVaneControls = state;
|
|
1298
|
+
break;
|
|
1299
|
+
case 30: //FAN SPEED MODE AUTO
|
|
1300
|
+
deviceData.Device.Power = true;
|
|
1301
|
+
deviceData.Device.FanSpeed = 0;
|
|
1302
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
1303
|
+
break;
|
|
1304
|
+
case 31: //FAN SPEED MODE 1
|
|
1305
|
+
deviceData.Device.Power = true;
|
|
1306
|
+
deviceData.Device.FanSpeed = 1;
|
|
1307
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
1308
|
+
break;
|
|
1309
|
+
case 32: //FAN SPEED MODE 2
|
|
1310
|
+
deviceData.Device.Power = true;
|
|
1311
|
+
deviceData.Device.FanSpeed = 2;
|
|
1312
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
1313
|
+
break;
|
|
1314
|
+
case 33: //FAN SPEED MODE 3
|
|
1315
|
+
deviceData.Device.Power = true;
|
|
1316
|
+
deviceData.Device.FanSpeed = 3;
|
|
1317
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
1318
|
+
break;
|
|
1319
|
+
case 34: //FAN MODE 4
|
|
1320
|
+
deviceData.Device.Power = true;
|
|
1321
|
+
deviceData.Device.FanSpeed = 4;
|
|
1322
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
1323
|
+
break;
|
|
1324
|
+
case 35: //FAN SPEED MODE 5
|
|
1325
|
+
deviceData.Device.Power = true;
|
|
1326
|
+
deviceData.Device.FanSpeed = 5;
|
|
1327
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
1328
|
+
break;
|
|
1329
|
+
case 36: //FAN SPEED MODE 6
|
|
1330
|
+
deviceData.Device.Power = true;
|
|
1331
|
+
deviceData.Device.FanSpeed = 6;
|
|
1332
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
1333
|
+
break;
|
|
1334
|
+
case 37: //PHYSICAL LOCK CONTROLS
|
|
1335
|
+
deviceData.Device.ProhibitSetTemperature = state;
|
|
1336
|
+
deviceData.Device.ProhibitOperationMode = state;
|
|
1337
|
+
deviceData.Device.ProhibitPower = state;
|
|
1338
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Prohibit;
|
|
1339
|
+
break;
|
|
1340
|
+
case 38: //PHYSICAL LOCK CONTROLS POWER
|
|
1341
|
+
deviceData.Device.ProhibitPower = state;
|
|
1342
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Prohibit;
|
|
1343
|
+
break;
|
|
1344
|
+
case 39: //PHYSICAL LOCK CONTROLS MODE
|
|
1345
|
+
deviceData.Device.ProhibitOperationMode = state;
|
|
1346
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Prohibit;
|
|
1347
|
+
break;
|
|
1348
|
+
case 40: //PHYSICAL LOCK CONTROLS TEMP
|
|
1349
|
+
deviceData.Device.ProhibitSetTemperature = state;
|
|
1350
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Prohibit;
|
|
1351
|
+
break;
|
|
1352
|
+
default:
|
|
1353
|
+
this.emit('message', `Unknown button mode: ${mode}`);
|
|
1354
|
+
break;
|
|
1379
1355
|
};
|
|
1356
|
+
|
|
1357
|
+
await this.melCloudAta.send(deviceData);
|
|
1358
|
+
const info = this.disableLogInfo ? false : this.emit('message', `Set: ${buttonName}`);
|
|
1359
|
+
} catch (error) {
|
|
1360
|
+
this.emit('warn', `Set button error: ${error}`);
|
|
1380
1361
|
};
|
|
1381
1362
|
});
|
|
1382
1363
|
this.buttonsServices.push(buttonService);
|
package/src/deviceatw.js
CHANGED
|
@@ -870,7 +870,11 @@ class DeviceAtw extends EventEmitter {
|
|
|
870
870
|
.setCharacteristic(Characteristic.FirmwareRevision, this.firmwareRevision);
|
|
871
871
|
|
|
872
872
|
//melcloud services
|
|
873
|
+
const displayMode = this.displayMode;
|
|
873
874
|
const zonesCount = this.zonesCount;
|
|
875
|
+
const caseHotWater = this.caseHotWater;
|
|
876
|
+
const caseZone2 = this.caseZone2;
|
|
877
|
+
const heatCoolModes = this.heatCoolModes;
|
|
874
878
|
const presetsOnServer = this.accessory.presetsOnServer;
|
|
875
879
|
const temperatureSensor = this.temperatureSensor;
|
|
876
880
|
const temperatureSensorFlow = this.temperatureSensorFlow;
|
|
@@ -881,14 +885,6 @@ class DeviceAtw extends EventEmitter {
|
|
|
881
885
|
const temperatureSensorReturnWaterTank = this.temperatureSensorReturnWaterTank;
|
|
882
886
|
const temperatureSensorFlowZone2 = this.temperatureSensorFlowZone2;
|
|
883
887
|
const temperatureSensorReturnZone2 = this.temperatureSensorReturnZone2;
|
|
884
|
-
const presetsConfigured = this.presetsConfigured;
|
|
885
|
-
const presetsConfiguredCount = this.presetsConfiguredCount;
|
|
886
|
-
const buttonsConfigured = this.buttonsConfigured;
|
|
887
|
-
const buttonsConfiguredCount = this.buttonsConfiguredCount;
|
|
888
|
-
const displayMode = this.displayMode;
|
|
889
|
-
const caseHotWater = this.caseHotWater;
|
|
890
|
-
const caseZone2 = this.caseZone2;
|
|
891
|
-
const heatCoolModes = this.heatCoolModes;
|
|
892
888
|
|
|
893
889
|
this.melCloudServices = [];
|
|
894
890
|
for (let i = 0; i < zonesCount; i++) {
|
|
@@ -1564,21 +1560,18 @@ class DeviceAtw extends EventEmitter {
|
|
|
1564
1560
|
};
|
|
1565
1561
|
|
|
1566
1562
|
//presets services
|
|
1567
|
-
if (presetsConfiguredCount > 0) {
|
|
1563
|
+
if (this.presetsConfiguredCount > 0) {
|
|
1568
1564
|
const debug = this.enableDebugMode ? this.emit('debug', `Prepare presets services`) : false;
|
|
1569
1565
|
this.presetsServices = [];
|
|
1570
1566
|
const previousPresets = [];
|
|
1571
1567
|
|
|
1572
|
-
for (let i = 0; i < presetsConfiguredCount; i++) {
|
|
1573
|
-
const preset = presetsConfigured[i];
|
|
1568
|
+
for (let i = 0; i < this.presetsConfiguredCount; i++) {
|
|
1569
|
+
const preset = this.presetsConfigured[i];
|
|
1574
1570
|
const presetData = presetsOnServer.find(p => p.ID === preset.Id);
|
|
1575
1571
|
|
|
1576
1572
|
//get preset name
|
|
1577
1573
|
const presetName = preset.name;
|
|
1578
1574
|
|
|
1579
|
-
//get preset display type
|
|
1580
|
-
const displayType = button.displayType;
|
|
1581
|
-
|
|
1582
1575
|
//get preset name prefix
|
|
1583
1576
|
const presetNamePrefix = preset.namePrefix;
|
|
1584
1577
|
|
|
@@ -1590,11 +1583,10 @@ class DeviceAtw extends EventEmitter {
|
|
|
1590
1583
|
presetService.setCharacteristic(Characteristic.ConfiguredName, serviceName);
|
|
1591
1584
|
presetService.getCharacteristic(characteristicType)
|
|
1592
1585
|
.onGet(async () => {
|
|
1593
|
-
const state =
|
|
1586
|
+
const state = preset.state;
|
|
1594
1587
|
return state;
|
|
1595
1588
|
})
|
|
1596
|
-
|
|
1597
|
-
presetService.onSet(async (state) => {
|
|
1589
|
+
.onSet(async (state) => {
|
|
1598
1590
|
try {
|
|
1599
1591
|
switch (state) {
|
|
1600
1592
|
case true:
|
|
@@ -1624,7 +1616,6 @@ class DeviceAtw extends EventEmitter {
|
|
|
1624
1616
|
this.emit('warn', `Set preset error: ${error}`);
|
|
1625
1617
|
};
|
|
1626
1618
|
});
|
|
1627
|
-
};
|
|
1628
1619
|
previousPresets.push(deviceData.Device);
|
|
1629
1620
|
this.presetsServices.push(presetService);
|
|
1630
1621
|
accessory.addService(presetService);
|
|
@@ -1632,12 +1623,12 @@ class DeviceAtw extends EventEmitter {
|
|
|
1632
1623
|
};
|
|
1633
1624
|
|
|
1634
1625
|
//buttons services
|
|
1635
|
-
if (buttonsConfiguredCount > 0) {
|
|
1626
|
+
if (this.buttonsConfiguredCount > 0) {
|
|
1636
1627
|
const debug = this.enableDebugMode ? this.emit('debug', `Prepare buttons services`) : false;
|
|
1637
1628
|
this.buttonsServices = [];
|
|
1638
1629
|
|
|
1639
|
-
for (let i = 0; i < buttonsConfiguredCount; i++) {
|
|
1640
|
-
const button = buttonsConfigured[i];
|
|
1630
|
+
for (let i = 0; i < this.buttonsConfiguredCount; i++) {
|
|
1631
|
+
const button = this.buttonsConfigured[i];
|
|
1641
1632
|
|
|
1642
1633
|
//get button mode
|
|
1643
1634
|
const mode = button.mode;
|
package/src/deviceerv.js
CHANGED
|
@@ -686,15 +686,11 @@ class DeviceErv extends EventEmitter {
|
|
|
686
686
|
.setCharacteristic(Characteristic.FirmwareRevision, this.firmwareRevision);
|
|
687
687
|
|
|
688
688
|
//melcloud services
|
|
689
|
-
const presetsOnServer = this.accessory.presetsOnServer;
|
|
690
689
|
const displayMode = this.displayMode;
|
|
690
|
+
const presetsOnServer = this.accessory.presetsOnServer;
|
|
691
691
|
const temperatureSensor = this.temperatureSensor;
|
|
692
692
|
const temperatureSensorOutdoor = this.temperatureSensorOutdoor;
|
|
693
693
|
const temperatureSensorSupply = this.temperatureSensorSupply;
|
|
694
|
-
const presetsConfigured = this.presetsConfigured;
|
|
695
|
-
const presetsConfiguredCount = this.presetsConfiguredCount;
|
|
696
|
-
const buttonsConfigured = this.buttonsConfigured;
|
|
697
|
-
const buttonsConfiguredCount = this.buttonsConfiguredCount;
|
|
698
694
|
const hasCoolOperationMode = this.accessory.hasCoolOperationMode;
|
|
699
695
|
const hasHeatOperationMode = this.accessory.hasHeatOperationMode;
|
|
700
696
|
const hasCO2Sensor = this.accessory.hasCO2Sensor;
|
|
@@ -1102,21 +1098,18 @@ class DeviceErv extends EventEmitter {
|
|
|
1102
1098
|
}
|
|
1103
1099
|
|
|
1104
1100
|
//presets services
|
|
1105
|
-
if (presetsConfiguredCount > 0) {
|
|
1101
|
+
if (this.presetsConfiguredCount > 0) {
|
|
1106
1102
|
const debug = this.enableDebugMode ? this.emit('debug', `Prepare presets services`) : false;
|
|
1107
1103
|
this.presetsServices = [];
|
|
1108
1104
|
const previousPresets = [];
|
|
1109
1105
|
|
|
1110
|
-
for (let i = 0; i < presetsConfiguredCount; i++) {
|
|
1111
|
-
const preset = presetsConfigured[i];
|
|
1106
|
+
for (let i = 0; i < this.presetsConfiguredCount; i++) {
|
|
1107
|
+
const preset = this.presetsConfigured[i];
|
|
1112
1108
|
const presetData = presetsOnServer.find(p => p.ID === preset.Id);
|
|
1113
1109
|
|
|
1114
1110
|
//get preset name
|
|
1115
1111
|
const presetName = preset.name;
|
|
1116
1112
|
|
|
1117
|
-
//get preset display type
|
|
1118
|
-
const displayType = button.displayType;
|
|
1119
|
-
|
|
1120
1113
|
//get preset name prefix
|
|
1121
1114
|
const presetNamePrefix = preset.namePrefix;
|
|
1122
1115
|
|
|
@@ -1128,11 +1121,10 @@ class DeviceErv extends EventEmitter {
|
|
|
1128
1121
|
presetService.setCharacteristic(Characteristic.ConfiguredName, serviceName);
|
|
1129
1122
|
presetService.getCharacteristic(characteristicType)
|
|
1130
1123
|
.onGet(async () => {
|
|
1131
|
-
const state =
|
|
1124
|
+
const state = preset.state;
|
|
1132
1125
|
return state;
|
|
1133
1126
|
})
|
|
1134
|
-
|
|
1135
|
-
presetService.onSet(async (state) => {
|
|
1127
|
+
.onSet(async (state) => {
|
|
1136
1128
|
try {
|
|
1137
1129
|
switch (state) {
|
|
1138
1130
|
case true:
|
|
@@ -1155,27 +1147,23 @@ class DeviceErv extends EventEmitter {
|
|
|
1155
1147
|
this.emit('warn', `Set preset error: ${error}`);
|
|
1156
1148
|
};
|
|
1157
1149
|
});
|
|
1158
|
-
};
|
|
1159
|
-
previousPresets.push(deviceData.Device);
|
|
1160
|
-
this.presetsServices.push(presetService);
|
|
1161
|
-
accessory.addService(presetService);
|
|
1162
1150
|
};
|
|
1151
|
+
previousPresets.push(deviceData.Device);
|
|
1152
|
+
this.presetsServices.push(presetService);
|
|
1153
|
+
accessory.addService(presetService);
|
|
1163
1154
|
};
|
|
1164
1155
|
|
|
1165
1156
|
//buttons services
|
|
1166
|
-
if (buttonsConfiguredCount > 0) {
|
|
1157
|
+
if (this.buttonsConfiguredCount > 0) {
|
|
1167
1158
|
const debug = this.enableDebugMode ? this.emit('debug', `Prepare buttons services`) : false;
|
|
1168
1159
|
this.buttonsServices = [];
|
|
1169
1160
|
|
|
1170
|
-
for (let i = 0; i < buttonsConfiguredCount; i++) {
|
|
1171
|
-
const button = buttonsConfigured[i];
|
|
1161
|
+
for (let i = 0; i < this.buttonsConfiguredCount; i++) {
|
|
1162
|
+
const button = this.buttonsConfigured[i];
|
|
1172
1163
|
|
|
1173
1164
|
//get button mode
|
|
1174
1165
|
const mode = button.mode;
|
|
1175
1166
|
|
|
1176
|
-
//get button display type
|
|
1177
|
-
const displayType = button.displayType;
|
|
1178
|
-
|
|
1179
1167
|
//get button name
|
|
1180
1168
|
const buttonName = button.name;
|
|
1181
1169
|
|
|
@@ -1194,81 +1182,79 @@ class DeviceErv extends EventEmitter {
|
|
|
1194
1182
|
return state;
|
|
1195
1183
|
})
|
|
1196
1184
|
.onSet(async (state) => {
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
break;
|
|
1265
|
-
};
|
|
1266
|
-
|
|
1267
|
-
await this.melCloudErv.send(deviceData);
|
|
1268
|
-
const info = this.disableLogInfo ? false : this.emit('message', `Set: ${buttonName}`);
|
|
1269
|
-
} catch (error) {
|
|
1270
|
-
this.emit('warn', `Set button error: ${error}`);
|
|
1185
|
+
try {
|
|
1186
|
+
switch (mode) {
|
|
1187
|
+
case 0: //POWER ON,OFF
|
|
1188
|
+
deviceData.Device.Power = state;
|
|
1189
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.Ventilation.EffectiveFlags.Power;
|
|
1190
|
+
break;
|
|
1191
|
+
case 1: //OPERATING MODE RECOVERY
|
|
1192
|
+
deviceData.Device.Power = true;
|
|
1193
|
+
deviceData.Device.VentilationMode = 0;
|
|
1194
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.Ventilation.EffectiveFlags.Power + CONSTANTS.Ventilation.EffectiveFlags.VentilationMode;
|
|
1195
|
+
break;
|
|
1196
|
+
case 2: //OPERATING MODE BYPASS
|
|
1197
|
+
deviceData.Device.Power = true;
|
|
1198
|
+
deviceData.Device.VentilationMode = 1;
|
|
1199
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.Ventilation.EffectiveFlags.Power + CONSTANTS.Ventilation.EffectiveFlags.VentilationMode;
|
|
1200
|
+
break
|
|
1201
|
+
case 3: //OPERATING MODE AUTO
|
|
1202
|
+
deviceData.Device.Power = true;
|
|
1203
|
+
deviceData.Device.VentilationMode = 2;
|
|
1204
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.Ventilation.EffectiveFlags.Power + CONSTANTS.Ventilation.EffectiveFlags.VentilationMode;
|
|
1205
|
+
break;
|
|
1206
|
+
case 4: //NIGHT PURGE MODE
|
|
1207
|
+
deviceData.Device.Power = true;
|
|
1208
|
+
deviceData.Device.NightPurgeMode = state;
|
|
1209
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.Ventilation.EffectiveFlags.Power
|
|
1210
|
+
break;
|
|
1211
|
+
case 10: //FAN SPEED MODE AUTO
|
|
1212
|
+
deviceData.Device.Power = true;
|
|
1213
|
+
deviceData.Device.SetFanSpeed = 0;
|
|
1214
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.Ventilation.EffectiveFlags.Power + CONSTANTS.Ventilation.EffectiveFlags.SetFanSpeed;
|
|
1215
|
+
break;
|
|
1216
|
+
case 11: //FAN SPEED MODE 1
|
|
1217
|
+
deviceData.Device.Power = true;
|
|
1218
|
+
deviceData.Device.SetFanSpeed = 1;
|
|
1219
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.Ventilation.EffectiveFlags.Power + CONSTANTS.Ventilation.EffectiveFlags.SetFanSpeed;
|
|
1220
|
+
break;
|
|
1221
|
+
case 12: //FAN SPEED MODE 2
|
|
1222
|
+
deviceData.Device.Power = true;
|
|
1223
|
+
deviceData.Device.SetFanSpeed = 2;
|
|
1224
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.Ventilation.EffectiveFlags.Power + CONSTANTS.Ventilation.EffectiveFlags.SetFanSpeed;
|
|
1225
|
+
break;
|
|
1226
|
+
case 13: //FAN SPEED MODE 3
|
|
1227
|
+
deviceData.Device.Power = true;
|
|
1228
|
+
deviceData.Device.SetFanSpeed = 3;
|
|
1229
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.Ventilation.EffectiveFlags.Power + CONSTANTS.Ventilation.EffectiveFlags.SetFanSpeed;
|
|
1230
|
+
break;
|
|
1231
|
+
case 14: //FAN MODE 4
|
|
1232
|
+
deviceData.Device.Power = true;
|
|
1233
|
+
deviceData.Device.SetFanSpeed = 4;
|
|
1234
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.Ventilation.EffectiveFlags.Power + CONSTANTS.Ventilation.EffectiveFlags.SetFanSpeed;
|
|
1235
|
+
break;
|
|
1236
|
+
case 15: //PHYSICAL LOCK CONTROLS
|
|
1237
|
+
deviceData.Device = deviceData.Device;
|
|
1238
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.Ventilation.EffectiveFlags.Prohibit;
|
|
1239
|
+
break;
|
|
1240
|
+
case 16: //ROOM TEMP HIDE
|
|
1241
|
+
deviceData.Device.HideRoomTemperature = state;
|
|
1242
|
+
break;
|
|
1243
|
+
case 17: //SUPPLY TEMP HIDE
|
|
1244
|
+
deviceData.Device.HideSupplyTemperature = state;
|
|
1245
|
+
break;
|
|
1246
|
+
case 18: //OUTDOOR EMP HIDE
|
|
1247
|
+
deviceData.Device.hideOutdoorTemperature = state;
|
|
1248
|
+
break;
|
|
1249
|
+
default:
|
|
1250
|
+
this.emit('message', `Unknown button mode: ${mode}`);
|
|
1251
|
+
break;
|
|
1271
1252
|
};
|
|
1253
|
+
|
|
1254
|
+
await this.melCloudErv.send(deviceData);
|
|
1255
|
+
const info = this.disableLogInfo ? false : this.emit('message', `Set: ${buttonName}`);
|
|
1256
|
+
} catch (error) {
|
|
1257
|
+
this.emit('warn', `Set button error: ${error}`);
|
|
1272
1258
|
};
|
|
1273
1259
|
});
|
|
1274
1260
|
this.buttonsServices.push(buttonService);
|