homebridge-melcloud-control 4.10.9 → 4.10.10-beta.0
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 +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.
|
|
4
|
+
"version": "4.10.10-beta.0",
|
|
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
|
@@ -385,7 +385,7 @@ class DeviceAta extends EventEmitter {
|
|
|
385
385
|
.setProps({
|
|
386
386
|
minValue: this.accessory.fanSpeedSetPropsMinValue,
|
|
387
387
|
maxValue: this.accessory.fanSpeedSetPropsMaxValue,
|
|
388
|
-
minStep:
|
|
388
|
+
minStep: 1
|
|
389
389
|
})
|
|
390
390
|
.onGet(async () => {
|
|
391
391
|
const value = this.accessory.currentFanSpeed;
|
|
@@ -396,12 +396,11 @@ class DeviceAta extends EventEmitter {
|
|
|
396
396
|
const payload = {};
|
|
397
397
|
const fanKeySet = accountTypeMelCloud ? 'fanSpeed' : 'setFanSpeed';
|
|
398
398
|
const max = numberOfFanSpeeds;
|
|
399
|
-
const
|
|
400
|
-
|
|
401
|
-
const rawFanSpeed = value === 0 ? 0 : Math.max(minFanSpeed, Math.min(max, Math.round((value / 100) * max)));
|
|
399
|
+
const minValue = supportsAutomaticFanSpeed ? 0 : 1;
|
|
400
|
+
const clampedValue = Math.min(Math.max(value, minValue), max);
|
|
402
401
|
|
|
403
|
-
payload[fanKeySet] =
|
|
404
|
-
if (this.logInfo) this.emit('info', `Set fan speed mode: ${AirConditioner.FanSpeedMapEnumToString[
|
|
402
|
+
payload[fanKeySet] = clampedValue;
|
|
403
|
+
if (this.logInfo) this.emit('info', `Set fan speed mode: ${AirConditioner.FanSpeedMapEnumToString[clampedValue]}`);
|
|
405
404
|
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, payload, AirConditioner.EffectiveFlags.SetFanSpeed);
|
|
406
405
|
} catch (error) {
|
|
407
406
|
if (this.logWarn) this.emit('warn', `Set fan speed mode error: ${error}`);
|
|
@@ -1646,16 +1645,16 @@ class DeviceAta extends EventEmitter {
|
|
|
1646
1645
|
|
|
1647
1646
|
//fan speed mode
|
|
1648
1647
|
if (supportsFanSpeed) {
|
|
1649
|
-
|
|
1650
|
-
const
|
|
1651
|
-
const
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
obj.
|
|
1657
|
-
obj.
|
|
1658
|
-
obj.
|
|
1648
|
+
// ograniczamy wartość do zakresu API
|
|
1649
|
+
const minValue = supportsAutomaticFanSpeed ? 0 : 1;
|
|
1650
|
+
const maxValue = max;
|
|
1651
|
+
|
|
1652
|
+
// zabezpieczenie przed out-of-bounds
|
|
1653
|
+
const clampedValue = Math.min(Math.max(setFanSpeed, minValue), maxValue);
|
|
1654
|
+
|
|
1655
|
+
obj.currentFanSpeed = clampedValue;
|
|
1656
|
+
obj.fanSpeedSetPropsMinValue = minValue;
|
|
1657
|
+
obj.fanSpeedSetPropsMaxValue = maxValue;
|
|
1659
1658
|
}
|
|
1660
1659
|
|
|
1661
1660
|
//create characteristics
|