homebridge-melcloud-control 4.4.0-beta.8 → 4.4.0-beta.9
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/functions.js +5 -14
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.4.0-beta.
|
|
4
|
+
"version": "4.4.0-beta.9",
|
|
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/functions.js
CHANGED
|
@@ -237,38 +237,29 @@ class Functions extends EventEmitter {
|
|
|
237
237
|
})
|
|
238
238
|
);
|
|
239
239
|
}
|
|
240
|
+
|
|
240
241
|
async adjustTempProtection(oldMin, oldMax, newValue, type, minRangeMin, maxRangeMin, minRangeMax, maxRangeMax) {
|
|
241
242
|
let min = oldMin;
|
|
242
243
|
let max = oldMax;
|
|
243
244
|
|
|
244
245
|
if (type === "min") {
|
|
245
|
-
//
|
|
246
|
+
// użytkownik zmienia MIN
|
|
246
247
|
min = Math.min(Math.max(newValue, minRangeMin), maxRangeMin);
|
|
247
248
|
|
|
248
|
-
//
|
|
249
|
+
// jeśli różnica jest za mała → podnieś MAX
|
|
249
250
|
if (max - min < 2) {
|
|
250
251
|
max = Math.min(min + 2, maxRangeMax);
|
|
251
252
|
}
|
|
252
|
-
|
|
253
|
-
// if still too small difference → lower min
|
|
254
|
-
if (max - min < 2) {
|
|
255
|
-
min = Math.max(max - 2, minRangeMin);
|
|
256
|
-
}
|
|
257
253
|
}
|
|
258
254
|
|
|
259
255
|
if (type === "max") {
|
|
260
|
-
//
|
|
256
|
+
// użytkownik zmienia MAX
|
|
261
257
|
max = Math.min(Math.max(newValue, minRangeMax), maxRangeMax);
|
|
262
258
|
|
|
263
|
-
//
|
|
259
|
+
// jeśli różnica jest za mała → obniż MIN
|
|
264
260
|
if (max - min < 2) {
|
|
265
261
|
min = Math.max(max - 2, minRangeMin);
|
|
266
262
|
}
|
|
267
|
-
|
|
268
|
-
// if still too small difference → raise max
|
|
269
|
-
if (max - min < 2) {
|
|
270
|
-
max = Math.min(min + 2, maxRangeMax);
|
|
271
|
-
}
|
|
272
263
|
}
|
|
273
264
|
|
|
274
265
|
return { min, max };
|