homebridge-melcloud-control 4.2.2-beta.5 → 4.2.2-beta.7

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.
@@ -395,6 +395,12 @@
395
395
  "default": false,
396
396
  "description": "This enable extra outdoor temperature sensor to use with automations in HomeKit app."
397
397
  },
398
+ "connectSensor": {
399
+ "title": "Connect",
400
+ "type": "boolean",
401
+ "default": false,
402
+ "description": "This enable connect sensor to use with automations in HomeKit app."
403
+ },
398
404
  "errorSensor": {
399
405
  "title": "Error",
400
406
  "type": "boolean",
@@ -1107,6 +1113,12 @@
1107
1113
  "default": false,
1108
1114
  "description": "This enable extra Return Zone 2 temperature sensor to use with automations in HomeKit app."
1109
1115
  },
1116
+ "connectSensor": {
1117
+ "title": "Connect",
1118
+ "type": "boolean",
1119
+ "default": false,
1120
+ "description": "This enable connect sensor to use with automations in HomeKit app."
1121
+ },
1110
1122
  "errorSensor": {
1111
1123
  "title": "Error",
1112
1124
  "type": "boolean",
@@ -1579,6 +1591,12 @@
1579
1591
  "default": false,
1580
1592
  "description": "This enable extra supply temperature sensor to use with automations in HomeKit app."
1581
1593
  },
