homebridge-melcloud-control 3.8.0-beta.8 → 3.8.0-beta.9

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.
@@ -1867,7 +1867,7 @@
1867
1867
  }
1868
1868
  ],
1869
1869
  "condition": {
1870
- "functionBody": "return model.accounts[arrayIndices].ataDevices.length >= 1;"
1870
+ "functionBody": "return model.accounts[arrayIndices].ataDevices.length > 0;"
1871
1871
  }
1872
1872
  },
1873
1873
  {
@@ -1876,7 +1876,7 @@
1876
1876
  "title": "{{ value.title }}",
1877
1877
  "items": [],
1878
1878
  "condition": {
1879
- "functionBody": "return model.accounts[arrayIndices].ataDevices.length < 1;"
1879
+ "functionBody": "return model.accounts[arrayIndices].ataDevices.length === 0;"
1880
1880
  }
1881
1881
  }
1882
1882
  ]
@@ -1974,7 +1974,7 @@
1974
1974
  }
1975
1975
  ],
1976
1976
  "condition": {
1977
- "functionBody": "return model.accounts[arrayIndices].atwDevices.length >= 1;"
1977
+ "functionBody": "return model.accounts[arrayIndices].atwDevices.length > 0;"
1978
1978
  }
1979
1979
  },
1980
1980
  {
@@ -1983,7 +1983,7 @@
1983
1983
  "title": "{{ value.title }}",
1984
1984
  "items": [],
1985
1985
  "condition": {
1986
- "functionBody": "return model.accounts[arrayIndices].atwDevices.length < 1;"
1986
+ "functionBody": "return model.accounts[arrayIndices].atwDevices.length === 0;"
1987
1987
  }
1988
1988
  }
1989
1989
  ]
@@ -2074,7 +2074,7 @@
2074
2074
  }
2075
2075
  ],
2076
2076
  "condition": {
2077
- "functionBody": "return model.accounts[arrayIndices].ervDevices.length >= 1;"
2077
+ "functionBody": "return model.accounts[arrayIndices].ervDevices.length > 0;"
2078
2078
  }
2079
2079
  },
2080
2080
  {
@@ -2083,7 +2083,7 @@
2083
2083
  "title": "{{ value.title }}",
2084
2084
  "items": [],
2085
2085
  "condition": {
2086
- "functionBody": "return model.accounts[arrayIndices].ervDevices.length < 1;"
2086
+ "functionBody": "return model.accounts[arrayIndices].ervDevices.length === 0;"
2087
2087
  }
2088
2088
  }
2089
2089
  ]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "3.8.0-beta.8",
4
+ "version": "3.8.0-beta.9",
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
@@ -971,7 +971,7 @@ class DeviceAta extends EventEmitter {
971
971
  this.firmwareRevision = firmwareAppVersion;
972
972
  this.displayDeviceInfo = false;
973
973
  })
