homebridge-melcloud-control 4.1.3-beta.13 → 4.1.3-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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.1.3-beta.13",
4
+ "version": "4.1.3-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
@@ -647,6 +647,7 @@ class DeviceAta extends EventEmitter {
647
647
 
648
648
  //holiday mode
649
649
  if (this.accessory.holidayModeEnabled !== null) {
650
+ //control
650
651
  if (this.logDebug) this.emit('debug', `Prepare holiday mode control service`);
651
652
  this.holidayModeControlService = new Service.Switch(`${serviceName} Holiday Mode`, `Holiday Mode Control ${deviceId}`);
652
653
  this.holidayModeControlService.addOptionalCharacteristic(Characteristic.ConfiguredName);
@@ -667,6 +668,18 @@ class DeviceAta extends EventEmitter {
667
668
  });
668
669
  accessory.addService(this.holidayModeControlService);
669
670
 
671
+ if (this.logDebug) this.emit('debug', `Prepare holiday mode control sensor service`);
672
+ this.holidayModeControlSensorService = new Service.ContactSensor(`${serviceName} Holiday Mode Control`, `Holiday Mode Control Sensor ${deviceId}`);
673
+ this.holidayModeControlSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
674
+ this.holidayModeControlSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Holiday Mode Control`);
675
+ this.holidayModeControlSensorService.getCharacteristic(Characteristic.ContactSensorState)
676
+ .onGet(async () => {
677
+ const state = this.accessory.holidayModeEnabled;
678
+ return state;
679
+ })
680
+ accessory.addService(this.holidayModeControlSensorService);
681
+
682
+ //sensors
670
683
  if (this.logDebug) this.emit('debug', `Prepare holiday mode sensor service`);
671
684
  this.holidayModeSensorService = new Service.ContactSensor(`${serviceName} Holiday Mode`, `Holiday Mode Sensor ${deviceId}`);
672
685
  this.holidayModeSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
@@ -785,15 +798,15 @@ class DeviceAta extends EventEmitter {
785
798
  accessory.addService(this.schedulesControlService);
786
799
 
787
800
  if (this.logDebug) this.emit('debug', `Prepare schedule control sensor service`);
788
- this.scheduleSensorService = new Service.ContactSensor(serviceNameSchedule, `Schedule Control Sensor ${deviceId}`);
789
- this.scheduleSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
790
- this.scheduleSensorService.setCharacteristic(Characteristic.ConfiguredName, serviceNameSchedule);
791
- this.scheduleSensorService.getCharacteristic(Characteristic.ContactSensorState)
801
+ this.schedulesControlSensorService = new Service.ContactSensor(serviceNameSchedule, `Schedule Control Sensor ${deviceId}`);
802
+ this.schedulesControlSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
803
+ this.schedulesControlSensorService.setCharacteristic(Characteristic.ConfiguredName, serviceNameSchedule);
804
+ this.schedulesControlSensorService.getCharacteristic(Characteristic.ContactSensorState)
792
805
  .onGet(async () => {
793
806
  const state = this.accessory.scheduleEnabled;
794
807
  return state;
795
808
  })
796
- accessory.addService(this.scheduleSensorService);
809
+ accessory.addService(this.schedulesControlSensorService);
797
810
  }
798
811
 
799
812
  //sensors
@@ -1091,8 +1104,6 @@ class DeviceAta extends EventEmitter {
1091
1104
  this.deviceData = deviceData;
1092
1105
 
1093
1106
  //keys
1094
- const presetsIdKey = this.accountType === 'melcloud' ? 'ID' : 'Id';
1095
- const setTempKey = this.accountType === 'melcloud' ? 'SetTemperature' : 'SetPoint';
1096
1107
  const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
1097
1108
  const tempStepKey = this.accountType === 'melcloud' ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
1098
1109
  const errorKey = this.accountType === 'melcloud' ? 'HasError' : 'IsInError';
@@ -1354,13 +1365,14 @@ class DeviceAta extends EventEmitter {
1354
1365
  this.frostProtectionSensorService?.updateCharacteristic(Characteristic.ContactSensorState, frostProtectionActive);
1355
1366
  this.overheatProtectionSensorService?.updateCharacteristic(Characteristic.ContactSensorState, overheatProtectionActive);
1356
1367
  this.holidayModeControlService?.updateCharacteristic(Characteristic.On, holidayModeEnabled);
1368
+ this.holidayModeControlSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayModeEnabled);
1357
1369
  this.holidayModeSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayModeActive);
1358
1370
  this.errorService?.updateCharacteristic(Characteristic.ContactSensorState, isInError);
1359
1371
 
1360
1372
  //update presets state
1361
1373
  if (this.presets.length > 0) {
1362
1374
  this.presets.forEach((preset, i) => {
1363
- const presetData = presetsOnServer.find(p => p[presetsIdKey] === preset.id);
1375
+ const presetData = presetsOnServer.find(p => p.ID === preset.id);
1364
1376
 
1365
1377
  preset.state = presetData ? (presetData.Power === power
1366
1378
  && presetData.SetTemperature === setTemperature
@@ -1378,10 +1390,13 @@ class DeviceAta extends EventEmitter {
1378
1390
  if (this.schedules.length > 0 && scheduleEnabled !== null) {
1379
1391
  this.schedules.forEach((schedule, i) => {
1380
1392
  //control
1381
- if (i === 0) this.schedulesControlService?.updateCharacteristic(Characteristic.On, scheduleEnabled);
1393
+ if (i === 0) {
1394
+ this.schedulesControlService?.updateCharacteristic(Characteristic.On, scheduleEnabled);
1395
+ this.schedulesControlSensorService?.updateCharacteristic(Characteristic.ContactSensorState, scheduleEnabled);
1396
+ }
1382
1397
 
1383
1398
  //sensors
1384
- const scheduleData = schedulesOnServer.find(s => s[presetsIdKey] === schedule.id);
1399
+ const scheduleData = schedulesOnServer.find(s => s.Id === schedule.id);
1385
1400
  schedule.state = scheduleEnabled ? scheduleData.Enabled ?? false : false;
1386
1401
 
1387
1402
  const characteristicType = schedule.characteristicType;
package/src/deviceatw.js CHANGED
@@ -1049,6 +1049,7 @@ class DeviceAtw extends EventEmitter {
1049
1049
 
1050
1050
  //holiday mode
1051
1051
  if (this.accessory.holidayModeEnabled !== null) {
1052
+ //control
1052
1053
  if (this.logDebug) this.emit('debug', `Prepare holiday mode control service`);
1053
1054
  const serviceName = `${deviceTypeText} ${accessoryName}`;
1054
1055
  this.holidayModeControlService = new Service.Switch(`${serviceName} Holiday Mode`, `Holiday Mode Control ${deviceId}`);
@@ -1070,6 +1071,18 @@ class DeviceAtw extends EventEmitter {
1070
1071
  });
1071
1072
  accessory.addService(this.holidayModeControlService);
1072
1073
 
1074
+ if (this.logDebug) this.emit('debug', `Prepare holiday mode control sensor service`);
1075
+ this.holidayModeControlSensorService = new Service.ContactSensor(`${serviceName} Holiday Mode Control`, `Holiday Mode Control Sensor ${deviceId}`);
1076
+ this.holidayModeControlSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
1077
+ this.holidayModeControlSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Holiday Mode Control`);
1078
+ this.holidayModeControlSensorService.getCharacteristic(Characteristic.ContactSensorState)
1079
+ .onGet(async () => {
1080
+ const state = this.accessory.holidayModeEnabled;
1081
+ return state;
1082
+ })
1083
+ accessory.addService(this.holidayModeControlSensorService);
1084
+
1085
+ //sensor
1073
1086
  if (this.logDebug) this.emit('debug', `Prepare holiday mode sensor service`);
