homebridge-melcloud-control 4.2.6-beta.13 → 4.2.6-beta.15
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 +1 -3
- package/package.json +1 -1
- package/src/deviceata.js +37 -19
- package/src/deviceatw.js +34 -16
- package/src/deviceerv.js +37 -11
- package/src/functions.js +4 -0
package/README.md
CHANGED
|
@@ -86,8 +86,6 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
|
|
|
86
86
|
* Outdoor temperature.
|
|
87
87
|
* Frost protection.
|
|
88
88
|
* Overheat protection.
|
|
89
|
-
* Frost protection.
|
|
90
|
-
* Overheat protection.
|
|
91
89
|
* Holiday mode.
|
|
92
90
|
* Shedules control.
|
|
93
91
|
* Shedule active.
|
|
@@ -255,7 +253,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
|
|
|
255
253
|
| `ataDevices[].inStandbySensor` | This enable `In Standby Mode` sensor to use with automations in HomeKit app. |
|
|
256
254
|
| `ataDevices[].connectSensor` | This enable `Connect State` sensor to use with automations in HomeKit app. |
|
|
257
255
|
| `ataDevices[].errorSensor` | This enable `Error` sensor to use with automations in HomeKit app. |
|
|
258
|
-
| `ataDevices[].frostProtectionSupport` | This enable extra `Frost
|
|
256
|
+
| `ataDevices[].frostProtectionSupport` | This enable extra `Frost Protection` control and sensors to use with automations in HomeKit app. |
|
|
259
257
|
| `ataDevices[].overheatProtectionSupport` | This enable extra `Overheat Protection` control and sensors to use with automations in HomeKit app. |
|
|
260
258
|
| `ataDevices[].holidayModeSupport` | This enable extra `Holiday Mode` control and sensors to use with automations in HomeKit app. |
|
|
261
259
|
| `ataDevices[].refreshInterval` | Here set the background devices state refresh time in (sec), default `5s`. |
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.2.6-beta.
|
|
4
|
+
"version": "4.2.6-beta.15",
|
|
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
|
@@ -2,6 +2,7 @@ import EventEmitter from 'events';
|
|
|
2
2
|
import MelCloudAta from './melcloudata.js';
|
|
3
3
|
import RestFul from './restful.js';
|
|
4
4
|
import Mqtt from './mqtt.js';
|
|
5
|
+
import Functions from './functions.js';
|
|
5
6
|
import { TemperatureDisplayUnits, AirConditioner } from './constants.js';
|
|
6
7
|
let Accessory, Characteristic, Service, Categories, AccessoryUUID;
|
|
7
8
|
|
|
@@ -96,6 +97,11 @@ class DeviceAta extends EventEmitter {
|
|
|
96
97
|
button.previousValue = null;
|
|
97
98
|
}
|
|
98
99
|
|
|
100
|
+
this.functions = new Functions(this.logWarn, this.logError, this.logDebug)
|
|
101
|
+
.on('warn', warn => this.emit('warn', warn))
|
|
102
|
+
.on('error', error => this.emit('error', error))
|
|
103
|
+
.on('debug', debug => this.emit('debug', debug));
|
|
104
|
+
|
|
99
105
|
//device data
|
|
100
106
|
this.deviceData = {};
|
|
101
107
|
|
|
@@ -1469,6 +1475,9 @@ class DeviceAta extends EventEmitter {
|
|
|
1469
1475
|
scheduleEnabled: scheduleEnabled
|
|
1470
1476
|
};
|
|
1471
1477
|
|
|
1478
|
+
//characteristics array
|
|
1479
|
+
const characteristics = [];
|
|
1480
|
+
|
|
1472
1481
|
//operating mode 0, HEAT, DRY, COOL, 4, 5, 6, FAN, AUTO, ISEE HEAT, ISEE DRY, ISEE COOL
|
|
1473
1482
|
switch (this.displayType) {
|
|
1474
1483
|
case 1: //Heater Cooler
|
|
@@ -1534,18 +1543,20 @@ class DeviceAta extends EventEmitter {
|
|
|
1534
1543
|
}
|
|
1535
1544
|
this.accessory = obj;
|
|
1536
1545
|
|
|
1537
|
-
//
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
if (
|
|
1546
|
+
//create characteristics
|
|
1547
|
+
characteristics.push(
|
|
1548
|
+
{ type: Characteristic.Active, value: power },
|
|
1549
|
+
{ type: Characteristic.CurrentHeaterCoolerState, value: obj.currentOperationMode },
|
|
1550
|
+
{ type: Characteristic.TargetHeaterCoolerState, value: obj.targetOperationMode },
|
|
1551
|
+
{ type: Characteristic.CurrentTemperature, value: roomTemperature },
|
|
1552
|
+
{ type: Characteristic.LockPhysicalControls, value: obj.lockPhysicalControl },
|
|
1553
|
+
{ type: Characteristic.TemperatureDisplayUnits, value: obj.useFahrenheit },
|
|
1554
|
+
{ type: Characteristic.CoolingThresholdTemperature, value: operationMode === 8 ? defaultCoolingSetTemperature : setTemperature }
|
|
1555
|
+
);
|
|
1556
|
+
|
|
1557
|
+
if (supportsHeat) characteristics.push({ type: Characteristic.HeatingThresholdTemperature, value: operationMode === 8 ? defaultHeatingSetTemperature : setTemperature });
|
|
1558
|
+
if (supportsFanSpeed) characteristics.push({ type: Characteristic.RotationSpeed, value: obj.currentFanSpeed });
|
|
1559
|
+
if (supportsSwingFunction) characteristics.push({ type: Characteristic.SwingMode, value: obj.currentSwingMode });
|
|
1549
1560
|
break;
|
|
1550
1561
|
case 2: //Thermostat
|
|
1551
1562
|
// Helper for mapping target operation in DRY / FAN modes
|
|
@@ -1606,16 +1617,23 @@ class DeviceAta extends EventEmitter {
|
|
|
1606
1617
|
obj.operationModeSetPropsValidValues = supportsAuto && supportsHeat ? [0, 1, 2, 3] : !supportsAuto && supportsHeat ? [0, 1, 2] : supportsAuto && !supportsHeat ? [0, 2, 3] : [0, 2];
|
|
1607
1618
|
this.accessory = obj;
|
|
1608
1619
|
|
|
1609
|
-
//
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1620
|
+
//create characteristics
|
|
1621
|
+
characteristics.push(
|
|
1622
|
+
{ type: Characteristic.CurrentHeatingCoolingState, value: obj.currentOperationMode },
|
|
1623
|
+
{ type: Characteristic.TargetHeatingCoolingState, value: obj.targetOperationMode },
|
|
1624
|
+
{ type: Characteristic.CurrentTemperature, value: roomTemperature },
|
|
1625
|
+
{ type: Characteristic.TargetTemperature, value: setTemperature },
|
|
1626
|
+
{ type: Characteristic.TemperatureDisplayUnits, value: obj.useFahrenheit }
|
|
1627
|
+
);
|
|
1616
1628
|
break;
|
|
1617
1629
|
};
|
|
1618
1630
|
|
|
1631
|
+
//update services
|
|
1632
|
+
for (const { type, value } of characteristics) {
|
|
1633
|
+
if (!this.functions.isValidValue(value)) continue;
|
|
1634
|
+
this.melCloudService?.updateCharacteristic(type, value);
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1619
1637
|
//other sensors
|
|
1620
1638
|
this.roomTemperatureSensorService?.updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature);
|
|
1621
1639
|
this.outdoorTemperatureSensorService?.updateCharacteristic(Characteristic.CurrentTemperature, outdoorTemperature);
|
package/src/deviceatw.js
CHANGED
|
@@ -2,6 +2,7 @@ import EventEmitter from 'events';
|
|
|
2
2
|
import MelCloudAtw from './melcloudatw.js';
|
|
3
3
|
import RestFul from './restful.js';
|
|
4
4
|
import Mqtt from './mqtt.js';
|
|
5
|
+
import Functions from './functions.js';
|
|
5
6
|
import { TemperatureDisplayUnits, HeatPump } from './constants.js';
|
|
6
7
|
let Accessory, Characteristic, Service, Categories, AccessoryUUID;
|
|
7
8
|
|
|
@@ -97,6 +98,11 @@ class DeviceAtw extends EventEmitter {
|
|
|
97
98
|
button.previousValue = null;
|
|
98
99
|
}
|
|
99
100
|
|
|
101
|
+
this.functions = new Functions(this.logWarn, this.logError, this.logDebug)
|
|
102
|
+
.on('warn', warn => this.emit('warn', warn))
|
|
103
|
+
.on('error', error => this.emit('error', error))
|
|
104
|
+
.on('debug', debug => this.emit('debug', debug));
|
|
105
|
+
|
|
100
106
|
//device data
|
|
101
107
|
this.deviceData = {};
|
|
102
108
|
|
|
@@ -1671,6 +1677,9 @@ class DeviceAtw extends EventEmitter {
|
|
|
1671
1677
|
zonesSensors: []
|
|
1672
1678
|
};
|
|
1673
1679
|
|
|
1680
|
+
//characteristics array
|
|
1681
|
+
const characteristics = [];
|
|
1682
|
+
|
|
1674
1683
|
//default values
|
|
1675
1684
|
let name = 'Heat Pump'
|
|
1676
1685
|
let operationModeZone = 0;
|
|
@@ -1787,15 +1796,17 @@ class DeviceAtw extends EventEmitter {
|
|
|
1787
1796
|
break;
|
|
1788
1797
|
};
|
|
1789
1798
|
|
|
1790
|
-
//
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
+
//create characteristics
|
|
1800
|
+
characteristics.push(
|
|
1801
|
+
{ type: Characteristic.Active, value: power },
|
|
1802
|
+
{ type: Characteristic.CurrentHeaterCoolerState, value: currentOperationMode },
|
|
1803
|
+
{ type: Characteristic.TargetHeaterCoolerState, value: targetOperationMode },
|
|
1804
|
+
{ type: Characteristic.CurrentTemperature, value: roomTemperature },
|
|
1805
|
+
{ type: Characteristic.LockPhysicalControls, value: lockPhysicalControl },
|
|
1806
|
+
{ type: Characteristic.TemperatureDisplayUnits, value: obj.useFahrenheit }
|
|
1807
|
+
);
|
|
1808
|
+
|
|
1809
|
+
if (heatCoolModes === 0 || heatCoolModes === 2) characteristics.push({ type: Characteristic.CoolingThresholdTemperature, value: setTemperature });
|
|
1799
1810
|
break;
|
|
1800
1811
|
case 2: //Thermostat
|
|
1801
1812
|
switch (i) {
|
|
@@ -1891,16 +1902,23 @@ class DeviceAtw extends EventEmitter {
|
|
|
1891
1902
|
break;
|
|
1892
1903
|
};
|
|
1893
1904
|
|
|
1894
|
-
//
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1905
|
+
//create characteristics
|
|
1906
|
+
characteristics.push(
|
|
1907
|
+
{ type: Characteristic.CurrentHeatingCoolingState, value: currentOperationMode },
|
|
1908
|
+
{ type: Characteristic.TargetHeatingCoolingState, value: targetOperationMode },
|
|
1909
|
+
{ type: Characteristic.CurrentTemperature, value: roomTemperature },
|
|
1910
|
+
{ type: Characteristic.TargetTemperature, value: setTemperature },
|
|
1911
|
+
{ type: Characteristic.TemperatureDisplayUnits, value: obj.useFahrenheit }
|
|
1912
|
+
);
|
|
1901
1913
|
break;
|
|
1902
1914
|
};
|
|
1903
1915
|
|
|
1916
|
+
//update services
|
|
1917
|
+
for (const { type, value } of characteristics) {
|
|
1918
|
+
if (!this.functions.isValidValue(value)) continue;
|
|
1919
|
+
this.melCloudService?.[i]?.updateCharacteristic(type, value);
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1904
1922
|
//add every zone to array
|
|
1905
1923
|
const zone = {
|
|
1906
1924
|
name: name,
|
package/src/deviceerv.js
CHANGED
|
@@ -2,6 +2,7 @@ import EventEmitter from 'events';
|
|
|
2
2
|
import MelCloudErv from './melclouderv.js';
|
|
3
3
|
import RestFul from './restful.js';
|
|
4
4
|
import Mqtt from './mqtt.js';
|
|
5
|
+
import Functions from './functions.js';
|
|
5
6
|
import { TemperatureDisplayUnits, Ventilation } from './constants.js';
|
|
6
7
|
let Accessory, Characteristic, Service, Categories, AccessoryUUID;
|
|
7
8
|
|
|
@@ -90,6 +91,11 @@ class DeviceErv extends EventEmitter {
|
|
|
90
91
|
button.previousValue = null;
|
|
91
92
|
}
|
|
92
93
|
|
|
94
|
+
this.functions = new Functions(this.logWarn, this.logError, this.logDebug)
|
|
95
|
+
.on('warn', warn => this.emit('warn', warn))
|
|
96
|
+
.on('error', error => this.emit('error', error))
|
|
97
|
+
.on('debug', debug => this.emit('debug', debug));
|
|
98
|
+
|
|
93
99
|
//device data
|
|
94
100
|
this.deviceData = {};
|
|
95
101
|
|
|
@@ -1257,6 +1263,9 @@ class DeviceErv extends EventEmitter {
|
|
|
1257
1263
|
scheduleEnabled: scheduleEnabled
|
|
1258
1264
|
};
|
|
1259
1265
|
|
|
1266
|
+
//characteristics array
|
|
1267
|
+
const characteristics = [];
|
|
1268
|
+
|
|
1260
1269
|
//ventilation mode - 0, HEAT, 2, COOL, 4, 5, 6, FAN, AUTO
|
|
1261
1270
|
switch (this.displayType) {
|
|
1262
1271
|
case 1: //Heater Cooler
|
|
@@ -1313,17 +1322,19 @@ class DeviceErv extends EventEmitter {
|
|
|
1313
1322
|
}
|
|
1314
1323
|
this.accessory = obj;
|
|
1315
1324
|
|
|
1316
|
-
//
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1325
|
+
//create characteristics
|
|
1326
|
+
characteristics.push(
|
|
1327
|
+
{ type: Characteristic.Active, value: power },
|
|
1328
|
+
{ type: Characteristic.CurrentHeaterCoolerState, value: obj.currentOperationMode },
|
|
1329
|
+
{ type: Characteristic.TargetHeaterCoolerState, value: obj.targetOperationMode },
|
|
1330
|
+
{ type: Characteristic.CurrentTemperature, value: roomTemperature },
|
|
1331
|
+
{ type: Characteristic.RotationSpeed, value: obj.fanSpeed },
|
|
1332
|
+
{ type: Characteristic.LockPhysicalControls, value: obj.lockPhysicalControl },
|
|
1333
|
+
{ type: Characteristic.TemperatureDisplayUnits, value: obj.useFahrenheit },
|
|
1334
|
+
);
|
|
1335
|
+
|
|
1336
|
+
if (supportsCoolOperationMode) characteristics.push({ type: Characteristic.CoolingThresholdTemperature, value: defaultCoolingSetTemperature });
|
|
1337
|
+
if (supportsHeatOperationMode) characteristics.push({ type: Characteristic.HeatingThresholdTemperature, value: defaultHeatingSetTemperature });
|
|
1327
1338
|
break;
|
|
1328
1339
|
case 2: //Thermostat
|
|
1329
1340
|
//operation mode - 0, HEAT, 2, COOL, 4, 5, 6, FAN, AUTO
|
|
@@ -1369,9 +1380,24 @@ class DeviceErv extends EventEmitter {
|
|
|
1369
1380
|
.updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature)
|
|
1370
1381
|
.updateCharacteristic(Characteristic.TargetTemperature, setTemperature)
|
|
1371
1382
|
.updateCharacteristic(Characteristic.TemperatureDisplayUnits, obj.useFahrenheit);
|
|
1383
|
+
|
|
1384
|
+
//create characteristics
|
|
1385
|
+
characteristics.push(
|
|
1386
|
+
{ type: Characteristic.CurrentHeatingCoolingState, value: obj.currentOperationMode },
|
|
1387
|
+
{ type: Characteristic.TargetHeatingCoolingState, value: obj.targetOperationMode },
|
|
1388
|
+
{ type: Characteristic.CurrentTemperature, value: roomTemperature },
|
|
1389
|
+
{ type: Characteristic.TargetTemperature, value: setTemperature },
|
|
1390
|
+
{ type: Characteristic.TemperatureDisplayUnits, value: obj.useFahrenheit },
|
|
1391
|
+
);
|
|
1372
1392
|
break;
|
|
1373
1393
|
};
|
|
1374
1394
|
|
|
1395
|
+
//update services
|
|
1396
|
+
for (const { type, value } of characteristics) {
|
|
1397
|
+
if (!this.functions.isValidValue(value)) continue;
|
|
1398
|
+
this.melCloudService?.updateCharacteristic(type, value);
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1375
1401
|
//update temperature sensors
|
|
1376
1402
|
this.roomTemperatureSensorService?.updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature);
|
|
1377
1403
|
this.outdoorTemperatureSensorService?.updateCharacteristic(Characteristic.CurrentTemperature, outdoorTemperature);
|