homebridge-melcloud-control 4.2.2-beta.1 → 4.2.2-beta.11
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/CHANGELOG.md +10 -0
- package/README.md +6 -0
- package/config.schema.json +42 -0
- package/index.js +1 -1
- package/package.json +1 -1
- package/src/deviceata.js +114 -65
- package/src/deviceatw.js +65 -24
- package/src/deviceerv.js +155 -109
- package/src/melcloud.js +8 -12
- package/src/melcloudata.js +11 -10
- package/src/melcloudatw.js +11 -10
- package/src/melclouderv.js +11 -10
package/src/deviceatw.js
CHANGED
|
@@ -37,6 +37,8 @@ class DeviceAtw extends EventEmitter {
|
|
|
37
37
|
this.temperatureReturnWaterTankSensor = device.temperatureReturnWaterTankSensor || false;
|
|
38
38
|
this.temperatureFlowZone2Sensor = device.temperatureFlowZone2Sensor || false;
|
|
39
39
|
this.temperatureReturnZone2Sensor = device.temperatureReturnZone2Sensor || false;
|
|
40
|
+
this.inStandbySensor = device.inStandbySensor || false;
|
|
41
|
+
this.connectSensor = device.connectSensor || false;
|
|
40
42
|
this.errorSensor = device.errorSensor || false;
|
|
41
43
|
this.holidayModeSupport = device.holidayModeSupport || false;
|
|
42
44
|
this.presets = this.accountType === 'melcloud' ? (device.presets || []).filter(preset => (preset.displayType ?? 0) > 0 && preset.id !== '0') : [];
|
|
@@ -1068,10 +1070,37 @@ class DeviceAtw extends EventEmitter {
|
|
|
1068
1070
|
});
|
|
1069
1071
|
};
|
|
1070
1072
|
|
|
1073
|
+
if (this.inStandbySensor && this.accessory.inStandbyMode !== null) {
|
|
1074
|
+
if (this.logDebug) this.emit('debug', `Prepare in standby mode service`);
|
|
1075
|
+
this.inStandbyService = new Service.ContactSensor(`${serviceName} In Standby`, `inStandbyService${deviceId}`);
|
|
1076
|
+
this.inStandbyService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
1077
|
+
this.inStandbyService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} In Standby`);
|
|
1078
|
+
this.inStandbyService.getCharacteristic(Characteristic.ContactSensorState)
|
|
1079
|
+
.onGet(async () => {
|
|
1080
|
+
const state = this.accessory.isConnected;
|
|
1081
|
+
return state;
|
|
1082
|
+
})
|
|
1083
|
+
accessory.addService(this.inStandbyService);
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
//connect sensor
|
|
1087
|
+
if (this.connectSensor && this.accessory.isConnected !== null) {
|
|
1088
|
+
if (this.logDebug) this.emit('debug', `Prepare connect service`);
|
|
1089
|
+
this.connectService = new Service.ContactSensor(`${serviceName} Connected`, `connectService${deviceId}`);
|
|
1090
|
+
this.connectService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
1091
|
+
this.connectService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Connected`);
|
|
1092
|
+
this.connectService.getCharacteristic(Characteristic.ContactSensorState)
|
|
1093
|
+
.onGet(async () => {
|
|
1094
|
+
const state = this.accessory.isConnected;
|
|
1095
|
+
return state;
|
|
1096
|
+
})
|
|
1097
|
+
accessory.addService(this.connectService);
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1071
1100
|
//error sensor
|
|
1072
1101
|
if (this.errorSensor && this.accessory.isInError !== null) {
|
|
1073
1102
|
if (this.logDebug) this.emit('debug', `Prepare error service`);
|
|
1074
|
-
this.errorService = new Service.ContactSensor(`${serviceName} Error`, `
|
|
1103
|
+
this.errorService = new Service.ContactSensor(`${serviceName} Error`, `errorService${deviceId}`);
|
|
1075
1104
|
this.errorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
1076
1105
|
this.errorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Error`);
|
|
1077
1106
|
this.errorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
@@ -1082,6 +1111,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1082
1111
|
accessory.addService(this.errorService);
|
|
1083
1112
|
}
|
|
1084
1113
|
|
|
1114
|
+
|
|
1085
1115
|
//holiday mode
|
|
1086
1116
|
if (this.holidayModeSupport && this.accessory.holidayModeEnabled !== null) {
|
|
1087
1117
|
//control
|
|
@@ -1441,7 +1471,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1441
1471
|
try {
|
|
1442
1472
|
//melcloud device
|
|
1443
1473
|
this.melCloudAtw = new MelCloudAtw(this.account, this.device, this.devicesFile, this.defaultTempsFile)
|
|
1444
|
-
.on('deviceInfo', (manufacturer, modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion,
|
|
1474
|
+
.on('deviceInfo', (manufacturer, modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion, supportsHotWaterTank, supportsZone2) => {
|
|
1445
1475
|
if (this.logDeviceInfo && this.displayDeviceInfo) {
|
|
1446
1476
|
this.emit('devInfo', `---- ${this.deviceTypeText}: ${this.deviceName} ----`);
|
|
1447
1477
|
this.emit('devInfo', `Account: ${this.accountName}`);
|
|
@@ -1452,8 +1482,8 @@ class DeviceAtw extends EventEmitter {
|
|
|
1452
1482
|
this.emit('devInfo', `Manufacturer: ${manufacturer}`);
|
|
1453
1483
|
this.emit('devInfo', '----------------------------------');
|
|
1454
1484
|
this.emit('devInfo', `Zone 1: Yes`);
|
|
1455
|
-
this.emit('devInfo', `Hot Water Tank: ${
|
|
1456
|
-
this.emit('devInfo', `Zone 2: ${
|
|
1485
|
+
this.emit('devInfo', `Hot Water Tank: ${supportsHotWaterTank ? 'Yes' : 'No'}`);
|
|
1486
|
+
this.emit('devInfo', `Zone 2: ${supportsZone2 ? 'Yes' : 'No'}`);
|
|
1457
1487
|
this.emit('devInfo', '----------------------------------');
|
|
1458
1488
|
this.displayDeviceInfo = false;
|
|
1459
1489
|
}
|
|
@@ -1470,8 +1500,11 @@ class DeviceAtw extends EventEmitter {
|
|
|
1470
1500
|
this.deviceData = deviceData;
|
|
1471
1501
|
|
|
1472
1502
|
//keys
|
|
1503
|
+
const accountTypeMelcloud = this.accountType === 'melcloud';
|
|
1473
1504
|
const tempStepKey = this.accountType === 'melcloud' ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
|
|
1505
|
+
const connectKey = this.accountType === 'melcloud' ? 'Offline' : 'IsConnected';
|
|
1474
1506
|
const errorKey = this.accountType === 'melcloud' ? 'HasError' : 'IsInError';
|
|
1507
|
+
const supportStandbyKey = accountTypeMelcloud ? 'ModelSupportsStandbyMode' : 'HasStandby';
|
|
1475
1508
|
|
|
1476
1509
|
//presets schedule
|
|
1477
1510
|
const scheduleEnabled = deviceData.ScheduleEnabled;
|
|
@@ -1481,10 +1514,10 @@ class DeviceAtw extends EventEmitter {
|
|
|
1481
1514
|
const holidayModeActive = deviceData.HolidayMode?.Active ?? false;
|
|
1482
1515
|
|
|
1483
1516
|
//device info
|
|
1484
|
-
const
|
|
1485
|
-
const
|
|
1486
|
-
const
|
|
1487
|
-
const
|
|
1517
|
+
const supportsHeatPump = ![1, 2, 3, 4, 5, 6, 7, 15].includes(this.hideZone);
|
|
1518
|
+
const supportsZone1 = ![2, 3, 4, 8, 9, 10, 11, 15].includes(this.hideZone);
|
|
1519
|
+
const supportsHotWaterTank = ![3, 5, 6, 9, 10, 12, 13, 15].includes(this.hideZone) && deviceData.Device.HasHotWaterTank;
|
|
1520
|
+
const supportsZone2 = ![4, 6, 7, 10, 11, 13, 14, 15].includes(this.hideZone) && deviceData.Device.HasZone2;
|
|
1488
1521
|
const canHeat = deviceData.Device.CanHeat ?? false;
|
|
1489
1522
|
const canCool = deviceData.Device.CanCool ?? false;
|
|
1490
1523
|
const heatCoolModes = canHeat && canCool ? 0 : canHeat ? 1 : canCool ? 2 : 3;
|
|
@@ -1492,13 +1525,14 @@ class DeviceAtw extends EventEmitter {
|
|
|
1492
1525
|
const minSetTemperature = deviceData.Device.MinSetTemperature ?? 10;
|
|
1493
1526
|
const maxSetTemperature = deviceData.Device.MaxSetTemperature ?? 30;
|
|
1494
1527
|
const maxTankTemperature = deviceData.Device.MaxTankTemperature ?? 70;
|
|
1528
|
+
const supportsStanbyMode = deviceData.Device[supportStandbyKey];
|
|
1495
1529
|
|
|
1496
1530
|
//zones
|
|
1497
1531
|
let currentZoneCase = 0;
|
|
1498
|
-
const caseHeatPump =
|
|
1499
|
-
const caseZone1 =
|
|
1500
|
-
const caseHotWater =
|
|
1501
|
-
const caseZone2 =
|
|
1532
|
+
const caseHeatPump = supportsHeatPump ? currentZoneCase++ : -1;
|
|
1533
|
+
const caseZone1 = supportsZone1 ? currentZoneCase++ : -1;
|
|
1534
|
+
const caseHotWater = supportsHotWaterTank ? currentZoneCase++ : -1;
|
|
1535
|
+
const caseZone2 = supportsZone2 ? currentZoneCase++ : -1;
|
|
1502
1536
|
const zonesCount = currentZoneCase;
|
|
1503
1537
|
|
|
1504
1538
|
//zones sensors
|
|
@@ -1512,12 +1546,14 @@ class DeviceAtw extends EventEmitter {
|
|
|
1512
1546
|
//heat pump
|
|
1513
1547
|
const heatPumpName = 'Heat Pump';
|
|
1514
1548
|
const power = deviceData.Device.Power ?? false;
|
|
1549
|
+
const inStandbyMode = deviceData.Device.InStandbyMode;
|
|
1515
1550
|
const unitStatus = deviceData.Device.UnitStatus ?? 0;
|
|
1516
1551
|
const operationMode = deviceData.Device.OperationMode;
|
|
1517
1552
|
const outdoorTemperature = deviceData.Device.OutdoorTemperature;
|
|
1518
1553
|
const holidayMode = deviceData.Device.HolidayMode ?? false;
|
|
1519
1554
|
const flowTemperatureHeatPump = deviceData.Device.FlowTemperature;
|
|
1520
1555
|
const returnTemperatureHeatPump = deviceData.Device.ReturnTemperature;
|
|
1556
|
+
const isConnected = accountTypeMelcloud ? !deviceData.Device[connectKey] : deviceData.Device[connectKey];
|
|
1521
1557
|
const isInError = deviceData.Device[errorKey];
|
|
1522
1558
|
|
|
1523
1559
|
//zone 1
|
|
@@ -1559,15 +1595,17 @@ class DeviceAtw extends EventEmitter {
|
|
|
1559
1595
|
presets: presetsOnServer,
|
|
1560
1596
|
schedules: schedulesOnServer,
|
|
1561
1597
|
power: power ? 1 : 0,
|
|
1598
|
+
inStandbyMode: inStandbyMode,
|
|
1562
1599
|
unitStatus: unitStatus,
|
|
1563
1600
|
idleZone1: idleZone1,
|
|
1564
1601
|
idleZone2: idleZone2,
|
|
1565
1602
|
temperatureIncrement: temperatureIncrement,
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1603
|
+
supportsHeatPump: supportsHeatPump,
|
|
1604
|
+
supportsZone1: supportsZone1,
|
|
1605
|
+
supportsHotWaterTank: supportsHotWaterTank,
|
|
1606
|
+
supportsZone2: supportsZone2,
|
|
1570
1607
|
heatCoolModes: heatCoolModes,
|
|
1608
|
+
supportsStanbyMode: supportsStanbyMode,
|
|
1571
1609
|
caseHeatPump: caseHeatPump,
|
|
1572
1610
|
caseZone1: caseZone1,
|
|
1573
1611
|
caseHotWater: caseHotWater,
|
|
@@ -1580,6 +1618,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1580
1618
|
sensorsCount: zonesSensorsCount,
|
|
1581
1619
|
useFahrenheit: this.useFahrenheit,
|
|
1582
1620
|
temperatureUnit: TemperatureDisplayUnits[this.useFahrenheit],
|
|
1621
|
+
isConnected: isConnected,
|
|
1583
1622
|
isInError: isInError,
|
|
1584
1623
|
scheduleEnabled: scheduleEnabled,
|
|
1585
1624
|
holidayModeEnabled: holidayModeEnabled,
|
|
@@ -1612,12 +1651,12 @@ class DeviceAtw extends EventEmitter {
|
|
|
1612
1651
|
case caseHeatPump: //Heat Pump Operation Mode - IDLE, HOT WATER, HEATING ZONES, COOLING, HOT WATER STORAGE, FREEZE STAT, LEGIONELLA, HEATING ECO, MODE 1, MODE 2, MODE 3, HEATING UP /// Unit Status - HEAT, COOL
|
|
1613
1652
|
name = heatPumpName;
|
|
1614
1653
|
operationModeZone = operationMode;
|
|
1615
|
-
currentOperationMode = !power ? 0 : [1, 2, 2, 3, 2, 1, 1, 2, 1, 1, 1, 2][operationMode]; //INACTIVE, IDLE, HEATING, COOLING
|
|
1654
|
+
currentOperationMode = !power ? 0 : (inStandbyMode ? 1 : [1, 2, 2, 3, 2, 1, 1, 2, 1, 1, 1, 2][operationMode]); //INACTIVE, IDLE, HEATING, COOLING
|
|
1616
1655
|
targetOperationMode = [1, 2][unitStatus]; //AUTO, HEAT, COOL
|
|
1617
1656
|
roomTemperature = outdoorTemperature;
|
|
1618
1657
|
setTemperature = outdoorTemperature;
|
|
1619
1658
|
|
|
1620
|
-
lockPhysicalControl =
|
|
1659
|
+
lockPhysicalControl = supportsHotWaterTank && supportsZone2 ? (prohibitZone1 && prohibitHotWater && prohibitZone2 ? 1 : 0) : supportsHotWaterTank ? (prohibitZone1 && prohibitHotWater ? 1 : 0) : supportsZone2 ? (prohibitZone1 && prohibitZone2 ? 1 : 0) : 0;
|
|
1621
1660
|
operationModeSetPropsMinValue = [1, 1, 2, 0][heatCoolModes];
|
|
1622
1661
|
operationModeSetPropsMaxValue = [2, 1, 2, 0][heatCoolModes];
|
|
1623
1662
|
operationModeSetPropsValidValues = [[1, 2], [1], [2], [0]][heatCoolModes];
|
|
@@ -1627,7 +1666,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1627
1666
|
case caseZone1: //Zone 1 - HEAT THERMOSTAT, HEAT FLOW, HEAT CURVE, COOL THERMOSTAT, COOL FLOW, FLOOR DRY UP
|
|
1628
1667
|
name = zone1Name;
|
|
1629
1668
|
operationModeZone = operationMode;
|
|
1630
|
-
currentOperationMode = !power ? 0 : idleZone1 ? 1 : [2, 2, 2, 3, 3, 2][operationModeZone1]; //INACTIVE, IDLE, HEATING, COOLING
|
|
1669
|
+
currentOperationMode = !power ? 0 : (idleZone1 ? 1 : [2, 2, 2, 3, 3, 2][operationModeZone1]); //INACTIVE, IDLE, HEATING, COOLING
|
|
1631
1670
|
targetOperationMode = [1, 2, 0, 1, 2, 1][operationModeZone1]; //AUTO, HEAT, COOL
|
|
1632
1671
|
|
|
1633
1672
|
switch (operationModeZone1) {
|
|
@@ -1659,7 +1698,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1659
1698
|
case caseHotWater: //Hot Water - NORMAL, HEAT NOW
|
|
1660
1699
|
name = hotWaterName;
|
|
1661
1700
|
operationModeZone = operationMode;
|
|
1662
|
-
currentOperationMode = !power ? 0 : operationMode === 1 ? 2 : [1, 2][forcedHotWaterMode]; //INACTIVE, IDLE, HEATING, COOLING
|
|
1701
|
+
currentOperationMode = !power ? 0 : (operationMode === 1 ? 2 : [1, 2][forcedHotWaterMode]); //INACTIVE, IDLE, HEATING, COOLING
|
|
1663
1702
|
targetOperationMode = [0, 1][forcedHotWaterMode] //AUTO, HEAT, COOL
|
|
1664
1703
|
roomTemperature = tankWaterTemperature;
|
|
1665
1704
|
setTemperature = setTankWaterTemperature;
|
|
@@ -1674,7 +1713,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1674
1713
|
case caseZone2: //Zone 2 - HEAT THERMOSTAT, HEAT FLOW, HEAT CURVE, COOL THERMOSTAT, COOL FLOW, FLOOR DRY UP
|
|
1675
1714
|
name = zone2Name;
|
|
1676
1715
|
operationModeZone = operationMode;
|
|
1677
|
-
currentOperationMode = !power ? 0 : idleZone2 ? 1 : [2, 2, 2, 3, 3, 2][operationModeZone2]; //INACTIVE, IDLE, HEATING, COOLING
|
|
1716
|
+
currentOperationMode = !power ? 0 : (idleZone2 ? 1 : [2, 2, 2, 3, 3, 2][operationModeZone2]); //INACTIVE, IDLE, HEATING, COOLING
|
|
1678
1717
|
targetOperationMode = [1, 2, 0, 1, 2, 1][operationModeZone2]; //AUTO, HEAT, COOL
|
|
1679
1718
|
|
|
1680
1719
|
switch (operationModeZone2) {
|
|
@@ -1765,7 +1804,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1765
1804
|
case caseHotWater: //Hot Water - NORMAL, HEAT NOW
|
|
1766
1805
|
name = hotWaterName;
|
|
1767
1806
|
operationModeZone = operationMode;
|
|
1768
|
-
currentOperationMode = !power ? 0 : operationMode === 1 ? 1 : [0, 1][forcedHotWaterMode]; //OFF, HEAT, COOL
|
|
1807
|
+
currentOperationMode = !power ? 0 : (operationMode === 1 ? 1 : [0, 1][forcedHotWaterMode]); //OFF, HEAT, COOL
|
|
1769
1808
|
targetOperationMode = [3, 1][forcedHotWaterMode] //OFF, HEAT, COOL, AUTO
|
|
1770
1809
|
roomTemperature = tankWaterTemperature;
|
|
1771
1810
|
setTemperature = setTankWaterTemperature;
|
|
@@ -1779,7 +1818,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1779
1818
|
case caseZone2: //Zone 2 - HEAT THERMOSTAT, HEAT FLOW, HEAT CURVE, COOL THERMOSTAT, COOL FLOW, FLOOR DRY UP
|
|
1780
1819
|
name = zone2Name;
|
|
1781
1820
|
operationModeZone = operationMode;
|
|
1782
|
-
currentOperationMode = !power ? 0 : idleZone2 ? 0 : [1, 1, 1, 2, 2, 1][operationModeZone2]; //OFF, HEAT, COOL
|
|
1821
|
+
currentOperationMode = !power ? 0 : (idleZone2 ? 0 : [1, 1, 1, 2, 2, 1][operationModeZone2]); //OFF, HEAT, COOL
|
|
1783
1822
|
targetOperationMode = [1, 2, 3, 1, 2, 1][operationModeZone2]; //OFF, HEAT, COOL, AUTO
|
|
1784
1823
|
|
|
1785
1824
|
switch (operationModeZone2) {
|
|
@@ -1961,7 +2000,9 @@ class DeviceAtw extends EventEmitter {
|
|
|
1961
2000
|
};
|
|
1962
2001
|
this.accessory = obj;
|
|
1963
2002
|
|
|
1964
|
-
//
|
|
2003
|
+
//other sensors
|
|
2004
|
+
this.inStandbyService?.updateCharacteristic(Characteristic.ContactSensorState, inStandbyMode);
|
|
2005
|
+
this.connectService?.updateCharacteristic(Characteristic.ContactSensorState, isConnected);
|
|
1965
2006
|
this.errorService?.updateCharacteristic(Characteristic.ContactSensorState, isInError);
|
|
1966
2007
|
|
|
1967
2008
|
//holiday mode
|