homebridge-melcloud-control 4.2.2-beta.10 → 4.2.2-beta.11
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/deviceerv.js +39 -34
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.
|
|
4
|
+
"version": "4.2.2-beta.11",
|
|
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/deviceerv.js
CHANGED
|
@@ -273,6 +273,7 @@ class DeviceErv extends EventEmitter {
|
|
|
273
273
|
const supportsAutomaticFanSpeed = this.accessory.supportsAutomaticFanSpeed;
|
|
274
274
|
const supportsCO2Sensor = this.accessory.supportsCO2Sensor;
|
|
275
275
|
const supportsPM25Sensor = this.accessory.supportsPM25Sensor;
|
|
276
|
+
const supportsFanSpeed = this.accessory.supportsFanSpeed;
|
|
276
277
|
const numberOfFanSpeeds = this.accessory.numberOfFanSpeeds;
|
|
277
278
|
|
|
278
279
|
//accessory
|
|
@@ -355,40 +356,42 @@ class DeviceErv extends EventEmitter {
|
|
|
355
356
|
const value = this.accessory.roomTemperature;
|
|
356
357
|
return value;
|
|
357
358
|
});
|
|
358
|
-
|
|
359
|
-
.
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
359
|
+
if (supportsFanSpeed) {
|
|
360
|
+
this.melCloudService.getCharacteristic(Characteristic.RotationSpeed)
|
|
361
|
+
.setProps({
|
|
362
|
+
minValue: 0,
|
|
363
|
+
maxValue: this.accessory.fanSpeedSetPropsMaxValue,
|
|
364
|
+
minStep: 1
|
|
365
|
+
})
|
|
366
|
+
.onGet(async () => {
|
|
367
|
+
const value = this.accessory.fanSpeed; //STOP, 1, 2, 3, 4, OFF
|
|
368
|
+
return value;
|
|
369
|
+
})
|
|
370
|
+
.onSet(async (value) => {
|
|
371
|
+
try {
|
|
372
|
+
switch (numberOfFanSpeeds) {
|
|
373
|
+
case 2: //Fan speed mode 2
|
|
374
|
+
value = supportsAutomaticFanSpeed ? [0, 1, 2, 0][value] : [1, 1, 2][value];
|
|
375
|
+
break;
|
|
376
|
+
case 3: //Fan speed mode 3
|
|
377
|
+
value = supportsAutomaticFanSpeed ? [0, 1, 2, 3, 0][value] : [1, 1, 2, 3][value];
|
|
378
|
+
break;
|
|
379
|
+
case 4: //Fan speed mode 4
|
|
380
|
+
value = supportsAutomaticFanSpeed ? [0, 1, 2, 3, 4, 0][value] : [1, 1, 2, 3, 4][value];
|
|
381
|
+
break;
|
|
382
|
+
case 5: //Fan speed mode 5
|
|
383
|
+
value = supportsAutomaticFanSpeed ? [0, 1, 2, 3, 4, 5, 0][value] : [1, 1, 2, 3, 4, 5][value];
|
|
384
|
+
break;;
|
|
385
|
+
};
|
|
384
386
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
387
|
+
deviceData.Device.SetFanSpeed = value
|
|
388
|
+
await this.melCloudErv.send(this.accountType, this.displayType, deviceData, Ventilation.EffectiveFlags.SetFanSpeed);
|
|
389
|
+
if (this.logInfo) this.emit('info', `Set fan speed mode: ${Ventilation.FanSpeedMapEnumToString[value]}`);
|
|
390
|
+
} catch (error) {
|
|
391
|
+
if (this.logWarn) this.emit('warn', `Set fan speed mode error: ${error}`);
|
|
392
|
+
};
|
|
393
|
+
});
|
|
394
|
+
}
|
|
392
395
|
//device can cool
|
|
393
396
|
if (supportsAutoVentilationMode && supportsCoolOperationMode) {
|
|
394
397
|
this.melCloudService.getCharacteristic(Characteristic.CoolingThresholdTemperature)
|
|
@@ -1085,6 +1088,7 @@ class DeviceErv extends EventEmitter {
|
|
|
1085
1088
|
const filterMaintenanceRequired = deviceData.Device.FilterMaintenanceRequired;
|
|
1086
1089
|
const actualVentilationMode = deviceData.Device.ActualVentilationMode;
|
|
1087
1090
|
const numberOfFanSpeeds = deviceData.Device.NumberOfFanSpeeds;
|
|
1091
|
+
const supportsFanSpeed = numberOfFanSpeeds > 0;
|
|
1088
1092
|
const temperatureIncrement = deviceData.Device[tempStepKey] ?? 1;
|
|
1089
1093
|
const minTempHeat = 10;
|
|
1090
1094
|
const maxTempHeat = 31;
|
|
@@ -1131,6 +1135,7 @@ class DeviceErv extends EventEmitter {
|
|
|
1131
1135
|
filterMaintenanceRequired: filterMaintenanceRequired,
|
|
1132
1136
|
actualVentilationMode: actualVentilationMode,
|
|
1133
1137
|
numberOfFanSpeeds: numberOfFanSpeeds,
|
|
1138
|
+
supportsFanSpeed: supportsFanSpeed,
|
|
1134
1139
|
power: power ? 1 : 0,
|
|
1135
1140
|
inStandbyMode: inStandbyMode,
|
|
1136
1141
|
operationMode: operationMode,
|
|
@@ -1200,7 +1205,7 @@ class DeviceErv extends EventEmitter {
|
|
|
1200
1205
|
obj.fanSpeedSetPropsMaxValue = 2;
|
|
1201
1206
|
|
|
1202
1207
|
// fan speed mode
|
|
1203
|
-
if (
|
|
1208
|
+
if (supportsFanSpeed) {
|
|
1204
1209
|
const max = numberOfFanSpeeds;
|
|
1205
1210
|
const autoIndex = supportsAutomaticFanSpeed ? max + 1 : 0;
|
|
1206
1211
|
|