1074
1087
  this.holidayModeSensorService = new Service.ContactSensor(`${serviceName} Holiday Mode`, `Holiday Mode Sensor ${deviceId}`);
1075
1088
  this.holidayModeSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
@@ -1934,6 +1947,7 @@ class DeviceAtw extends EventEmitter {
1934
1947
 
1935
1948
  //update sensors state
1936
1949
  this.holidayModeControlService?.updateCharacteristic(Characteristic.On, holidayModeEnabled);
1950
+ this.holidayModeControlSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayModeEnabled);
1937
1951
  this.holidayModeSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayModeActive);
1938
1952
  this.errorService?.updateCharacteristic(Characteristic.ContactSensorState, isInError);
1939
1953
 
package/src/deviceerv.js CHANGED
@@ -668,6 +668,7 @@ class DeviceErv extends EventEmitter {
668
668
 
669
669
  //holiday mode
670
670
  if (this.accessory.holidayModeEnabled !== null) {
671
+ //control
671
672
  if (this.logDebug) this.emit('debug', `Prepare holiday mode control service`);
672
673
  this.holidayModeControlService = new Service.Switch(`${serviceName} Holiday Mode`, `Holiday Mode Control ${deviceId}`);
673
674
  this.holidayModeControlService.addOptionalCharacteristic(Characteristic.ConfiguredName);
@@ -688,6 +689,18 @@ class DeviceErv extends EventEmitter {
688
689
  });
689
690
  accessory.addService(this.holidayModeControlService);
690
691
 
692
+ if (this.logDebug) this.emit('debug', `Prepare holiday mode control sensor service`);
693
+ this.holidayModeControlSensorService = new Service.ContactSensor(`${serviceName} Holiday Mode Control`, `Holiday Mode Control Sensor ${deviceId}`);
694
+ this.holidayModeControlSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
695
+ this.holidayModeControlSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Holiday Mode Control`);
696
+ this.holidayModeControlSensorService.getCharacteristic(Characteristic.ContactSensorState)
697
+ .onGet(async () => {
698
+ const state = this.accessory.holidayModeEnabled;
699
+ return state;
700
+ })
701
+ accessory.addService(this.holidayModeControlSensorService);
702
+
703
+ //sensor
691
704
  if (this.logDebug) this.emit('debug', `Prepare holiday mode sensor service`);
692
705
  this.holidayModeSensorService = new Service.ContactSensor(`${serviceName} Holiday Mode`, `Holiday Mode Sensor ${deviceId}`);
693
706
  this.holidayModeSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
@@ -1226,6 +1239,7 @@ class DeviceErv extends EventEmitter {
1226
1239
 
1227
1240
  //error sensor
1228
1241
  this.holidayModeControlService?.updateCharacteristic(Characteristic.On, holidayModeEnabled);
1242
+ this.holidayModeControlSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayModeEnabled);
1229
1243
  this.holidayModeSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayModeActive);
1230
1244
  this.errorService?.updateCharacteristic(Characteristic.ContactSensorState, isInError);
1231
1245