homebridge-melcloud-control 3.8.0-beta.1 → 3.8.0-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.
@@ -1865,7 +1865,19 @@
1865
1865
  }
1866
1866
  ]
1867
1867
  }
1868
- ]
1868
+ ],
1869
+ "condition": {
1870
+ "functionBody": "return model.accounts[arrayIndices].ataDevices.length > 0;"
1871
+ }
1872
+ },
1873
+ {
1874
+ "key": "accounts[]",
1875
+ "type": "tabarray",
1876
+ "title": "{{ value.title }}",
1877
+ "items": [],
1878
+ "condition": {
1879
+ "functionBody": "return model.accounts[arrayIndices].ataDevices.length === 0;"
1880
+ }
1869
1881
  }
1870
1882
  ]
1871
1883
  },
@@ -1895,8 +1907,8 @@
1895
1907
  "expanded": false,
1896
1908
  "items": [
1897
1909
  "accounts[].atwDevices[].name",
1898
- "accounts[].atwDevices[].refreshInterval",
1899
- "accounts[].atwDevices[].hideZone"
1910
+ "accounts[].atwDevices[].hideZone",
1911
+ "accounts[].atwDevices[].refreshInterval"
1900
1912
  ]
1901
1913
  },
1902
1914
  {
@@ -1960,7 +1972,19 @@
1960
1972
  }
1961
1973
  ]
1962
1974
  }
1963
- ]
1975
+ ],
1976
+ "condition": {
1977
+ "functionBody": "return model.accounts[arrayIndices].atwDevices.length > 0;"
1978
+ }
1979
+ },
1980
+ {
1981
+ "key": "accounts[]",
1982
+ "type": "tabarray",
1983
+ "title": "{{ value.title }}",
1984
+ "items": [],
1985
+ "condition": {
1986
+ "functionBody": "return model.accounts[arrayIndices].atwDevices.length === 0;"
1987
+ }
1964
1988
  }
1965
1989
  ]
1966
1990
  },
@@ -2048,7 +2072,19 @@
2048
2072
  }
2049
2073
  ]
2050
2074
  }
2051
- ]
2075
+ ],
2076
+ "condition": {
2077
+ "functionBody": "return model.accounts[arrayIndices].ervDevices.length > 0;"
2078
+ }
2079
+ },
2080
+ {
2081
+ "key": "accounts[]",
2082
+ "type": "tabarray",
2083
+ "title": "{{ value.title }}",
2084
+ "items": [],
2085
+ "condition": {
2086
+ "functionBody": "return model.accounts[arrayIndices].ervDevices.length === 0;"
2087
+ }
2052
2088
  }
2053
2089
  ]
2054
2090
  }
package/index.js CHANGED
@@ -169,7 +169,7 @@ class MelCloudPlatform {
169
169
  const stopImpulseGenerator = startDone ? await impulseGenerator.stop() : false;
170
170
 
171
171
  //start impulse generator
172
- const startImpulseGenerator = startDone ? await airConditioner.startImpulseGenerator() : false
172
+ const startImpulseGenerator = stopImpulseGenerator ? await airConditioner.startImpulseGenerator() : false
173
173
  } catch (error) {
174
174
  const emitLog = disableLogError ? false : log.error(`${accountName}, ${deviceTypeText}, ${deviceName}, ${error}, trying again.`);
175
175
  };
@@ -235,7 +235,7 @@ class MelCloudPlatform {
235
235
  const stopImpulseGenerator = startDone ? await impulseGenerator.stop() : false;
236
236
 
237
237
  //start impulse generator
238
- const startImpulseGenerator = startDone ? await heatPump.startImpulseGenerator() : false
238
+ const startImpulseGenerator = stopImpulseGenerator ? await heatPump.startImpulseGenerator() : false
239
239
  } catch (error) {
240
240
  const emitLog = disableLogError ? false : log.error(`${accountName}, ${deviceTypeText}, ${deviceName}, ${error}, trying again.`);
241
241
  };
@@ -301,7 +301,7 @@ class MelCloudPlatform {
301
301
  const stopImpulseGenerator = startDone ? await impulseGenerator.stop() : false;
302
302
 
303
303
  //start impulse generator
304
- const startImpulseGenerator = startDone ? await energyRecoveryVentilation.startImpulseGenerator() : false
304
+ const startImpulseGenerator = stopImpulseGenerator ? await energyRecoveryVentilation.startImpulseGenerator() : false
305
305
  } catch (error) {
306
306
  const emitLog = disableLogError ? false : log.error(`${accountName}, ${deviceTypeText}, ${deviceName}, ${error}, trying again.`);
307
307
  };
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.1",
4
+ "version": "3.8.0-beta.10",
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,8 @@ 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();
1407
+ await new Promise(resolve => setTimeout(resolve, 500));
1411
1408
 
1412
1409
  return true;
1413
1410
  } 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,8 @@ 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();
1958
+ await new Promise(resolve => setTimeout(resolve, 500));
1962
1959
 
1963
1960
  return true;
1964
1961
  } 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,8 @@ 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();
1272
+ await new Promise(resolve => setTimeout(resolve, 500));
1276
1273
 
1277
1274
  return true;
1278
1275
  } catch (error) {