homebridge-melcloud-control 4.2.5-beta.0 → 4.2.5-beta.10
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/README.md +3 -3
- package/config.schema.json +36 -18
- package/package.json +1 -1
- package/src/deviceata.js +272 -247
- package/src/deviceatw.js +200 -179
- package/src/deviceerv.js +143 -137
- package/src/melcloud.js +9 -15
- package/src/melcloudata.js +18 -27
- package/src/melcloudatw.js +10 -20
- package/src/melclouderv.js +10 -20
- package/src/melcloudhome.js +14 -22
package/src/deviceatw.js
CHANGED
|
@@ -89,8 +89,8 @@ class DeviceAtw extends EventEmitter {
|
|
|
89
89
|
//buttons configured
|
|
90
90
|
for (const button of this.buttons) {
|
|
91
91
|
button.name = button.name || 'Button'
|
|
92
|
-
button.serviceType = [
|
|
93
|
-
button.characteristicType = [
|
|
92
|
+
button.serviceType = serviceType[button.displayType];
|
|
93
|
+
button.characteristicType = characteristicType[button.displayType];
|
|
94
94
|
button.state = false;
|
|
95
95
|
button.previousValue = null;
|
|
96
96
|
}
|
|
@@ -357,8 +357,8 @@ class DeviceAtw extends EventEmitter {
|
|
|
357
357
|
switch (i) {
|
|
358
358
|
case 0: //Heat Pump
|
|
359
359
|
deviceData.Device.Power = state ? true : false;
|
|
360
|
-
await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, HeatPump.EffectiveFlags.Power);
|
|
361
360
|
if (this.logInfo) this.emit('info', `${zoneName}, Set power: ${state ? 'On' : 'Off'}`);
|
|
361
|
+
await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, HeatPump.EffectiveFlags.Power);
|
|
362
362
|
break;
|
|
363
363
|
};
|
|
364
364
|
} catch (error) {
|
|
@@ -457,8 +457,8 @@ class DeviceAtw extends EventEmitter {
|
|
|
457
457
|
break;
|
|
458
458
|
};
|
|
459
459
|
|
|
460
|
-
await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, flag);
|
|
461
460
|
if (this.logInfo) this.emit('info', `${zoneName}, Set operation mode: ${operationModeText}`);
|
|
461
|
+
await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, flag);
|
|
462
462
|
} catch (error) {
|
|
463
463
|
if (this.logWarn) this.emit('warn', `${zoneName}, Set operation mode error: ${error}`);
|
|
464
464
|
};
|
|
@@ -531,8 +531,8 @@ class DeviceAtw extends EventEmitter {
|
|
|
531
531
|
break;
|
|
532
532
|
};
|
|
533
533
|
|
|
534
|
-
if (i > 0) await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, flag);
|
|
535
534
|
if (this.logInfo && i !== 0) this.emit('info', `${zoneName}, Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
535
|
+
if (i > 0) await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, flag);
|
|
536
536
|
} catch (error) {
|
|
537
537
|
if (this.logWarn) this.emit('warn', `${zoneName}, Set cooling threshold temperature error: ${error}`);
|
|
538
538
|
};
|
|
@@ -596,8 +596,8 @@ class DeviceAtw extends EventEmitter {
|
|
|
596
596
|
break;
|
|
597
597
|
};
|
|
598
598
|
|
|
599
|
-
if (i > 0) await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, flag);
|
|
600
599
|
if (this.logInfo && i !== 0) this.emit('info', `${zoneName}, Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
600
|
+
if (i > 0) await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, flag);
|
|
601
601
|
} catch (error) {
|
|
602
602
|
if (this.logWarn) this.emit('warn', `${zoneName}, Set heating threshold temperature error: ${error}`);
|
|
603
603
|
};
|
|
@@ -634,8 +634,8 @@ class DeviceAtw extends EventEmitter {
|
|
|
634
634
|
break;
|
|
635
635
|
};
|
|
636
636
|
|
|
637
|
+
if (this.logInfo) this.emit('info', `${zoneName}, Set lock physical controls: ${value ? 'Lock' : 'Unlock'}`);
|
|
637
638
|
await this.melCloudAtw.send(this.accountType, this.displayType, deviceData);
|
|
638
|
-
if (this.logInfo) this.emit('info', `${zoneName}, Set lock physical controls: ${value ? 'LOCK' : 'UNLOCK'}`);
|
|
639
639
|
} catch (error) {
|
|
640
640
|
if (this.logWarn) this.emit('warn', `${zoneName}, Set lock physical controls error: ${error}`);
|
|
641
641
|
};
|
|
@@ -651,8 +651,8 @@ class DeviceAtw extends EventEmitter {
|
|
|
651
651
|
try {
|
|
652
652
|
value = [false, true][value];
|
|
653
653
|
this.accessory.useFahrenheit = value;
|
|
654
|
-
this.emit('melCloud', 'UseFahrenheit', value);
|
|
655
654
|
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
655
|
+
this.emit('melCloud', 'UseFahrenheit', value);
|
|
656
656
|
} catch (error) {
|
|
657
657
|
if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
658
658
|
};
|
|
@@ -772,8 +772,8 @@ class DeviceAtw extends EventEmitter {
|
|
|
772
772
|
break;
|
|
773
773
|
};
|
|
774
774
|
|
|
775
|
-
await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, flag);
|
|
776
775
|
if (this.logInfo) this.emit('info', `${zoneName}, Set operation mode: ${operationModeText}`);
|
|
776
|
+
await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, flag);
|
|
777
777
|
} catch (error) {
|
|
778
778
|
if (this.logWarn) this.emit('warn', `${zoneName}, Set operation mode error: ${error}`);
|
|
779
779
|
};
|
|
@@ -820,8 +820,8 @@ class DeviceAtw extends EventEmitter {
|
|
|
820
820
|
break;
|
|
821
821
|
};
|
|
822
822
|
|
|
823
|
-
if (i > 0) await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, flag);
|
|
824
823
|
if (this.logInfo && i !== 0) this.emit('info', `${zoneName}, Set temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
824
|
+
if (i > 0) await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, flag);
|
|
825
825
|
} catch (error) {
|
|
826
826
|
if (this.logWarn) this.emit('warn', `${zoneName}, Set temperature error: ${error}`);
|
|
827
827
|
};
|
|
@@ -835,10 +835,10 @@ class DeviceAtw extends EventEmitter {
|
|
|
835
835
|
if (this.account.type === 'melcloudhome') return;
|
|
836
836
|
|
|
837
837
|
try {
|
|
838
|
-
value =
|
|
838
|
+
value = value ? true : false;
|
|
839
839
|
this.accessory.useFahrenheit = value;
|
|
840
|
-
this.emit('melCloud', 'UseFahrenheit', value);
|
|
841
840
|
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
841
|
+
this.emit('melCloud', 'UseFahrenheit', value);
|
|
842
842
|
} catch (error) {
|
|
843
843
|
if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
844
844
|
};
|
|
@@ -1137,8 +1137,8 @@ class DeviceAtw extends EventEmitter {
|
|
|
1137
1137
|
.onSet(async (state) => {
|
|
1138
1138
|
try {
|
|
1139
1139
|
deviceData.HolidayMode.Enabled = state;
|
|
1140
|
-
|
|
1141
|
-
|
|
1140
|
+
if (this.logInfo) this.emit('info', `Holiday mode: ${state ? 'Enable' : 'Disable'}`);
|
|
1141
|
+
await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, 'holidaymode');
|
|
1142
1142
|
} catch (error) {
|
|
1143
1143
|
if (this.logWarn) this.emit('warn', `Set holiday mode error: ${error}`);
|
|
1144
1144
|
};
|
|
@@ -1219,8 +1219,8 @@ class DeviceAtw extends EventEmitter {
|
|
|
1219
1219
|
break;
|
|
1220
1220
|
};
|
|
1221
1221
|
|
|
1222
|
-
|
|
1223
|
-
|
|
1222
|
+
if (this.logInfo) this.emit('info', `Preset ${name}: ${state ? 'Set:' : 'Unset:'}`);
|
|
1223
|
+
await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.Presets);
|
|
1224
1224
|
} catch (error) {
|
|
1225
1225
|
if (this.logWarn) this.emit('warn', `Set preset error: ${error}`);
|
|
1226
1226
|
};
|
|
@@ -1276,10 +1276,10 @@ class DeviceAtw extends EventEmitter {
|
|
|
1276
1276
|
.onSet(async (state) => {
|
|
1277
1277
|
try {
|
|
1278
1278
|
deviceData.ScheduleEnabled = state;
|
|
1279
|
-
|
|
1280
|
-
|
|
1279
|
+
if (this.logInfo) this.emit('info', `Schedules: ${state ? 'Enable' : 'Disable'}`);
|
|
1280
|
+
await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, 'schedule');
|
|
1281
1281
|
} catch (error) {
|
|
1282
|
-
if (this.logWarn) this.emit('warn', `Set
|
|
1282
|
+
if (this.logWarn) this.emit('warn', `Set schedules error: ${error}`);
|
|
1283
1283
|
};
|
|
1284
1284
|
});
|
|
1285
1285
|
accessory.addService(this.scheduleControlService);
|
|
@@ -1345,8 +1345,8 @@ class DeviceAtw extends EventEmitter {
|
|
|
1345
1345
|
.onSet(async (state) => {
|
|
1346
1346
|
try {
|
|
1347
1347
|
sceneData.Enabled = state;
|
|
1348
|
-
|
|
1349
|
-
|
|
1348
|
+
if (this.logInfo) this.emit('info', `Scene ${name}: ${state ? 'Enable' : 'Disable'}`);
|
|
1349
|
+
await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, 'scene', sceneData);
|
|
1350
1350
|
} catch (error) {
|
|
1351
1351
|
if (this.logWarn) this.emit('warn', `Set scene error: ${error}`);
|
|
1352
1352
|
};
|
|
@@ -1371,15 +1371,13 @@ class DeviceAtw extends EventEmitter {
|
|
|
1371
1371
|
|
|
1372
1372
|
//buttons services
|
|
1373
1373
|
if (this.buttons.length > 0) {
|
|
1374
|
-
if (this.logDebug) this.emit('debug', `Prepare buttons services`);
|
|
1375
|
-
this.
|
|
1374
|
+
if (this.logDebug) this.emit('debug', `Prepare buttons / sensors services`);
|
|
1375
|
+
this.buttonControlServices = [];
|
|
1376
|
+
this.buttonControlSensorServices = [];
|
|
1376
1377
|
this.buttons.lengthforEach((button, i) => {
|
|
1377
1378
|
//get button mode
|
|
1378
1379
|
const mode = button.mode;
|
|
1379
1380
|
|
|
1380
|
-
//get button display type
|
|
1381
|
-
const displayType = button.displayType;
|
|
1382
|
-
|
|
1383
1381
|
//get button name
|
|
1384
1382
|
const name = button.name;
|
|
1385
1383
|
|
|
@@ -1389,160 +1387,178 @@ class DeviceAtw extends EventEmitter {
|
|
|
1389
1387
|
const serviceName1 = namePrefix ? `${accessoryName} ${name}` : name;
|
|
1390
1388
|
const serviceType = button.serviceType;
|
|
1391
1389
|
const characteristicType = button.characteristicType;
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1390
|
+
|
|
1391
|
+
//control
|
|
1392
|
+
if (button.displayType > 3) {
|
|
1393
|
+
if (this.logDebug) this.emit('debug', `Prepare button control ${name} service`);
|
|
1394
|
+
const buttonControlService = new serviceType(serviceName1, `buttonControlService${deviceId} ${i}`);
|
|
1395
|
+
buttonControlService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
1396
|
+
buttonControlService.setCharacteristic(Characteristic.ConfiguredName, serviceName1);
|
|
1397
|
+
buttonControlService.getCharacteristic(Characteristic.On)
|
|
1398
|
+
.onGet(async () => {
|
|
1399
|
+
const state = button.state;
|
|
1400
|
+
return state;
|
|
1401
|
+
})
|
|
1402
|
+
.onSet(async (state) => {
|
|
1403
|
+
if (displayType > 0 && displayType < 3) {
|
|
1404
|
+
try {
|
|
1405
|
+
let flag = null;
|
|
1406
|
+
switch (mode) {
|
|
1407
|
+
case 0: //POWER ON,OFF
|
|
1408
|
+
deviceData.Device.Power = state;
|
|
1409
|
+
flag = HeatPump.EffectiveFlags.Power;
|
|
1410
|
+
break;
|
|
1411
|
+
case 1: //HEAT PUMP HEAT
|
|
1412
|
+
button.previousValue = state ? deviceData.Device.UnitStatus : button.previousValue ?? deviceData.Device.UnitStatus;
|
|
1413
|
+
deviceData.Device.Power = true;
|
|
1414
|
+
deviceData.Device.UnitStatus = state ? 0 : button.previousValue;
|
|
1415
|
+
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationMode;
|
|
1416
|
+
break;
|
|
1417
|
+
case 2: //COOL
|
|
1418
|
+
button.previousValue = state ? deviceData.Device.UnitStatus : button.previousValue ?? deviceData.Device.UnitStatus;
|
|
1419
|
+
deviceData.Device.Power = true;
|
|
1420
|
+
deviceData.Device.UnitStatus = state ? 1 : button.previousValue;
|
|
1421
|
+
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationMode;
|
|
1422
|
+
break;
|
|
1423
|
+
case 3: //HOLIDAY
|
|
1424
|
+
if (this.accountType === 'melcloud') {
|
|
1425
|
+
deviceData.Device.HolidayMode = state;
|
|
1426
|
+
flag = HeatPump.EffectiveFlags.HolidayMode;
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
if (this.accountType === 'melcloudhome') {
|
|
1430
|
+
deviceData.Device.HolidayMode.Enabled = state;
|
|
1431
|
+
flag = 'holidaymode';
|
|
1432
|
+
}
|
|
1433
|
+
break;
|
|
1434
|
+
case 10: //ALL ZONES PHYSICAL LOCK CONTROL
|
|
1435
|
+
deviceData.Device.ProhibitZone1 = state;
|
|
1436
|
+
deviceData.Device.ProhibitHotWater = state;
|
|
1437
|
+
deviceData.Device.ProhibitZone2 = state;
|
|
1438
|
+
flag = HeatPump.EffectiveFlags.ProhibitHeatingZone1 + HeatPump.EffectiveFlags.ProhibitHotWater + HeatPump.EffectiveFlags.ProhibitHeatingZone2;
|
|
1439
|
+
break;
|
|
1440
|
+
case 20: //ZONE 1 HEAT THERMOSTAT
|
|
1441
|
+
button.previousValue = state ? deviceData.Device.OperationModeZone1 : button.previousValue ?? deviceData.Device.OperationModeZone1;
|
|
1442
|
+
deviceData.Device.Power = true;
|
|
1443
|
+
deviceData.Device.OperationModeZone1 = state ? 0 : button.previousValue;
|
|
1444
|
+
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone1;
|
|
1445
|
+
break;
|
|
1446
|
+
case 21: //HEAT FLOW
|
|
1447
|
+
button.previousValue = state ? deviceData.Device.OperationModeZone1 : button.previousValue ?? deviceData.Device.OperationModeZone1;
|
|
1448
|
+
deviceData.Device.Power = true;
|
|
1449
|
+
deviceData.Device.OperationModeZone1 = state ? 1 : button.previousValue;
|
|
1450
|
+
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone1;
|
|
1451
|
+
break;
|
|
1452
|
+
case 22: //HEAT CURVE
|
|
1453
|
+
button.previousValue = state ? deviceData.Device.OperationModeZone1 : button.previousValue ?? deviceData.Device.OperationModeZone1;
|
|
1454
|
+
deviceData.Device.Power = true;
|
|
1455
|
+
deviceData.Device.OperationModeZone1 = state ? 2 : button.previousValue;
|
|
1456
|
+
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone1;
|
|
1457
|
+
break;
|
|
1458
|
+
case 23: //COOL THERMOSTAT
|
|
1459
|
+
button.previousValue = state ? deviceData.Device.OperationModeZone1 : button.previousValue ?? deviceData.Device.OperationModeZone1;
|
|
1460
|
+
deviceData.Device.Power = true;
|
|
1461
|
+
deviceData.Device.OperationModeZone1 = state ? 3 : button.previousValue;
|
|
1462
|
+
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone1;
|
|
1463
|
+
break;
|
|
1464
|
+
case 24: //COOL FLOW
|
|
1465
|
+
button.previousValue = state ? deviceData.Device.OperationModeZone1 : button.previousValue ?? deviceData.Device.OperationModeZone1;
|
|
1466
|
+
deviceData.Device.Power = true;
|
|
1467
|
+
deviceData.Device.OperationModeZone1 = state ? 4 : button.previousValue;
|
|
1468
|
+
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone1;
|
|
1469
|
+
break;
|
|
1470
|
+
case 25: //FLOOR DRY UP
|
|
1471
|
+
button.previousValue = state ? deviceData.Device.OperationModeZone1 : button.previousValue ?? deviceData.Device.OperationModeZone1;
|
|
1472
|
+
deviceData.Device.Power = true;
|
|
1473
|
+
deviceData.Device.OperationModeZone1 = state ? 5 : button.previousValue;
|
|
1474
|
+
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone1;
|
|
1475
|
+
break;
|
|
1476
|
+
case 30: //PHYSICAL LOCK CONTROL
|
|
1477
|
+
deviceData.Device.ProhibitZone1 = state;
|
|
1478
|
+
flag = HeatPump.EffectiveFlags.ProhibitHeatingZone1;
|
|
1479
|
+
break;
|
|
1480
|
+
case 40: //HOT WATER NORMAL/FORCE HOT WATER
|
|
1481
|
+
deviceData.Device.Power = true;
|
|
1482
|
+
deviceData.Device.ForcedHotWaterMode = state;
|
|
1483
|
+
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.ForcedHotWaterMode;
|
|
1484
|
+
break;
|
|
1485
|
+
case 41: //NORMAL/ECO
|
|
1486
|
+
deviceData.Device.Power = true;
|
|
1487
|
+
deviceData.Device.EcoHotWater = state;
|
|
1488
|
+
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.EcoHotWater;
|
|
1489
|
+
break;
|
|
1490
|
+
case 50: //PHYSICAL LOCK CONTROL
|
|
1491
|
+
deviceData.Device.ProhibitHotWater = state;
|
|
1492
|
+
flag = HeatPump.EffectiveFlags.ProhibitHotWater;
|
|
1493
|
+
break;
|
|
1494
|
+
case 60: //ZONE 2 HEAT THERMOSTAT
|
|
1495
|
+
button.previousValue = state ? deviceData.Device.OperationModeZone2 : button.previousValue ?? deviceData.Device.OperationModeZone2;
|
|
1496
|
+
deviceData.Device.Power = true;
|
|
1497
|
+
deviceData.Device.OperationModeZone2 = state ? 0 : button.previousValue;
|
|
1498
|
+
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone2;
|
|
1499
|
+
break;
|
|
1500
|
+
case 61: // HEAT FLOW
|
|
1501
|
+
button.previousValue = state ? deviceData.Device.OperationModeZone2 : button.previousValue ?? deviceData.Device.OperationModeZone2;
|
|
1502
|
+
deviceData.Device.Power = true;
|
|
1503
|
+
deviceData.Device.OperationModeZone2 = state ? 1 : button.previousValue;
|
|
1504
|
+
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone2;
|
|
1505
|
+
break;
|
|
1506
|
+
case 62: //HEAT CURVE
|
|
1507
|
+
button.previousValue = state ? deviceData.Device.OperationModeZone2 : button.previousValue ?? deviceData.Device.OperationModeZone2;
|
|
1508
|
+
deviceData.Device.Power = true;
|
|
1509
|
+
deviceData.Device.OperationModeZone2 = state ? 2 : button.previousValue;
|
|
1510
|
+
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone2;
|
|
1511
|
+
break;
|
|
1512
|
+
case 63: //COOL THERMOSTAT
|
|
1513
|
+
button.previousValue = state ? deviceData.Device.OperationModeZone2 : button.previousValue ?? deviceData.Device.OperationModeZone2;
|
|
1514
|
+
deviceData.Device.Power = true;
|
|
1515
|
+
deviceData.Device.OperationModeZone2 = state ? 3 : button.previousValue;
|
|
1516
|
+
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone2;
|
|
1517
|
+
break;
|
|
1518
|
+
case 64: //COOL FLOW
|
|
1519
|
+
button.previousValue = state ? deviceData.Device.OperationModeZone2 : button.previousValue ?? deviceData.Device.OperationModeZone2;
|
|
1520
|
+
deviceData.Device.Power = true;
|
|
1521
|
+
deviceData.Device.OperationModeZone2 = state ? 4 : button.previousValue;
|
|
1522
|
+
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone2;
|
|
1523
|
+
break;
|
|
1524
|
+
case 65: //FLOOR DRY UP
|
|
1525
|
+
button.previousValue = state ? deviceData.Device.OperationModeZone2 : button.previousValue ?? deviceData.Device.OperationModeZone2;
|
|
1526
|
+
deviceData.Device.Power = true;
|
|
1527
|
+
deviceData.Device.OperationModeZone2 = state ? 5 : button.previousValue;
|
|
1528
|
+
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone2;
|
|
1529
|
+
break;
|
|
1530
|
+
case 70: //PHYSICAL LOCK CONTROL
|
|
1531
|
+
deviceData.Device.ProhibitZone2 = state;
|
|
1532
|
+
HeatPump.EffectiveFlags.ProhibitHeatingZone2;
|
|
1533
|
+
break;
|
|
1534
|
+
default:
|
|
1535
|
+
if (this.logWarn) this.emit('warn', `Unknown button mode: ${mode}`);
|
|
1536
|
+
break;
|
|
1537
|
+
};
|
|
1538
|
+
|
|
1539
|
+
if (this.logInfo) this.emit('info', `${state ? `Set: ${name}` : `Unset: ${name}, Set: ${button.previousValue}`}`);
|
|
1540
|
+
await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, flag);
|
|
1541
|
+
} catch (error) {
|
|
1542
|
+
if (this.logWarn) this.emit('warn', `Set button error: ${error}`);
|
|
1543
|
+
};
|
|
1544
|
+
};
|
|
1545
|
+
});
|
|
1546
|
+
this.buttonControlServices.push(buttonControlService);
|
|
1547
|
+
accessory.addService(buttonControlService)
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
//sensor
|
|
1551
|
+
if (this.logDebug) this.emit('debug', `Prepare button control sensor ${name} service`);
|
|
1552
|
+
const buttonControlSensorService = new serviceType(serviceName1, `buttonControlSensorService${deviceId} ${i}`);
|
|
1553
|
+
buttonControlSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
1554
|
+
buttonControlSensorService.setCharacteristic(Characteristic.ConfiguredName, serviceName1);
|
|
1555
|
+
buttonControlSensorService.getCharacteristic(characteristicType)
|
|
1396
1556
|
.onGet(async () => {
|
|
1397
1557
|
const state = button.state;
|
|
1398
1558
|
return state;
|
|
1399
1559
|
})
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
try {
|
|
1403
|
-
let flag = null;
|
|
1404
|
-
switch (mode) {
|
|
1405
|
-
case 0: //POWER ON,OFF
|
|
1406
|
-
deviceData.Device.Power = state;
|
|
1407
|
-
flag = HeatPump.EffectiveFlags.Power;
|
|
1408
|
-
break;
|
|
1409
|
-
case 1: //HEAT PUMP HEAT
|
|
1410
|
-
button.previousValue = state ? deviceData.Device.UnitStatus : button.previousValue ?? deviceData.Device.UnitStatus;
|
|
1411
|
-
deviceData.Device.Power = true;
|
|
1412
|
-
deviceData.Device.UnitStatus = state ? 0 : button.previousValue;
|
|
1413
|
-
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationMode;
|
|
1414
|
-
break;
|
|
1415
|
-
case 2: //COOL
|
|
1416
|
-
button.previousValue = state ? deviceData.Device.UnitStatus : button.previousValue ?? deviceData.Device.UnitStatus;
|
|
1417
|
-
deviceData.Device.Power = true;
|
|
1418
|
-
deviceData.Device.UnitStatus = state ? 1 : button.previousValue;
|
|
1419
|
-
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationMode;
|
|
1420
|
-
break;
|
|
1421
|
-
case 3: //HOLIDAY
|
|
1422
|
-
if (this.accountType === 'melcloud') {
|
|
1423
|
-
deviceData.Device.HolidayMode = state;
|
|
1424
|
-
flag = HeatPump.EffectiveFlags.HolidayMode;
|
|
1425
|
-
}
|
|
1426
|
-
|
|
1427
|
-
if (this.accountType === 'melcloudhome') {
|
|
1428
|
-
deviceData.Device.HolidayMode.Enabled = state;
|
|
1429
|
-
flag = 'holidaymode';
|
|
1430
|
-
}
|
|
1431
|
-
break;
|
|
1432
|
-
case 10: //ALL ZONES PHYSICAL LOCK CONTROL
|
|
1433
|
-
deviceData.Device.ProhibitZone1 = state;
|
|
1434
|
-
deviceData.Device.ProhibitHotWater = state;
|
|
1435
|
-
deviceData.Device.ProhibitZone2 = state;
|
|
1436
|
-
flag = HeatPump.EffectiveFlags.ProhibitHeatingZone1 + HeatPump.EffectiveFlags.ProhibitHotWater + HeatPump.EffectiveFlags.ProhibitHeatingZone2;
|
|
1437
|
-
break;
|
|
1438
|
-
case 20: //ZONE 1 HEAT THERMOSTAT
|
|
1439
|
-
button.previousValue = state ? deviceData.Device.OperationModeZone1 : button.previousValue ?? deviceData.Device.OperationModeZone1;
|
|
1440
|
-
deviceData.Device.Power = true;
|
|
1441
|
-
deviceData.Device.OperationModeZone1 = state ? 0 : button.previousValue;
|
|
1442
|
-
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone1;
|
|
1443
|
-
break;
|
|
1444
|
-
case 21: //HEAT FLOW
|
|
1445
|
-
button.previousValue = state ? deviceData.Device.OperationModeZone1 : button.previousValue ?? deviceData.Device.OperationModeZone1;
|
|
1446
|
-
deviceData.Device.Power = true;
|
|
1447
|
-
deviceData.Device.OperationModeZone1 = state ? 1 : button.previousValue;
|
|
1448
|
-
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone1;
|
|
1449
|
-
break;
|
|
1450
|
-
case 22: //HEAT CURVE
|
|
1451
|
-
button.previousValue = state ? deviceData.Device.OperationModeZone1 : button.previousValue ?? deviceData.Device.OperationModeZone1;
|
|
1452
|
-
deviceData.Device.Power = true;
|
|
1453
|
-
deviceData.Device.OperationModeZone1 = state ? 2 : button.previousValue;
|
|
1454
|
-
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone1;
|
|
1455
|
-
break;
|
|
1456
|
-
case 23: //COOL THERMOSTAT
|
|
1457
|
-
button.previousValue = state ? deviceData.Device.OperationModeZone1 : button.previousValue ?? deviceData.Device.OperationModeZone1;
|
|
1458
|
-
deviceData.Device.Power = true;
|
|
1459
|
-
deviceData.Device.OperationModeZone1 = state ? 3 : button.previousValue;
|
|
1460
|
-
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone1;
|
|
1461
|
-
break;
|
|
1462
|
-
case 24: //COOL FLOW
|
|
1463
|
-
button.previousValue = state ? deviceData.Device.OperationModeZone1 : button.previousValue ?? deviceData.Device.OperationModeZone1;
|
|
1464
|
-
deviceData.Device.Power = true;
|
|
1465
|
-
deviceData.Device.OperationModeZone1 = state ? 4 : button.previousValue;
|
|
1466
|
-
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone1;
|
|
1467
|
-
break;
|
|
1468
|
-
case 25: //FLOOR DRY UP
|
|
1469
|
-
button.previousValue = state ? deviceData.Device.OperationModeZone1 : button.previousValue ?? deviceData.Device.OperationModeZone1;
|
|
1470
|
-
deviceData.Device.Power = true;
|
|
1471
|
-
deviceData.Device.OperationModeZone1 = state ? 5 : button.previousValue;
|
|
1472
|
-
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone1;
|
|
1473
|
-
break;
|
|
1474
|
-
case 30: //PHYSICAL LOCK CONTROL
|
|
1475
|
-
deviceData.Device.ProhibitZone1 = state;
|
|
1476
|
-
flag = HeatPump.EffectiveFlags.ProhibitHeatingZone1;
|
|
1477
|
-
break;
|
|
1478
|
-
case 40: //HOT WATER NORMAL/FORCE HOT WATER
|
|
1479
|
-
deviceData.Device.Power = true;
|
|
1480
|
-
deviceData.Device.ForcedHotWaterMode = state;
|
|
1481
|
-
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.ForcedHotWaterMode;
|
|
1482
|
-
break;
|
|
1483
|
-
case 41: //NORMAL/ECO
|
|
1484
|
-
deviceData.Device.Power = true;
|
|
1485
|
-
deviceData.Device.EcoHotWater = state;
|
|
1486
|
-
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.EcoHotWater;
|
|
1487
|
-
break;
|
|
1488
|
-
case 50: //PHYSICAL LOCK CONTROL
|
|
1489
|
-
deviceData.Device.ProhibitHotWater = state;
|
|
1490
|
-
flag = HeatPump.EffectiveFlags.ProhibitHotWater;
|
|
1491
|
-
break;
|
|
1492
|
-
case 60: //ZONE 2 HEAT THERMOSTAT
|
|
1493
|
-
button.previousValue = state ? deviceData.Device.OperationModeZone2 : button.previousValue ?? deviceData.Device.OperationModeZone2;
|
|
1494
|
-
deviceData.Device.Power = true;
|
|
1495
|
-
deviceData.Device.OperationModeZone2 = state ? 0 : button.previousValue;
|
|
1496
|
-
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone2;
|
|
1497
|
-
break;
|
|
1498
|
-
case 61: // HEAT FLOW
|
|
1499
|
-
button.previousValue = state ? deviceData.Device.OperationModeZone2 : button.previousValue ?? deviceData.Device.OperationModeZone2;
|
|
1500
|
-
deviceData.Device.Power = true;
|
|
1501
|
-
deviceData.Device.OperationModeZone2 = state ? 1 : button.previousValue;
|
|
1502
|
-
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone2;
|
|
1503
|
-
break;
|
|
1504
|
-
case 62: //HEAT CURVE
|
|
1505
|
-
button.previousValue = state ? deviceData.Device.OperationModeZone2 : button.previousValue ?? deviceData.Device.OperationModeZone2;
|
|
1506
|
-
deviceData.Device.Power = true;
|
|
1507
|
-
deviceData.Device.OperationModeZone2 = state ? 2 : button.previousValue;
|
|
1508
|
-
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone2;
|
|
1509
|
-
break;
|
|
1510
|
-
case 63: //COOL THERMOSTAT
|
|
1511
|
-
button.previousValue = state ? deviceData.Device.OperationModeZone2 : button.previousValue ?? deviceData.Device.OperationModeZone2;
|
|
1512
|
-
deviceData.Device.Power = true;
|
|
1513
|
-
deviceData.Device.OperationModeZone2 = state ? 3 : button.previousValue;
|
|
1514
|
-
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone2;
|
|
1515
|
-
break;
|
|
1516
|
-
case 64: //COOL FLOW
|
|
1517
|
-
button.previousValue = state ? deviceData.Device.OperationModeZone2 : button.previousValue ?? deviceData.Device.OperationModeZone2;
|
|
1518
|
-
deviceData.Device.Power = true;
|
|
1519
|
-
deviceData.Device.OperationModeZone2 = state ? 4 : button.previousValue;
|
|
1520
|
-
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone2;
|
|
1521
|
-
break;
|
|
1522
|
-
case 65: //FLOOR DRY UP
|
|
1523
|
-
button.previousValue = state ? deviceData.Device.OperationModeZone2 : button.previousValue ?? deviceData.Device.OperationModeZone2;
|
|
1524
|
-
deviceData.Device.Power = true;
|
|
1525
|
-
deviceData.Device.OperationModeZone2 = state ? 5 : button.previousValue;
|
|
1526
|
-
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone2;
|
|
1527
|
-
break;
|
|
1528
|
-
case 70: //PHYSICAL LOCK CONTROL
|
|
1529
|
-
deviceData.Device.ProhibitZone2 = state;
|
|
1530
|
-
HeatPump.EffectiveFlags.ProhibitHeatingZone2;
|
|
1531
|
-
break;
|
|
1532
|
-
default:
|
|
1533
|
-
if (this.logWarn) this.emit('warn', `Unknown button mode: ${mode}`);
|
|
1534
|
-
break;
|
|
1535
|
-
};
|
|
1536
|
-
|
|
1537
|
-
await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, flag);
|
|
1538
|
-
if (this.logInfo) this.emit('info', `${state ? `Set: ${name}` : `Unset: ${name}, Set: ${button.previousValue}`}`);
|
|
1539
|
-
} catch (error) {
|
|
1540
|
-
if (this.logWarn) this.emit('warn', `Set button error: ${error}`);
|
|
1541
|
-
};
|
|
1542
|
-
};
|
|
1543
|
-
});
|
|
1544
|
-
this.buttonsServices.push(buttonService);
|
|
1545
|
-
accessory.addService(buttonService)
|
|
1560
|
+
this.buttonControlSensorServices.push(buttonControlSensorService);
|
|
1561
|
+
accessory.addService(buttonControlSensorService);
|
|
1546
1562
|
});
|
|
1547
1563
|
};
|
|
1548
1564
|
|
|
@@ -2245,9 +2261,14 @@ class DeviceAtw extends EventEmitter {
|
|
|
2245
2261
|
break;
|
|
2246
2262
|
};
|
|
2247
2263
|
|
|
2248
|
-
//
|
|
2249
|
-
|
|
2250
|
-
|
|
2264
|
+
//control
|
|
2265
|
+
if (button.displayType > 3) {
|
|
2266
|
+
this.buttonControlServices?.[i]?.updateCharacteristic(Characteristic.On, button.state);
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
//sensor
|
|
2270
|
+
const characteristicType = scene.characteristicType;
|
|
2271
|
+
this.buttonControlSensorServices?.[i]?.updateCharacteristic(characteristicType, button.state);
|
|
2251
2272
|
});
|
|
2252
2273
|
};
|
|
2253
2274
|
})
|