homebridge-melcloud-control 4.10.20-beta.4 → 4.10.20-beta.6
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 -12
- package/src/deviceerv.js +15 -12
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.20-beta.
|
|
4
|
+
"version": "4.10.20-beta.6",
|
|
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
|
@@ -316,9 +316,12 @@ class DeviceAta extends EventEmitter {
|
|
|
316
316
|
})
|
|
317
317
|
.onSet(async (value) => {
|
|
318
318
|
try {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
319
|
+
//0 is the dial's floor, paired by HomeKit itself with Active going false; nothing to send, real speeds start at 1
|
|
320
|
+
if (value === 0) return;
|
|
321
|
+
|
|
322
|
+
//Auto sits at the top slot, past the highest real speed
|
|
323
|
+
const isAutoSlot = supportsAutomaticFanSpeed && value >= numberOfFanSpeeds + 1;
|
|
324
|
+
const clampedValue = isAutoSlot ? 0 : Math.min(Math.max(value, 1), numberOfFanSpeeds);
|
|
322
325
|
const payload = { setFanSpeed: clampedValue };
|
|
323
326
|
if (this.logInfo) this.emit('info', `Set fan speed mode: ${AirConditioner.FanSpeedMapEnumToString[clampedValue]}`);
|
|
324
327
|
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, payload, AirConditioner.EffectiveFlags.SetFanSpeed);
|
|
@@ -1568,15 +1571,15 @@ class DeviceAta extends EventEmitter {
|
|
|
1568
1571
|
|
|
1569
1572
|
//fan speed mode
|
|
1570
1573
|
if (supportsFanSpeed) {
|
|
1571
|
-
//
|
|
1572
|
-
const
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
obj.fanSpeedSetPropsMinValue =
|
|
1574
|
+
//0 is the dial's floor (paired with off), never sent as a real speed; Auto sits at the top slot past the highest real speed
|
|
1575
|
+
const maxValue = supportsAutomaticFanSpeed ? numberOfFanSpeeds + 1 : numberOfFanSpeeds;
|
|
1576
|
+
//if the device somehow reports Auto (0) while not actually supporting it, fall through to the normal clamp (never display 0, that's reserved for off)
|
|
1577
|
+
const isAuto = setFanSpeed === 0 && supportsAutomaticFanSpeed;
|
|
1578
|
+
|
|
1579
|
+
obj.currentFanSpeed = isAuto
|
|
1580
|
+
? maxValue
|
|
1581
|
+
: Math.min(Math.max(setFanSpeed, 1), numberOfFanSpeeds);
|
|
1582
|
+
obj.fanSpeedSetPropsMinValue = 0;
|
|
1580
1583
|
obj.fanSpeedSetPropsMaxValue = maxValue;
|
|
1581
1584
|
}
|
|
1582
1585
|
|
package/src/deviceerv.js
CHANGED
|
@@ -279,9 +279,12 @@ class DeviceErv extends EventEmitter {
|
|
|
279
279
|
})
|
|
280
280
|
.onSet(async (value) => {
|
|
281
281
|
try {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
282
|
+
//0 is the dial's floor, paired by HomeKit itself with Active going false; nothing to send, real speeds start at 1
|
|
283
|
+
if (value === 0) return;
|
|
284
|
+
|
|
285
|
+
//Auto sits at the top slot, past the highest real speed
|
|
286
|
+
const isAutoSlot = supportsAutomaticFanSpeed && value >= numberOfFanSpeeds + 1;
|
|
287
|
+
const clampedValue = isAutoSlot ? 0 : Math.min(Math.max(value, 1), numberOfFanSpeeds);
|
|
285
288
|
const payload = { setFanSpeed: clampedValue };
|
|
286
289
|
if (this.logInfo) this.emit('info', `Set fan speed mode: ${Ventilation.FanSpeedMapEnumToString[clampedValue]}`);
|
|
287
290
|
await this.melCloudErv.send(this.accountType, this.displayType, deviceData, payload, Ventilation.EffectiveFlags.SetFanSpeed);
|
|
@@ -1191,15 +1194,15 @@ class DeviceErv extends EventEmitter {
|
|
|
1191
1194
|
|
|
1192
1195
|
//fan speed mode
|
|
1193
1196
|
if (supportsFanSpeed) {
|
|
1194
|
-
//
|
|
1195
|
-
const
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
obj.fanSpeedSetPropsMinValue =
|
|
1197
|
+
//0 is the dial's floor (paired with off), never sent as a real speed; Auto sits at the top slot past the highest real speed
|
|
1198
|
+
const maxValue = supportsAutomaticFanSpeed ? numberOfFanSpeeds + 1 : numberOfFanSpeeds;
|
|
1199
|
+
//if the device somehow reports Auto (0) while not actually supporting it, fall through to the normal clamp (never display 0, that's reserved for off)
|
|
1200
|
+
const isAuto = setFanSpeed === 0 && supportsAutomaticFanSpeed;
|
|
1201
|
+
|
|
1202
|
+
obj.currentFanSpeed = isAuto
|
|
1203
|
+
? maxValue
|
|
1204
|
+
: Math.min(Math.max(setFanSpeed, 1), numberOfFanSpeeds);
|
|
1205
|
+
obj.fanSpeedSetPropsMinValue = 0;
|
|
1203
1206
|
obj.fanSpeedSetPropsMaxValue = maxValue;
|
|
1204
1207
|
}
|
|
1205
1208
|
|