homebridge-melcloud-control 4.10.10-beta.1 → 4.10.10
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 +15 -16
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.10.10
|
|
4
|
+
"version": "4.10.10",
|
|
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
|
@@ -348,7 +348,7 @@ class DeviceErv extends EventEmitter {
|
|
|
348
348
|
.setProps({
|
|
349
349
|
minValue: this.accessory.fanSpeedSetPropsMinValue,
|
|
350
350
|
maxValue: this.accessory.fanSpeedSetPropsMaxValue,
|
|
351
|
-
minStep:
|
|
351
|
+
minStep: 1
|
|
352
352
|
})
|
|
353
353
|
.onGet(async () => {
|
|
354
354
|
const value = this.accessory.fanSpeed;
|
|
@@ -358,12 +358,11 @@ class DeviceErv extends EventEmitter {
|
|
|
358
358
|
try {
|
|
359
359
|
const payload = {};
|
|
360
360
|
const max = numberOfFanSpeeds;
|
|
361
|
-
const
|
|
362
|
-
|
|
363
|
-
const rawFanSpeed = value === 0 ? 0 : Math.max(minFanSpeed, Math.min(max, Math.round((value / 100) * max)));
|
|
361
|
+
const minValue = supportsAutomaticFanSpeed ? 0 : 1;
|
|
362
|
+
const clampedValue = Math.min(Math.max(value, minValue), max);
|
|
364
363
|
|
|
365
|
-
|
|
366
|
-
if (this.logInfo) this.emit('info', `Set fan speed mode: ${Ventilation.FanSpeedMapEnumToString[
|
|
364
|
+
payload.setFanSpeed = clampedValue;
|
|
365
|
+
if (this.logInfo) this.emit('info', `Set fan speed mode: ${Ventilation.FanSpeedMapEnumToString[clampedValue]}`);
|
|
367
366
|
await this.melCloudErv.send(this.accountType, this.displayType, deviceData, payload, Ventilation.EffectiveFlags.SetFanSpeed);
|
|
368
367
|
} catch (error) {
|
|
369
368
|
if (this.logWarn) this.emit('warn', `Set fan speed mode error: ${error}`);
|
|
@@ -1274,16 +1273,16 @@ class DeviceErv extends EventEmitter {
|
|
|
1274
1273
|
|
|
1275
1274
|
//fan speed mode
|
|
1276
1275
|
if (supportsFanSpeed) {
|
|
1277
|
-
|
|
1278
|
-
const
|
|
1279
|
-
const
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
obj.
|
|
1285
|
-
obj.
|
|
1286
|
-
obj.
|
|
1276
|
+
// ograniczamy wartość do zakresu API
|
|
1277
|
+
const minValue = supportsAutomaticFanSpeed ? 0 : 1;
|
|
1278
|
+
const maxValue = numberOfFanSpeeds;
|
|
1279
|
+
|
|
1280
|
+
// zabezpieczenie przed out-of-bounds
|
|
1281
|
+
const clampedValue = Math.min(Math.max(setFanSpeed, minValue), maxValue);
|
|
1282
|
+
|
|
1283
|
+
obj.currentFanSpeed = clampedValue;
|
|
1284
|
+
obj.fanSpeedSetPropsMinValue = minValue;
|
|
1285
|
+
obj.fanSpeedSetPropsMaxValue = maxValue;
|
|
1287
1286
|
}
|
|
1288
1287
|
|
|
1289
1288
|
//create characteristics
|