homebridge-melcloud-control 4.2.6-beta.14 → 4.2.6-beta.16

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/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.14",
4
+ "version": "4.2.6-beta.16",
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
 
@@ -1535,7 +1541,6 @@ class DeviceAta extends EventEmitter {
1535
1541
  obj.currentFanSpeed = speeds[setFanSpeed];
1536
1542
  obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? max + 1 : max;
1537
1543
  }
1538
- this.accessory = obj;
1539
1544
 
1540
1545
  //create characteristics
1541
1546
  characteristics.push(
@@ -1609,7 +1614,6 @@ class DeviceAta extends EventEmitter {
1609
1614
  obj.operationModeSetPropsMinValue = 0
1610
1615
  obj.operationModeSetPropsMaxValue = supportsAuto && supportsHeat ? 3 : !supportsAuto && supportsHeat ? 2 : supportsAuto && !supportsHeat ? 3 : 2;
1611
1616
  obj.operationModeSetPropsValidValues = supportsAuto && supportsHeat ? [0, 1, 2, 3] : !supportsAuto && supportsHeat ? [0, 1, 2] : supportsAuto && !supportsHeat ? [0, 2, 3] : [0, 2];
1612
- this.accessory = obj;
1613
1617
 
1614
1618
  //create characteristics
1615
1619
  characteristics.push(
@@ -1621,6 +1625,7 @@ class DeviceAta extends EventEmitter {
1621
1625
  );
1622
1626
  break;
1623
1627
  };
1628
+ this.accessory = obj;
1624
1629
 
1625
1630
  //update services
1626
1631
  for (const { type, value } of characteristics) {
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
 
@@ -1907,12 +1913,6 @@ class DeviceAtw extends EventEmitter {
1907
1913
  break;
1908
1914
  };
1909
1915
 
1910
- //update services
1911
- for (const { type, value } of characteristics) {
1912
- if (!this.functions.isValidValue(value)) continue;
1913
- this.melCloudService?.[i]?.updateCharacteristic(type, value);
1914
- }
1915
-
1916
1916
  //add every zone to array
1917
1917
  const zone = {
1918
1918
  name: name,
@@ -2055,6 +2055,12 @@ class DeviceAtw extends EventEmitter {
2055
2055
  };
2056
2056
  this.accessory = obj;
2057
2057
 
2058
+ //update services
2059
+ for (const { type, value } of characteristics) {
2060
+ if (!this.functions.isValidValue(value)) continue;
2061
+ this.melCloudService?.[i]?.updateCharacteristic(type, value);
2062
+ }
2063
+
2058
2064
  //other sensors
2059
2065
  this.inStandbyService?.updateCharacteristic(Characteristic.ContactSensorState, inStandbyMode);
2060
2066
  this.connectService?.updateCharacteristic(Characteristic.ContactSensorState, isConnected);
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
 
@@ -1314,7 +1320,6 @@ class DeviceErv extends EventEmitter {
1314
1320
  obj.fanSpeed = speeds[setFanSpeed];
1315
1321
  obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? max + 1 : max;
1316
1322
  }
1317
- this.accessory = obj;
1318
1323
 
1319
1324
  //create characteristics
1320
1325
  characteristics.push(
@@ -1365,7 +1370,6 @@ class DeviceErv extends EventEmitter {
1365
1370
  obj.operationModeSetPropsMinValue = supportsAutoVentilationMode ? 0 : 0;
1366
1371
  obj.operationModeSetPropsMaxValue = supportsAutoVentilationMode ? 3 : 2;
1367
1372
  obj.operationModeSetPropsValidValues = supportsAutoVentilationMode ? (supportsBypassVentilationMode ? [0, 1, 2, 3] : [0, 2, 3]) : (supportsBypassVentilationMode ? [0, 1, 2] : [0, 2]);
1368
- this.accessory = obj;
1369
1373
 
1370
1374
  //update characteristics
1371
1375
  this.melCloudService
@@ -1386,6 +1390,8 @@ class DeviceErv extends EventEmitter {
1386
1390
  break;
1387
1391
  };
1388
1392
 
1393
+ this.accessory = obj;
1394
+
1389
1395
  //update services
1390
1396
  for (const { type, value } of characteristics) {
1391
1397
  if (!this.functions.isValidValue(value)) continue;