974
- .on('deviceState', (deviceData) => {
974
+ .on('deviceState', async (deviceData) => {
975
975
  this.deviceData = deviceData;
976
976
 
977
977
  //presets
@@ -1369,6 +1369,13 @@ class DeviceAta extends EventEmitter {
1369
1369
  this.emit('message', `Temperature display unit: ${this.accessory.temperatureUnit}`);
1370
1370
  this.emit('message', `Lock physical controls: ${this.accessory.lockPhysicalControl ? 'LOCKED' : 'UNLOCKED'}`);
1371
1371
  };
1372
+
1373
+ //prepare accessory
1374
+ if (this.startPrepareAccessory) {
1375
+ const accessory = await this.prepareAccessory(this.accountInfo, deviceData, this.deviceId, this.deviceTypeText, this.deviceName, this.accountName);
1376
+ this.emit('publishAccessory', accessory);
1377
+ this.startPrepareAccessory = false;
1378
+ }
1372
1379
  })
1373
1380
  .on('success', (success) => {
1374
1381
  this.emit('success', success);
@@ -1396,18 +1403,7 @@ class DeviceAta extends EventEmitter {
1396
1403
  const startExternalIntegrations = this.restFul.enable || this.mqtt.enable ? await this.externalIntegrations() : false;
1397
1404
 
1398
1405
  //check state
1399
- const deviceData = await this.melCloudAta.checkState();
1400
-
1401
- if (deviceData === false) {
1402
- return null;
1403
- }
1404
-
1405
- //prepare accessory
1406
- if (this.startPrepareAccessory) {
1407
- const accessory = await this.prepareAccessory(this.accountInfo, deviceData, this.deviceId, this.deviceTypeText, this.deviceName, this.accountName);
1408
- this.emit('publishAccessory', accessory);
1409
- this.startPrepareAccessory = false;
1410
- }
1406
+ await this.melCloudAta.checkState();
1411
1407
 
1412
1408
  return true;
1413
1409
  } catch (error) {
package/src/deviceatw.js CHANGED
@@ -1331,7 +1331,7 @@ class DeviceAtw extends EventEmitter {
1331
1331
  this.firmwareRevision = firmwareAppVersion;
1332
1332
  this.displayDeviceInfo = false;
1333
1333
  })
1334
- .on('deviceState', (deviceData) => {
1334
+ .on('deviceState', async (deviceData) => {
1335
1335
  this.deviceData = deviceData;
1336
1336
 
1337
1337
  //presets
@@ -1920,6 +1920,13 @@ class DeviceAtw extends EventEmitter {
1920
1920
  };
1921
1921
  };
1922
1922
  };
1923
+
1924
+ //prepare accessory
1925
+ if (this.startPrepareAccessory) {
1926
+ const accessory = await this.prepareAccessory(this.accountInfo, deviceData, this.deviceId, this.deviceTypeText, this.deviceName, this.accountName);
1927
+ this.emit('publishAccessory', accessory);
1928
+ this.startPrepareAccessory = false;
1929
+ }
1923
1930
  })
1924
1931
  .on('success', (success) => {
1925
1932
  this.emit('success', success);
@@ -1947,18 +1954,7 @@ class DeviceAtw extends EventEmitter {
1947
1954
  const startExternalIntegrations = this.restFul.enable || this.mqtt.enable ? await this.externalIntegrations() : false;
1948
1955
 
1949
1956
  //check state
1950
- const deviceData = await this.melCloudAtw.checkState();
1951
-
1952
- if (deviceData === false) {
1953
- return null;
1954
- }
1955
-
1956
- //prepare accessory
1957
- if (this.startPrepareAccessory) {
1958
- const accessory = await this.prepareAccessory(this.accountInfo, deviceData, this.deviceId, this.deviceTypeText, this.deviceName, this.accountName);
1959
- this.emit('publishAccessory', accessory);
1960
- this.startPrepareAccessory = false;
1961
- }
1957
+ await this.melCloudAtw.checkState();
1962
1958
 
1963
1959
  return true;
1964
1960
  } catch (error) {
package/src/deviceerv.js CHANGED
@@ -889,7 +889,7 @@ class DeviceErv extends EventEmitter {
889
889
  this.firmwareRevision = firmwareAppVersion;
890
890
  this.displayDeviceInfo = false;
891
891
  })
892
- .on('deviceState', (deviceData) => {
892
+ .on('deviceState', async (deviceData) => {
893
893
  this.deviceData = deviceData;
894
894
 
895
895
  //presets
@@ -1234,6 +1234,13 @@ class DeviceErv extends EventEmitter {
1234
1234
  const info7 = hasPM25Sensor ? this.emit('message', `PM2.5 air quality: ${Ventilation.PM25AirQuality[pM25AirQuality]}`) : false;
1235
1235
  const info8 = hasPM25Sensor ? this.emit('message', `PM2.5 level: ${pM25Level} µg/m`) : false;
1236
1236
  };
1237
+
1238
+ //prepare accessory
1239
+ if (this.startPrepareAccessory) {
1240
+ const accessory = await this.prepareAccessory(this.accountInfo, deviceData, this.deviceId, this.deviceTypeText, this.deviceName, this.accountName);
1241
+ this.emit('publishAccessory', accessory);
1242
+ this.startPrepareAccessory = false;
1243
+ }
1237
1244
  })
1238
1245
  .on('success', (success) => {
1239
1246
  this.emit('success', success);
@@ -1261,18 +1268,7 @@ class DeviceErv extends EventEmitter {
1261
1268
  const startExternalIntegrations = this.restFul.enable || this.mqtt.enable ? await this.externalIntegrations() : false;
1262
1269
 
1263
1270
  //check state
1264
- const deviceData = await this.melCloudErv.checkState();
1265
-
1266
- if (deviceData === false) {
1267
- return null;
1268
- }
1269
-
1270
- //prepare accessory
1271
- if (this.startPrepareAccessory) {
1272
- const accessory = await this.prepareAccessory(this.accountInfo, deviceData, this.deviceId, this.deviceTypeText, this.deviceName, this.accountName);
1273
- this.emit('publishAccessory', accessory);
1274
- this.startPrepareAccessory = false;
1275
- }
1271
+ await this.melCloudErv.checkState();
1276
1272
 
1277
1273
  return true;
1278
1274
  } catch (error) {