1594
+ "connectSensor": {
1595
+ "title": "Connect",
1596
+ "type": "boolean",
1597
+ "default": false,
1598
+ "description": "This enable connect sensor to use with automations in HomeKit app."
1599
+ },
1582
1600
  "errorSensor": {
1583
1601
  "title": "Error",
1584
1602
  "type": "boolean",
@@ -2221,6 +2239,7 @@
2221
2239
  {
2222
2240
  "title": "System",
2223
2241
  "items": [
2242
+ "accounts[].ataDevices[].connectSensor",
2224
2243
  "accounts[].ataDevices[].errorSensor"
2225
2244
  ]
2226
2245
  },
@@ -2372,6 +2391,7 @@
2372
2391
  {
2373
2392
  "title": "System",
2374
2393
  "items": [
2394
+ "accounts[].atwDevices[].connectSensor",
2375
2395
  "accounts[].atwDevices[].errorSensor"
2376
2396
  ]
2377
2397
  },
@@ -2516,6 +2536,7 @@
2516
2536
  {
2517
2537
  "title": "System",
2518
2538
  "items": [
2539
+ "accounts[].ervDevices[].connectSensor",
2519
2540
  "accounts[].ervDevices[].errorSensor"
2520
2541
  ]
2521
2542
  },
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.2-beta.5",
4
+ "version": "4.2.2-beta.7",
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
@@ -35,6 +35,7 @@ class DeviceAta extends EventEmitter {
35
35
  this.autoDryFanMode = device.autoDryFanMode || 1; //NONE, AUTO, DRY, FAN
36
36
  this.temperatureSensor = device.temperatureSensor || false;
37
37
  this.temperatureOutdoorSensor = device.temperatureOutdoorSensor || false;
38
+ this.connectSensor = device.connectSensor || false;
38
39
  this.errorSensor = device.errorSensor || false;
39
40
  this.frostProtectionSupport = device.frostProtectionSupport || false;
40
41
  this.overheatProtectionSupport = device.overheatProtectionSupport || false;
@@ -655,10 +656,24 @@ class DeviceAta extends EventEmitter {
655
656
  accessory.addService(this.outdoorTemperatureSensorService);
656
657
  };
657
658
 
659
+ //connect sensor
660
+ if (this.connectSensor && this.accessory.isConnected !== null) {
661
+ if (this.logDebug) this.emit('debug', `Prepare error service`);
662
+ this.connectService = new Service.ContactSensor(`${serviceName} Connect`, `connectService${deviceId}`);
663
+ this.connectService.addOptionalCharacteristic(Characteristic.ConfiguredName);
664
+ this.connectService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Connect`);
665
+ this.connectService.getCharacteristic(Characteristic.ContactSensorState)
666
+ .onGet(async () => {
667
+ const state = this.accessory.isConnected;
668
+ return state;
669
+ })
670
+ accessory.addService(this.connectService);
671
+ }
672
+
658
673
  //error sensor
659
674
  if (this.errorSensor && this.accessory.isInError !== null) {
660
675
  if (this.logDebug) this.emit('debug', `Prepare error service`);
661
- this.errorService = new Service.ContactSensor(`${serviceName} Error`, `Error Sensor ${deviceId}`);
676
+ this.errorService = new Service.ContactSensor(`${serviceName} Error`, `errorService${deviceId}`);
662
677
  this.errorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
663
678
  this.errorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Error`);
664
679
  this.errorService.getCharacteristic(Characteristic.ContactSensorState)
@@ -1206,16 +1221,18 @@ class DeviceAta extends EventEmitter {
1206
1221
  this.deviceData = deviceData;
1207
1222
 
1208
1223
  //keys
1209
- const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
1210
- const tempStepKey = this.accountType === 'melcloud' ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
1211
- const errorKey = this.accountType === 'melcloud' ? 'HasError' : 'IsInError';
1212
- const supportAirDirectionKey = this.accountType === 'melcloud' ? 'AirDirectionFunction' : 'HasAirDirectionFunction';
1213
- const supportSwingKey = this.accountType === 'melcloud' ? 'SwingFunction' : 'HasSwing';
1214
- const supportVideWaneKey = this.accountType === 'melcloud' ? 'ModelSupportsWideVane' : 'SupportsWideVane';
1215
- const supportAutoKey = this.accountType === 'melcloud' ? 'ModelSupportsAuto' : 'HasAutoOperationMode';
1216
- const supportHeatKey = this.accountType === 'melcloud' ? 'ModelSupportsHeat' : 'HasHeatOperationMode';
1217
- const supportDryKey = this.accountType === 'melcloud' ? 'ModelSupportsDry' : 'HasDryOperationMode';
1218
- const supportCoolKey = this.accountType === 'melcloud' ? 'ModelSupportsCool' : 'HasCoolOperationMode';
1224
+ const accountTypeMelcloud = this.accountType === 'melcloud';
1225
+ const fanKey = accountTypeMelcloud ? 'FanSpeed' : 'SetFanSpeed';
1226
+ const tempStepKey = accountTypeMelcloud ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
1227
+ const connectKey = accountTypeMelcloud ? 'Offline' : 'IsConnected';
1228
+ const errorKey = accountTypeMelcloud ? 'HasError' : 'IsInError';
1229
+ const supportAirDirectionKey = accountTypeMelcloud ? 'AirDirectionFunction' : 'HasAirDirectionFunction';
1230
+ const supportSwingKey = accountTypeMelcloud ? 'SwingFunction' : 'HasSwing';
1231
+ const supportVideWaneKey = accountTypeMelcloud ? 'ModelSupportsWideVane' : 'SupportsWideVane';
1232
+ const supportAutoKey = accountTypeMelcloud ? 'ModelSupportsAuto' : 'HasAutoOperationMode';
1233
+ const supportHeatKey = accountTypeMelcloud ? 'ModelSupportsHeat' : 'HasHeatOperationMode';
1234
+ const supportDryKey = accountTypeMelcloud ? 'ModelSupportsDry' : 'HasDryOperationMode';
1235
+ const supportCoolKey = accountTypeMelcloud ? 'ModelSupportsCool' : 'HasCoolOperationMode';
1219
1236
 
1220
1237
  //presets schedules
1221
1238
  const scheduleEnabled = deviceData.ScheduleEnabled;
@@ -1235,7 +1252,6 @@ class DeviceAta extends EventEmitter {
1235
1252
  const hideDryModeControl = deviceData.HideDryModeControl ?? false;
1236
1253
 
1237
1254
  //device info
1238
- const accountTypeMelcloud = this.accountType === 'melcloud';
1239
1255
  const supportsAutomaticFanSpeed = deviceData.Device.HasAutomaticFanSpeed ?? false;
1240
1256
  const supportsAirDirectionFunction = deviceData.Device[supportAirDirectionKey];
1241
1257
  const supportsSwingFunction = deviceData.Device[supportSwingKey];
@@ -1275,6 +1291,7 @@ class DeviceAta extends EventEmitter {
1275
1291
  const prohibitPower = deviceData.Device.ProhibitPower ?? false;
1276
1292
  const temperatureStep = deviceData.Device[tempStepKey] ? 0.5 : 1;
1277
1293
  const outdoorTemperature = deviceData.Device.OutdoorTemperature;
1294
+ const isConnected = accountTypeMelcloud ? !deviceData.Device[connectKey] : deviceData.Device[connectKey];
1278
1295
  const isInError = deviceData.Device[errorKey];
1279
1296
 
1280
1297
  //accessory
@@ -1315,6 +1332,7 @@ class DeviceAta extends EventEmitter {
1315
1332
  temperatureStep: temperatureStep,
1316
1333
  useFahrenheit: this.useFahrenheit,
1317
1334
  temperatureUnit: TemperatureDisplayUnits[this.useFahrenheit],
1335
+ isConnected: isConnected,
1318
1336
  isInError: isInError,
1319
1337
  frostProtectionEnabled: frostProtectionEnabled,
1320
1338
  frostProtectionActive: frostProtectionActive,
@@ -1465,6 +1483,7 @@ class DeviceAta extends EventEmitter {
1465
1483
  //senors
1466
1484
  this.roomTemperatureSensorService?.updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature);
1467
1485
  this.outdoorTemperatureSensorService?.updateCharacteristic(Characteristic.CurrentTemperature, outdoorTemperature);
1486
+ this.connectService?.updateCharacteristic(Characteristic.ContactSensorState, isConnected);
1468
1487
  this.errorService?.updateCharacteristic(Characteristic.ContactSensorState, isInError);
1469
1488
 
1470
1489
  //frost protection
package/src/deviceatw.js CHANGED
@@ -37,6 +37,7 @@ 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.connectSensor = device.connectSensor || false;
40
41
  this.errorSensor = device.errorSensor || false;
41
42
  this.holidayModeSupport = device.holidayModeSupport || false;
42
43
  this.presets = this.accountType === 'melcloud' ? (device.presets || []).filter(preset => (preset.displayType ?? 0) > 0 && preset.id !== '0') : [];
@@ -1068,10 +1069,24 @@ class DeviceAtw extends EventEmitter {
1068
1069
  });
1069
1070
  };
1070
1071
 
1072
+ //connect sensor
1073
+ if (this.connectSensor && this.accessory.isConnected !== null) {
1074
+ if (this.logDebug) this.emit('debug', `Prepare error service`);
1075
+ this.connectService = new Service.ContactSensor(`${serviceName} Connect`, `connectService${deviceId}`);
1076
+ this.connectService.addOptionalCharacteristic(Characteristic.ConfiguredName);
1077
+ this.connectService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Connect`);
1078
+ this.connectService.getCharacteristic(Characteristic.ContactSensorState)
1079
+ .onGet(async () => {
1080
+ const state = this.accessory.isConnected;
1081
+ return state;
1082
+ })
1083
+ accessory.addService(this.connectService);
1084
+ }
1085
+
1071
1086
  //error sensor
1072
1087
  if (this.errorSensor && this.accessory.isInError !== null) {
1073
1088
  if (this.logDebug) this.emit('debug', `Prepare error service`);
1074
- this.errorService = new Service.ContactSensor(`${serviceName} Error`, `Error Sensor ${deviceId}`);
1089
+ this.errorService = new Service.ContactSensor(`${serviceName} Error`, `errorService${deviceId}`);
1075
1090
  this.errorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
1076
1091
  this.errorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Error`);
1077
1092
  this.errorService.getCharacteristic(Characteristic.ContactSensorState)
@@ -1082,6 +1097,7 @@ class DeviceAtw extends EventEmitter {
1082
1097
  accessory.addService(this.errorService);
1083
1098
  }
1084
1099
 
1100
+
1085
1101
  //holiday mode
1086
1102
  if (this.holidayModeSupport && this.accessory.holidayModeEnabled !== null) {
1087
1103
  //control
@@ -1470,7 +1486,9 @@ class DeviceAtw extends EventEmitter {
1470
1486
  this.deviceData = deviceData;
1471
1487
 
1472
1488
  //keys
1489
+ const accountTypeMelcloud = this.accountType === 'melcloud';
1473
1490
  const tempStepKey = this.accountType === 'melcloud' ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
1491
+ const connectKey = this.accountType === 'melcloud' ? 'Offline' : 'IsConnected';
1474
1492
  const errorKey = this.accountType === 'melcloud' ? 'HasError' : 'IsInError';
1475
1493
 
1476
1494
  //presets schedule
@@ -1518,6 +1536,7 @@ class DeviceAtw extends EventEmitter {
1518
1536
  const holidayMode = deviceData.Device.HolidayMode ?? false;
1519
1537
  const flowTemperatureHeatPump = deviceData.Device.FlowTemperature;
1520
1538
  const returnTemperatureHeatPump = deviceData.Device.ReturnTemperature;
1539
+ const isConnected = accountTypeMelcloud ? !deviceData.Device[connectKey] : deviceData.Device[connectKey];
1521
1540
  const isInError = deviceData.Device[errorKey];
1522
1541
 
1523
1542
  //zone 1
@@ -1580,6 +1599,7 @@ class DeviceAtw extends EventEmitter {
1580
1599
  sensorsCount: zonesSensorsCount,
1581
1600
  useFahrenheit: this.useFahrenheit,
1582
1601
  temperatureUnit: TemperatureDisplayUnits[this.useFahrenheit],
1602
+ isConnected: isConnected,
1583
1603
  isInError: isInError,
1584
1604
  scheduleEnabled: scheduleEnabled,
1585
1605
  holidayModeEnabled: holidayModeEnabled,
@@ -1962,6 +1982,7 @@ class DeviceAtw extends EventEmitter {
1962
1982
  this.accessory = obj;
1963
1983
 
1964
1984
  //error sensor
1985
+ this.connectService?.updateCharacteristic(Characteristic.ContactSensorState, isConnected);
1965
1986
  this.errorService?.updateCharacteristic(Characteristic.ContactSensorState, isInError);
1966
1987
 
1967
1988
  //holiday mode
package/src/deviceerv.js CHANGED
@@ -30,6 +30,7 @@ class DeviceErv extends EventEmitter {
30
30
  this.temperatureSensor = device.temperatureSensor || false;
31
31
  this.temperatureOutdoorSensor = device.temperatureOutdoorSensor || false;
32
32
  this.temperatureSupplySensor = device.temperatureSupplySensor || false;
33
+ this.connectSensor = device.connectSensor || false;
33
34
  this.errorSensor = device.errorSensor || false;
34
35
  this.holidayModeSupport = device.holidayModeSupport || false;
35
36
  this.presets = this.accountType === 'melcloud' ? (device.presets || []).filter(preset => (preset.displayType ?? 0) > 0 && preset.id !== '0') : [];
@@ -687,10 +688,24 @@ class DeviceErv extends EventEmitter {
687
688
  accessory.addService(this.airQualitySensorService);
688
689
  }
689
690
 
691
+ //connect sensor
692
+ if (this.connectSensor && this.accessory.isConnected !== null) {
693
+ if (this.logDebug) this.emit('debug', `Prepare error service`);
694
+ this.connectService = new Service.ContactSensor(`${serviceName} Connect`, `connectService${deviceId}`);
695
+ this.connectService.addOptionalCharacteristic(Characteristic.ConfiguredName);
696
+ this.connectService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Connect`);
697
+ this.connectService.getCharacteristic(Characteristic.ContactSensorState)
698
+ .onGet(async () => {
699
+ const state = this.accessory.isConnected;
700
+ return state;
701
+ })
702
+ accessory.addService(this.connectService);
703
+ }
704
+
690
705
  //error sensor
691
706
  if (this.errorSensor && this.accessory.isInError !== null) {
692
707
  if (this.logDebug) this.emit('debug', `Prepare error service`);
693
- this.errorService = new Service.ContactSensor(`${serviceName} Error`, `Error Sensor ${deviceId}`);
708
+ this.errorService = new Service.ContactSensor(`${serviceName} Error`, `errorService${deviceId}`);
694
709
  this.errorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
695
710
  this.errorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Error`);
696
711
  this.errorService.getCharacteristic(Characteristic.ContactSensorState)
@@ -1016,7 +1031,9 @@ class DeviceErv extends EventEmitter {
1016
1031
  this.deviceData = deviceData;
1017
1032
 
1018
1033
  //keys
1034
+ const accountTypeMelcloud = this.accountType === 'melcloud';
1019
1035
  const tempStepKey = this.accountType === 'melcloud' ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
1036
+ const connectKey = this.accountType === 'melcloud' ? 'Offline' : 'IsConnected';
1020
1037
  const errorKey = this.accountType === 'melcloud' ? 'HasError' : 'IsInError';
1021
1038
 
1022
1039
  //presets schedule
@@ -1070,6 +1087,7 @@ class DeviceErv extends EventEmitter {
1070
1087
  const setFanSpeed = deviceData.Device.SetFanSpeed;
1071
1088
  const operationMode = deviceData.Device.OperationMode;
1072
1089
  const ventilationMode = deviceData.Device.VentilationMode;
1090
+ const isConnected = accountTypeMelcloud ? !deviceData.Device[connectKey] : deviceData.Device[connectKey];
1073
1091
  const isInError = deviceData.Device[errorKey];
1074
1092
 
1075
1093
  //accessory
@@ -1114,6 +1132,7 @@ class DeviceErv extends EventEmitter {
1114
1132
  maxTempCoolDry: maxTempCoolDry,
1115
1133
  useFahrenheit: this.useFahrenheit,
1116
1134
  temperatureUnit: TemperatureDisplayUnits[this.useFahrenheit],
1135
+ isConnected: isConnected,
1117
1136
  isInError: isInError,
1118
1137
  scheduleEnabled: scheduleEnabled,
1119
1138
  holidayModeEnabled: holidayModeEnabled,
@@ -1256,6 +1275,7 @@ class DeviceErv extends EventEmitter {
1256
1275
  .updateCharacteristic(Characteristic.PM2_5Density, pM25Level);
1257
1276
 
1258
1277
  //error sensor
1278
+ this.connectService?.updateCharacteristic(Characteristic.ContactSensorState, isConnected);
1259
1279
  this.errorService?.updateCharacteristic(Characteristic.ContactSensorState, isInError);
1260
1280
 
1261
1281
  //holiday mode
package/src/melcloud.js CHANGED
@@ -275,7 +275,8 @@ class MelCloud extends EventEmitter {
275
275
  const deviceObject = {
276
276
  ...capitalizeKeys(device.Capabilities || {}),
277
277
  ...settingsObject,
278
- DeviceType: type
278
+ DeviceType: type,
279
+ IsConnected: device.IsConnected
279
280
  };
280
281
 
281
282
  // Kapitalizacja brakujących obiektów/tablic