homebridge-melcloud-control 4.1.2-beta.89 → 4.1.2-beta.90
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 +1 -1
- package/src/deviceata.js +2 -2
- package/src/deviceatw.js +3 -5
- package/src/deviceerv.js +3 -5
- package/src/melcloudata.js +3 -4
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.2-beta.
|
|
4
|
+
"version": "4.1.2-beta.90",
|
|
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
|
@@ -771,7 +771,7 @@ class DeviceAta extends EventEmitter {
|
|
|
771
771
|
.onSet(async (state) => {
|
|
772
772
|
try {
|
|
773
773
|
deviceData.ScheduleEnabled = state;
|
|
774
|
-
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
774
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'scheduleset');
|
|
775
775
|
if (this.logInfo) this.emit('info', `${state ? 'Set:' : 'Unset:'} ${name}`);
|
|
776
776
|
} catch (error) {
|
|
777
777
|
if (this.logWarn) this.emit('warn', `Set schedule error: ${error}`);
|
|
@@ -1347,7 +1347,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1347
1347
|
//update schedules state
|
|
1348
1348
|
if (this.schedules.length > 0) {
|
|
1349
1349
|
this.schedules.forEach((schedule, i) => {
|
|
1350
|
-
const scheduleData = schedulesOnServer.find(
|
|
1350
|
+
const scheduleData = schedulesOnServer.find(s => s[presetsIdKey] === schedule.id);
|
|
1351
1351
|
schedule.state = scheduleEnabled; //scheduleData.Enabled : false;
|
|
1352
1352
|
|
|
1353
1353
|
const characteristicType = schedule.characteristicType;
|
package/src/deviceatw.js
CHANGED
|
@@ -1136,8 +1136,6 @@ class DeviceAtw extends EventEmitter {
|
|
|
1136
1136
|
if (this.logDebug) this.emit('debug', `Prepare schedules services`);
|
|
1137
1137
|
this.schedulesServices = [];
|
|
1138
1138
|
this.schedules.forEach((schedule, i) => {
|
|
1139
|
-
const scheduleData = schedulesOnServer.find(p => p.Id === schedule.id);
|
|
1140
|
-
|
|
1141
1139
|
//get preset name
|
|
1142
1140
|
const name = schedule.name;
|
|
1143
1141
|
|
|
@@ -1157,7 +1155,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1157
1155
|
})
|
|
1158
1156
|
.onSet(async (state) => {
|
|
1159
1157
|
try {
|
|
1160
|
-
deviceData.
|
|
1158
|
+
deviceData.ScheduleEnabled = state;
|
|
1161
1159
|
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
1162
1160
|
if (this.logInfo) this.emit('info', `${state ? 'Set:' : 'Unset:'} ${name}`);
|
|
1163
1161
|
} catch (error) {
|
|
@@ -1894,8 +1892,8 @@ class DeviceAtw extends EventEmitter {
|
|
|
1894
1892
|
//update schedules state
|
|
1895
1893
|
if (this.schedules.length > 0) {
|
|
1896
1894
|
this.schedules.forEach((schedule, i) => {
|
|
1897
|
-
const scheduleData = schedulesOnServer.find(
|
|
1898
|
-
schedule.state =
|
|
1895
|
+
const scheduleData = schedulesOnServer.find(s => s[presetsIdKey] === schedule.id);
|
|
1896
|
+
schedule.state = scheduleEnabled; //scheduleData.Enabled : false;
|
|
1899
1897
|
|
|
1900
1898
|
const characteristicType = schedule.characteristicType;
|
|
1901
1899
|
this.schedulesServices?.[i]?.updateCharacteristic(characteristicType, schedule.state);
|
package/src/deviceerv.js
CHANGED
|
@@ -740,8 +740,6 @@ class DeviceErv extends EventEmitter {
|
|
|
740
740
|
if (this.logDebug) this.emit('debug', `Prepare schedules services`);
|
|
741
741
|
this.schedulesServices = [];
|
|
742
742
|
this.schedules.forEach((schedule, i) => {
|
|
743
|
-
const scheduleData = schedulesOnServer.find(p => p.Id === schedule.id);
|
|
744
|
-
|
|
745
743
|
//get preset name
|
|
746
744
|
const name = schedule.name;
|
|
747
745
|
|
|
@@ -761,7 +759,7 @@ class DeviceErv extends EventEmitter {
|
|
|
761
759
|
})
|
|
762
760
|
.onSet(async (state) => {
|
|
763
761
|
try {
|
|
764
|
-
deviceData.
|
|
762
|
+
deviceData.ScheduleEnabled = state;
|
|
765
763
|
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
766
764
|
if (this.logInfo) this.emit('info', `${state ? 'Set:' : 'Unset:'} ${name}`);
|
|
767
765
|
} catch (error) {
|
|
@@ -1183,8 +1181,8 @@ class DeviceErv extends EventEmitter {
|
|
|
1183
1181
|
//update schedules state
|
|
1184
1182
|
if (this.schedules.length > 0) {
|
|
1185
1183
|
this.schedules.forEach((schedule, i) => {
|
|
1186
|
-
const scheduleData = schedulesOnServer.find(
|
|
1187
|
-
schedule.state =
|
|
1184
|
+
const scheduleData = schedulesOnServer.find(s => s[presetsIdKey] === schedule.id);
|
|
1185
|
+
schedule.state = scheduleEnabled; //scheduleData.Enabled : false;
|
|
1188
1186
|
|
|
1189
1187
|
const characteristicType = schedule.characteristicType;
|
|
1190
1188
|
this.schedulesServices?.[i]?.updateCharacteristic(characteristicType, schedule.state);
|
package/src/melcloudata.js
CHANGED
|
@@ -203,7 +203,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
const settings = {
|
|
206
|
+
const settings = effectiveFlags === 'scheduleset' ? { data: { enabled: deviceData.ScheduleEnabled } } : {
|
|
207
207
|
data: {
|
|
208
208
|
Power: deviceData.Device.Power,
|
|
209
209
|
SetTemperature: deviceData.Device.SetTemperature,
|
|
@@ -211,12 +211,11 @@ class MelCloudAta extends EventEmitter {
|
|
|
211
211
|
OperationMode: AirConditioner.OperationModeMapEnumToString[deviceData.Device.OperationMode],
|
|
212
212
|
VaneHorizontalDirection: AirConditioner.VaneHorizontalDirectionMapEnumToString[deviceData.Device.VaneHorizontalDirection],
|
|
213
213
|
VaneVerticalDirection: AirConditioner.VaneVerticalDirectionMapEnumToString[deviceData.Device.VaneVerticalDirection],
|
|
214
|
-
ScheduleEnabled: deviceData.ScheduleEnabled
|
|
215
214
|
}
|
|
216
215
|
};
|
|
217
|
-
if (this.logDebug) this.emit('
|
|
216
|
+
if (!this.logDebug) this.emit('warn', `Send Data: ${JSON.stringify(settings.data, null, 2)}`);
|
|
218
217
|
|
|
219
|
-
const path = ApiUrlsHome.SetAta.replace('deviceid', deviceData.DeviceID);
|
|
218
|
+
const path = effectiveFlags === 'scheduleset' ? ApiUrlsHome.SetSchedule.replace('deviceid', deviceData.DeviceID) : ApiUrlsHome.SetAta.replace('deviceid', deviceData.DeviceID);
|
|
220
219
|
await axiosInstancePut(path, settings);
|
|
221
220
|
this.updateData(deviceData);
|
|
222
221
|
return true;
|