homebridge-melcloud-control 4.2.5-beta.31 → 4.2.5-beta.32

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.5-beta.31",
4
+ "version": "4.2.5-beta.32",
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
@@ -931,6 +931,8 @@ class DeviceAta extends EventEmitter {
931
931
  if (this.logDebug) this.emit('debug', `Prepare schedules services`);
932
932
  this.scheduleSensorServices = [];
933
933
  this.schedules.forEach((schedule, i) => {
934
+ const scheduleData = schedulesOnServer.find(s => s.Id === schedule.id);
935
+
934
936
  //get preset name
935
937
  const name = schedule.name;
936
938
 
@@ -959,7 +961,7 @@ class DeviceAta extends EventEmitter {
959
961
  try {
960
962
  deviceData.ScheduleEnabled = state;
961
963
  if (this.logInfo) this.emit('info', `Schedules: ${state ? 'Enabled' : 'Disabled'}`);
962
- await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'schedule');
964
+ await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'schedule', scheduleData);
963
965
  } catch (error) {
964
966
  if (this.logWarn) this.emit('warn', `Set schedules error: ${error}`);
965
967
  };
@@ -1678,7 +1680,7 @@ class DeviceAta extends EventEmitter {
1678
1680
  this.schedules.forEach((schedule, i) => {
1679
1681
  const scheduleData = schedulesOnServer.find(s => s.Id === schedule.id);
1680
1682
  const characteristicType = schedule.characteristicType;
1681
- schedule.state = scheduleEnabled ? scheduleData.Enabled ?? false : false;
1683
+ schedule.state = scheduleEnabled ? (scheduleData.Enabled ?? false) : false;
1682
1684
 
1683
1685
  //control
1684
1686
  if (i === 0) {
@@ -1697,7 +1699,7 @@ class DeviceAta extends EventEmitter {
1697
1699
  if (this.scenes.length > 0) {
1698
1700
  this.scenes.forEach((scene, i) => {
1699
1701
  const sceneData = scenesOnServer.find(s => s.Id === scene.id);
1700
- scene.state = sceneData.Enabled;
1702
+ scene.state = sceneData.Enabled ?? false;
1701
1703
 
1702
1704
  //control
1703
1705
  if (scene.displayType > 3) {
package/src/deviceatw.js CHANGED
@@ -1251,6 +1251,8 @@ class DeviceAtw extends EventEmitter {
1251
1251
  this.scheduleSensorServices = [];
1252
1252
  this.schedules.forEach((schedule, i) => {
1253
1253
  //get preset name
1254
+ const scheduleData = schedulesOnServer.find(s => s.Id === schedule.id);
1255
+
1254
1256
  const name = schedule.name;
1255
1257
 
1256
1258
  //get preset name prefix
@@ -1278,7 +1280,7 @@ class DeviceAtw extends EventEmitter {
1278
1280
  try {
1279
1281
  deviceData.ScheduleEnabled = state;
1280
1282
  if (this.logInfo) this.emit('info', `Schedules: ${state ? 'Enabled' : 'Disabled'}`);
1281
- await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, 'schedule');
1283
+ await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, 'schedule', scheduleData);
1282
1284
  } catch (error) {
1283
1285
  if (this.logWarn) this.emit('warn', `Set schedules error: ${error}`);
1284
1286
  };
@@ -2151,7 +2153,7 @@ class DeviceAtw extends EventEmitter {
2151
2153
  this.schedules.forEach((schedule, i) => {
2152
2154
  const scheduleData = schedulesOnServer.find(s => s.Id === schedule.id);
2153
2155
  const characteristicType = schedule.characteristicType;
2154
- schedule.state = scheduleEnabled ? scheduleData.Enabled ?? false : false;
2156
+ schedule.state = scheduleEnabled ? (scheduleData.Enabled ?? false) : false;
2155
2157
 
2156
2158
  //control
2157
2159
  if (i === 0) {
package/src/deviceerv.js CHANGED
@@ -854,6 +854,8 @@ class DeviceErv extends EventEmitter {
854
854
  if (this.logDebug) this.emit('debug', `Prepare schedules services`);
855
855
  this.scheduleSensorServices = [];
856
856
  this.schedules.forEach((schedule, i) => {
857
+ const scheduleData = schedulesOnServer.find(s => s.Id === schedule.id);
858
+
857
859
  //get preset name
858
860
  const name = schedule.name;
859
861
 
@@ -882,7 +884,7 @@ class DeviceErv extends EventEmitter {
882
884
  try {
883
885
  deviceData.ScheduleEnabled = state;
884
886
  if (this.logInfo) this.emit('info', `Schedules: ${state ? 'Enabled' : 'Disabled'}`);
885
- await this.melCloudErv.send(this.accountType, this.displayType, deviceData, 'schedule');
887
+ await this.melCloudErv.send(this.accountType, this.displayType, deviceData, 'schedule', scheduleData);
886
888
  } catch (error) {
887
889
  if (this.logWarn) this.emit('warn', `Set schedule serror: ${error}`);
888
890
  };
@@ -1436,7 +1438,7 @@ class DeviceErv extends EventEmitter {
1436
1438
  this.schedules.forEach((schedule, i) => {
1437
1439
  const scheduleData = schedulesOnServer.find(s => s.Id === schedule.id);
1438
1440
  const characteristicType = schedule.characteristicType;
1439
- schedule.state = scheduleEnabled ? scheduleData.Enabled ?? false : false;
1441
+ schedule.state = scheduleEnabled ? (scheduleData.Enabled ?? false) : false;
1440
1442
 
1441
1443
  //control
1442
1444
  if (i === 0) {
@@ -98,14 +98,15 @@ class MelCloudAta extends EventEmitter {
98
98
  if (unitsCount === 0 && this.logDebug) if (this.logDebug) this.emit('debug', `Units are not configured in MELCloud service`);
99
99
 
100
100
  //restFul
101
+ const { Device: _ignored, ...info } = deviceData;
101
102
  if (this.restFulEnabled) {
102
- this.emit('restFul', 'info', deviceData);
103
+ this.emit('restFul', 'info', info);
103
104
  this.emit('restFul', 'state', deviceData.Device);
104
105
  }
105
106
 
106
107
  //mqtt
107
108
  if (this.mqttEnabled) {
108
- this.emit('mqtt', 'Info', deviceData);
109
+ this.emit('mqtt', 'Info', info);
109
110
  this.emit('mqtt', 'State', deviceData.Device);
110
111
  }
111
112