homebridge-melcloud-control 4.0.0-beta.195 → 4.0.0-beta.197
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 +4 -2
- package/src/melcloudata.js +15 -72
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.0.0-beta.
|
|
4
|
+
"version": "4.0.0-beta.197",
|
|
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
|
@@ -414,7 +414,8 @@ class DeviceAta extends EventEmitter {
|
|
|
414
414
|
})
|
|
415
415
|
.onSet(async (value) => {
|
|
416
416
|
try {
|
|
417
|
-
|
|
417
|
+
const tempKey = this.accessory.operationMode === 8 ? 'DefaultCoolingSetTemperature' : 'SetTemperature';
|
|
418
|
+
deviceData.Device[tempKey] = value;
|
|
418
419
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
419
420
|
await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
420
421
|
if (this.logInfo) this.emit('info', `Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
@@ -435,7 +436,8 @@ class DeviceAta extends EventEmitter {
|
|
|
435
436
|
})
|
|
436
437
|
.onSet(async (value) => {
|
|
437
438
|
try {
|
|
438
|
-
|
|
439
|
+
const tempKey = this.accessory.operationMode === 8 ? 'DefaultHeatingSetTemperature' : 'SetTemperature';
|
|
440
|
+
deviceData.Device[tempKey] = value;
|
|
439
441
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
440
442
|
await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
441
443
|
if (this.logInfo) this.emit('info', `Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
package/src/melcloudata.js
CHANGED
|
@@ -46,8 +46,6 @@ class MelCloudAta extends EventEmitter {
|
|
|
46
46
|
|
|
47
47
|
async checkState() {
|
|
48
48
|
try {
|
|
49
|
-
//read default temps
|
|
50
|
-
const temps = await this.functions.readData(this.defaultTempsFile, true);
|
|
51
49
|
|
|
52
50
|
//read device info from file
|
|
53
51
|
const devicesData = await this.functions.readData(this.devicesFile, true);
|
|
@@ -59,14 +57,17 @@ class MelCloudAta extends EventEmitter {
|
|
|
59
57
|
const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
|
|
60
58
|
if (this.accountType === 'melcloudhome') {
|
|
61
59
|
deviceData.SerialNumber = deviceData.Device.DeviceID || '4.0.0';
|
|
60
|
+
deviceData.Device.FirmwareAppVersion = '4.0.0';
|
|
62
61
|
deviceData.Device.OperationMode = AirConditioner.OperationModeMapStringToEnum[deviceData.Device.OperationMode] ?? deviceData.Device.OperationMode;
|
|
63
62
|
deviceData.Device.ActualFanSpeed = AirConditioner.FanSpeedMapStringToEnum[deviceData.Device.ActualFanSpeed] ?? deviceData.Device.ActualFanSpeed;
|
|
64
63
|
deviceData.Device.SetFanSpeed = AirConditioner.FanSpeedMapStringToEnum[deviceData.Device.SetFanSpeed] ?? deviceData.Device.SetFanSpeed;
|
|
65
64
|
deviceData.Device.VaneVerticalDirection = AirConditioner.VaneVerticalDirectionMapStringToEnum[deviceData.Device.VaneVerticalDirection] ?? deviceData.Device.VaneVerticalDirection;
|
|
66
65
|
deviceData.Device.VaneHorizontalDirection = AirConditioner.VaneHorizontalDirectionMapStringToEnum[deviceData.Device.VaneHorizontalDirection] ?? deviceData.Device.VaneHorizontalDirection;
|
|
66
|
+
|
|
67
|
+
//read default temps
|
|
68
|
+
const temps = await this.functions.readData(this.defaultTempsFile, true);
|
|
67
69
|
deviceData.Device.DefaultHeatingSetTemperature = temps?.defaultHeatingSetTemperature ?? 20;
|
|
68
70
|
deviceData.Device.DefaultCoolingSetTemperature = temps?.defaultCoolingSetTemperature ?? 24;
|
|
69
|
-
deviceData.Device.FirmwareAppVersion = '4.0.0';
|
|
70
71
|
}
|
|
71
72
|
if (this.logDebug) this.emit('debug', `Device Data: ${JSON.stringify(deviceData, null, 2)}`);
|
|
72
73
|
|
|
@@ -188,35 +189,8 @@ class MelCloudAta extends EventEmitter {
|
|
|
188
189
|
withCredentials: true
|
|
189
190
|
});
|
|
190
191
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
case 1: // Heater/Cooler
|
|
194
|
-
switch (deviceData.Device.OperationMode) {
|
|
195
|
-
case 1: // HEAT
|
|
196
|
-
case 9: // ISEE HEAT
|
|
197
|
-
deviceData.Device.SetTemperature = deviceData.Device.DefaultHeatingSetTemperature;
|
|
198
|
-
break;
|
|
199
|
-
case 2: // DRY
|
|
200
|
-
case 3: // COOL
|
|
201
|
-
case 10: // ISEE DRY
|
|
202
|
-
case 11: // ISEE COOL
|
|
203
|
-
deviceData.Device.SetTemperature = deviceData.Device.DefaultCoolingSetTemperature;
|
|
204
|
-
break;
|
|
205
|
-
case 7: // FAN
|
|
206
|
-
break;
|
|
207
|
-
case 8: // AUTO
|
|
208
|
-
deviceData.Device.SetTemperature = (deviceData.Device.DefaultCoolingSetTemperature + deviceData.Device.DefaultHeatingSetTemperature) / 2;
|
|
209
|
-
break;
|
|
210
|
-
default:
|
|
211
|
-
if (this.logWarn) this.emit('warn', `Unknown operation mode: ${deviceData.Device.OperationMode}`);
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
break;
|
|
215
|
-
case 2: // Thermostat
|
|
216
|
-
break;
|
|
217
|
-
default:
|
|
218
|
-
if (this.logWarn) this.emit('warn', `Unknown display mode: ${displayMode}`);
|
|
219
|
-
return;
|
|
192
|
+
if (displayMode === 1 && deviceData.Device.OperationMode === 8) {
|
|
193
|
+
deviceData.Device.SetTemperature = (deviceData.Device.DefaultCoolingSetTemperature + deviceData.Device.DefaultHeatingSetTemperature) / 2;
|
|
220
194
|
}
|
|
221
195
|
|
|
222
196
|
const payload = {
|
|
@@ -264,47 +238,16 @@ class MelCloudAta extends EventEmitter {
|
|
|
264
238
|
}
|
|
265
239
|
});
|
|
266
240
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
case 1: //Heather/Cooler
|
|
270
|
-
switch (deviceData.Device.OperationMode) {
|
|
271
|
-
case 1: //HEAT
|
|
272
|
-
case 9: //ISEE HEAT
|
|
273
|
-
deviceData.Device.SetTemperature = deviceData.Device.DefaultHeatingSetTemperature;
|
|
274
|
-
break;
|
|
275
|
-
case 2: //DRY
|
|
276
|
-
case 3: //COOL
|
|
277
|
-
case 10: //ISEE DRY
|
|
278
|
-
case 11: //ISEE COOL
|
|
279
|
-
deviceData.Device.SetTemperature = deviceData.Device.DefaultCoolingSetTemperature;
|
|
280
|
-
break;
|
|
281
|
-
case 7: //FAN
|
|
282
|
-
deviceData.Device.SetTemperature = deviceData.Device.SetTemperature;
|
|
283
|
-
break;
|
|
284
|
-
case 8: //AUTO
|
|
285
|
-
deviceData.Device.SetTemperature = (deviceData.Device.DefaultCoolingSetTemperature + deviceData.Device.DefaultHeatingSetTemperature) / 2;
|
|
286
|
-
break;
|
|
287
|
-
default:
|
|
288
|
-
if (this.logWarn) this.emit('warn', `Unknown operation mode: ${deviceData.Device.OperationMode}`);
|
|
289
|
-
return;
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
break
|
|
293
|
-
case 2: //Thermostat
|
|
294
|
-
deviceData.Device.SetTemperature = deviceData.Device.SetTemperature;
|
|
295
|
-
break;
|
|
296
|
-
default:
|
|
297
|
-
if (this.logWarn) this.emit('warn', `Unknown display mode: ${displayMode}`);
|
|
298
|
-
return;
|
|
299
|
-
};
|
|
241
|
+
if (displayMode === 1 && deviceData.Device.OperationMode === 8) {
|
|
242
|
+
deviceData.Device.SetTemperature = (deviceData.Device.DefaultCoolingSetTemperature + deviceData.Device.DefaultHeatingSetTemperature) / 2;
|
|
300
243
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
244
|
+
if (this.deviceState.DefaultCoolingSetTemperature !== deviceData.Device.DefaultCoolingSetTemperature || this.deviceState.DefaultHeatingSetTemperature !== deviceData.Device.DefaultHeatingSetTemperature) {
|
|
245
|
+
const temps = {
|
|
246
|
+
defaultCoolingSetTemperature: deviceData.Device.DefaultCoolingSetTemperature,
|
|
247
|
+
defaultHeatingSetTemperature: deviceData.Device.DefaultHeatingSetTemperature
|
|
248
|
+
};
|
|
249
|
+
await this.functions.saveData(this.defaultTempsFile, temps);
|
|
250
|
+
}
|
|
308
251
|
}
|
|
309
252
|
|
|
310
253
|
const settings = {
|