homebridge-melcloud-control 4.4.0-beta.12 → 4.4.0-beta.13
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 +20 -10
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.13",
|
|
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
|
@@ -242,23 +242,33 @@ class Functions extends EventEmitter {
|
|
|
242
242
|
let min = oldMin;
|
|
243
243
|
let max = oldMax;
|
|
244
244
|
|
|
245
|
-
|
|
246
|
-
|
|
245
|
+
// Zmiana MIN
|
|
246
|
+
if (newValue !== oldMin) {
|
|
247
247
|
min = Math.min(Math.max(newValue, minRangeMin), maxRangeMin);
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
//
|
|
248
|
+
|
|
249
|
+
// jeśli min rośnie i różnica < 2 → podbij max
|
|
250
|
+
if (min > oldMin && max - min < 2) {
|
|
251
|
+
max = Math.min(min + 2, maxRangeMax);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// jeśli min maleje → nic nie ruszamy w max
|
|
255
|
+
}
|
|
256
|
+
// Zmiana MAX
|
|
257
|
+
else if (newValue !== oldMax) {
|
|
255
258
|
max = Math.min(Math.max(newValue, minRangeMax), maxRangeMax);
|
|
256
|
-
|
|
259
|
+
|
|
260
|
+
// jeśli max maleje i różnica < 2 → obniż min
|
|
261
|
+
if (max < oldMax && max - min < 2) {
|
|
262
|
+
min = Math.max(max - 2, minRangeMin);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// jeśli max rośnie → nic nie ruszamy w min
|
|
257
266
|
}
|
|
258
267
|
|
|
259
268
|
return { min, max };
|
|
260
269
|
}
|
|
261
270
|
|
|
271
|
+
|
|
262
272
|
}
|
|
263
273
|
|
|
264
274
|
export default Functions
|