homebridge-melcloud-control 3.3.15-beta.0 → 3.3.16

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/CHANGELOG.md CHANGED
@@ -16,7 +16,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
16
16
  - do not configure it manually, always using Config UI X
17
17
  - required Homebridge v2.0.0 and above
18
18
 
19
- ## [3.3.14] - (21.09.2024)
19
+ ## [3.3.16] - (23.09.2024)
20
+
21
+ ## Changes
22
+
23
+ - fix report wrong target mode if device is OFF and the plugin or bridge reboots
24
+ - fix [#167](https://github.com/grzegorz914/homebridge-melcloud-control/issues/167)
25
+ - cleanup
26
+
27
+ ## [3.3.15] - (21.09.2024)
28
+
29
+ ## Changes
30
+
31
+ - fix report wrong target temperature in Heat/Cool mode for ATA and ERV
32
+ - cleanup
33
+
34
+ ## [3.3.14] - (21.09.2024)
20
35
 
21
36
  ## Changes
22
37
 
package/README.md CHANGED
@@ -164,7 +164,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
164
164
 
165
165
  ### AUTO Mode
166
166
 
167
- * Heather/Coolert
167
+ * Heather/Cooler
168
168
  * In this mode we can set heathing threshold and cooling threshold temperature:
169
169
  * Target temperature is calculated as a middle value between `LO` and `HI` and the rest is calculated internally.
170
170
  * Thermostat
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "3.3.15-beta.0",
4
+ "version": "3.3.16",
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
@@ -93,9 +93,6 @@ class DeviceAta extends EventEmitter {
93
93
 
94
94
  //accessory
95
95
  this.accessory = {};
96
- this.accessory.currentOperationMode = 0;
97
- this.accessory.targetOperationMode = 0;
98
- this.accessory.fanSpeed = 0;
99
96
  this.accessory.useFahrenheit = useFahrenheit ? 1 : 0;
100
97
  this.accessory.temperatureUnit = CONSTANTS.TemperatureDisplayUnits[this.accessory.useFahrenheit];
101
98
  };
@@ -293,64 +290,51 @@ class DeviceAta extends EventEmitter {
293
290
  switch (this.displayMode) {
294
291
  case 1: //Heater Cooler
295
292
  //operating mode 0, HEAT, DRY, COOL, 4, 5, 6, FAN, AUTO, ISEE HEAT, ISEE DRY, ISEE COOL
296
- switch (power) {
297
- case true:
298
- switch (!inStandbyMode) {
299
- case true:
300
- switch (operationMode) {
301
- case 1: //HEAT
302
- this.accessory.currentOperationMode = roomTemperature > setTemperature ? 1 : 2; //INACTIVE, IDLE, HEATING, COOLING
303
- this.accessory.targetOperationMode = 1; //AUTO, HEAT, COOL
304
- break;
305
- case 2: //DRY
306
- this.accessory.currentOperationMode = 1;
307
- this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 0 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
308
- break;
309
- case 3: //COOL
310
- this.accessory.currentOperationMode = roomTemperature < setTemperature ? 1 : 3;
311
- this.accessory.targetOperationMode = 2;
312
- break;
313
- case 7: //FAN
314
- this.accessory.currentOperationMode = 1;
315
- this.accessory.targetOperationMode = this.autoDryFanMode === 3 ? 0 : this.heatDryFanMode === 3 ? 1 : this.coolDryFanMode === 3 ? 2 : this.accessory.targetOperationMode;
316
- break;
317
- case 8: //AUTO
318
- this.accessory.currentOperationMode = roomTemperature < setTemperature ? 2 : roomTemperature > setTemperature ? 3 : 1;
319
- this.accessory.targetOperationMode = 0;
320
- break;
321
- case 9: //ISEE HEAT
322
- this.accessory.currentOperationMode = roomTemperature > setTemperature ? 1 : 2
323
- this.accessory.targetOperationMode = 1;
324
- break;
325
- case 10: //ISEE DRY
326
- this.accessory.currentOperationMode = 1;
327
- this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 0 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
328
- break;
329
- case 11: //ISEE COOL;
330
- this.accessory.currentOperationMode = roomTemperature < setTemperature ? 1 : 3;
331
- this.accessory.targetOperationMode = 2;
332
- break;
333
- default:
334
- this.emit('warn', `Received unknown operating mode: ${operationMode}`);
335
- return
336
- };
337
- break;
338
- case false:
339
- this.accessory.currentOperationMode = 1;
340
- break;
341
- };
293
+ switch (operationMode) {
294
+ case 1: //HEAT
295
+ this.accessory.currentOperationMode = roomTemperature > setTemperature ? 1 : 2; //INACTIVE, IDLE, HEATING, COOLING
296
+ this.accessory.targetOperationMode = 1; //AUTO, HEAT, COOL
342
297
  break;
343
- case false:
344
- this.accessory.currentOperationMode = 0;
298
+ case 2: //DRY
299
+ this.accessory.currentOperationMode = 1;
300
+ this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 0 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
301
+ break;
302
+ case 3: //COOL
303
+ this.accessory.currentOperationMode = roomTemperature < setTemperature ? 1 : 3;
304
+ this.accessory.targetOperationMode = 2;
305
+ break;
306
+ case 7: //FAN
307
+ this.accessory.currentOperationMode = 1;
308
+ this.accessory.targetOperationMode = this.autoDryFanMode === 3 ? 0 : this.heatDryFanMode === 3 ? 1 : this.coolDryFanMode === 3 ? 2 : this.accessory.targetOperationMode;
309
+ break;
310
+ case 8: //AUTO
311
+ this.accessory.currentOperationMode = roomTemperature < setTemperature ? 2 : roomTemperature > setTemperature ? 3 : 1;
312
+ this.accessory.targetOperationMode = 0;
345
313
  break;
314
+ case 9: //ISEE HEAT
315
+ this.accessory.currentOperationMode = roomTemperature > setTemperature ? 1 : 2
316
+ this.accessory.targetOperationMode = 1;
317
+ break;
318
+ case 10: //ISEE DRY
319
+ this.accessory.currentOperationMode = 1;
320
+ this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 0 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
321
+ break;
322
+ case 11: //ISEE COOL;
323
+ this.accessory.currentOperationMode = roomTemperature < setTemperature ? 1 : 3;
324
+ this.accessory.targetOperationMode = 2;
325
+ break;
326
+ default:
327
+ this.emit('warn', `Received unknown operating mode: ${operationMode}`);
328
+ return
346
329
  };
330
+
331
+ this.accessory.currentOperationMode = !power ? 0 : inStandbyMode ? 1 : this.accessory.currentOperationMode;
347
332
  this.accessory.operationModeSetPropsMinValue = modelSupportsAuto && modelSupportsHeat ? 0 : !modelSupportsAuto && modelSupportsHeat ? 1 : modelSupportsAuto && !modelSupportsHeat ? 0 : 2;
348
333
  this.accessory.operationModeSetPropsMaxValue = 2
349
334
  this.accessory.operationModeSetPropsValidValues = modelSupportsAuto && modelSupportsHeat ? [0, 1, 2] : !modelSupportsAuto && modelSupportsHeat ? [1, 2] : modelSupportsAuto && !modelSupportsHeat ? [0, 2] : [2];
350
335
 
351
336
  //fan speed mode
352
337
  if (modelSupportsFanSpeed) {
353
- this.accessory.fanSpeedSetPropsMaxValue = 2;
354
338
  switch (numberOfFanSpeeds) {
355
339
  case 2: //Fan speed mode 2
356
340
  this.accessory.fanSpeed = hasAutomaticFanSpeed ? [3, 1, 2][fanSpeed] : [0, 1, 2][fanSpeed];
@@ -391,56 +375,45 @@ class DeviceAta extends EventEmitter {
391
375
  };
392
376
  break;
393
377
  case 2: //Thermostat
394
- switch (power) {
395
- case true:
396
- switch (!inStandbyMode) {
397
- case true:
398
- switch (operationMode) {
399
- case 1: //HEAT
400
- this.accessory.currentOperationMode = roomTemperature > setTemperature ? 0 : 1; //OFF, HEATING, COOLING
401
- this.accessory.targetOperationMode = 1; //OFF, HEAT, COOL, AUTO
402
- break;
403
- case 2: //DRY
404
- this.accessory.currentOperationMode = 0;
405
- this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 3 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
406
- break;
407
- case 3: //COOL
408
- this.accessory.currentOperationMode = roomTemperature < setTemperature ? 0 : 2;
409
- this.accessory.targetOperationMode = 2;
410
- break;
411
- case 7: //FAN
412
- this.accessory.currentOperationMode = 0;
413
- this.accessory.targetOperationMode = this.autoDryFanMode === 3 ? 3 : this.heatDryFanMode === 3 ? 1 : this.coolDryFanMode === 3 ? 2 : this.accessory.targetOperationMode;
414
- break;
415
- case 8: //AUTO
416
- this.accessory.currentOperationMode = roomTemperature < setTemperature ? 1 : roomTemperature > setTemperature ? 2 : 0;
417
- this.accessory.targetOperationMode = 3;
418
- break;
419
- case 9: //ISEE HEAT
420
- this.accessory.currentOperationMode = roomTemperature > setTemperature ? 0 : 1;
421
- this.accessory.targetOperationMode = 1;
422
- break;
423
- case 10: //ISEE DRY
424
- this.accessory.currentOperationMode = 0;
425
- this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 3 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
426
- break;
427
- case 11: //ISEE COOL;
428
- this.accessory.currentOperationMode = roomTemperature < setTemperature ? 0 : 2;
429
- this.accessory.targetOperationMode = 2;
430
- break;
431
- default:
432
- this.emit('warn', `Unknown operating mode: ${operationMode}`);
433
- break;
434
- };
435
- break;
436
- case false:
437
- this.accessory.currentOperationMode = 0;
438
- break;
439
- };
440
- case false:
378
+ switch (operationMode) {
379
+ case 1: //HEAT
380
+ this.accessory.currentOperationMode = roomTemperature > setTemperature ? 0 : 1; //OFF, HEATING, COOLING
381
+ this.accessory.targetOperationMode = 1; //OFF, HEAT, COOL, AUTO
382
+ break;
383
+ case 2: //DRY
384
+ this.accessory.currentOperationMode = 0;
385
+ this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 3 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
386
+ break;
387
+ case 3: //COOL
388
+ this.accessory.currentOperationMode = roomTemperature < setTemperature ? 0 : 2;
389
+ this.accessory.targetOperationMode = 2;
390
+ break;
391
+ case 7: //FAN
392
+ this.accessory.currentOperationMode = 0;
393
+ this.accessory.targetOperationMode = this.autoDryFanMode === 3 ? 3 : this.heatDryFanMode === 3 ? 1 : this.coolDryFanMode === 3 ? 2 : this.accessory.targetOperationMode;
394
+ break;
395
+ case 8: //AUTO
396
+ this.accessory.currentOperationMode = roomTemperature < setTemperature ? 1 : roomTemperature > setTemperature ? 2 : 0;
397
+ this.accessory.targetOperationMode = 3;
398
+ break;
399
+ case 9: //ISEE HEAT
400
+ this.accessory.currentOperationMode = roomTemperature > setTemperature ? 0 : 1;
401
+ this.accessory.targetOperationMode = 1;
402
+ break;
403
+ case 10: //ISEE DRY
441
404
  this.accessory.currentOperationMode = 0;
405
+ this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 3 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
406
+ break;
407
+ case 11: //ISEE COOL;
408
+ this.accessory.currentOperationMode = roomTemperature < setTemperature ? 0 : 2;
409
+ this.accessory.targetOperationMode = 2;
410
+ break;
411
+ default:
412
+ this.emit('warn', `Unknown operating mode: ${operationMode}`);
442
413
  break;
443
414
  };
415
+
416
+ this.accessory.currentOperationMode = !power ? 0 : inStandbyMode ? 0 : this.accessory.currentOperationMode;
444
417
  this.accessory.operationModeSetPropsMinValue = 0
445
418
  this.accessory.operationModeSetPropsMaxValue = modelSupportsAuto && modelSupportsHeat ? 3 : !modelSupportsAuto && modelSupportsHeat ? 2 : modelSupportsAuto && !modelSupportsHeat ? 3 : 2;
446
419
  this.accessory.operationModeSetPropsValidValues = modelSupportsAuto && modelSupportsHeat ? [0, 1, 2, 3] : !modelSupportsAuto && modelSupportsHeat ? [0, 1, 2] : modelSupportsAuto && !modelSupportsHeat ? [0, 2, 3] : [0, 2];
package/src/deviceerv.js CHANGED
@@ -91,9 +91,6 @@ class DeviceErv extends EventEmitter {
91
91
 
92
92
  //accessory
93
93
  this.accessory = {};
94
- this.accessory.currentOperationMode = 0;
95
- this.accessory.targetOperationMode = 0;
96
- this.accessory.fanSpeed = 0;
97
94
  this.accessory.useFahrenheit = useFahrenheit ? 1 : 0;
98
95
  this.accessory.temperatureUnit = CONSTANTS.TemperatureDisplayUnits[this.accessory.useFahrenheit];
99
96
  };
@@ -295,41 +292,35 @@ class DeviceErv extends EventEmitter {
295
292
  //ventilation mode - 0, HEAT, 2, COOL, 4, 5, 6, FAN, AUTO
296
293
  switch (this.displayMode) {
297
294
  case 1: //Heater Cooler
298
- switch (power) {
299
- case true:
300
- switch (ventilationMode) {
295
+ switch (ventilationMode) {
296
+ case 0: //LOSSNAY
297
+ this.accessory.currentOperationMode = 2; //INACTIVE, IDLE, HEATING, COOLIN
298
+ this.accessory.targetOperationMode = 1; //AUTO, HEAT, COOL
299
+ break;
300
+ case 1: //BYPASS
301
+ this.accessory.currentOperationMode = 3;
302
+ this.accessory.targetOperationMode = 2;
303
+ break;
304
+ case 2: //AUTO
305
+ switch (actualVentilationMode) {
301
306
  case 0: //LOSSNAY
302
- this.accessory.currentOperationMode = 2; //INACTIVE, IDLE, HEATING, COOLIN
303
- this.accessory.targetOperationMode = 1; //AUTO, HEAT, COOL
307
+ this.accessory.currentOperationMode = 2;
304
308
  break;
305
309
  case 1: //BYPASS
306
310
  this.accessory.currentOperationMode = 3;
307
- this.accessory.targetOperationMode = 2;
308
- break;
309
- case 2: //AUTO
310
- switch (actualVentilationMode) {
311
- case 0: //LOSSNAY
312
- this.accessory.currentOperationMode = 2;
313
- break;
314
- case 1: //BYPASS
315
- this.accessory.currentOperationMode = 3;
316
- break;
317
- default:
318
- this.emit('warn', `Unknown actual ventilation mode: ${actualVentilationMode}`);
319
- break;
320
- };
321
- this.accessory.targetOperationMode = 0;
322
311
  break;
323
312
  default:
324
- this.emit('warn', `Unknown ventilation mode: ${ventilationMode}`);
313
+ this.emit('warn', `Unknown actual ventilation mode: ${actualVentilationMode}`);
325
314
  break;
326
315
  };
316
+ this.accessory.targetOperationMode = 0;
327
317
  break;
328
- case false:
329
- this.accessory.currentOperationMode = 0;
318
+ default:
319
+ this.emit('warn', `Unknown ventilation mode: ${ventilationMode}`);
330
320
  break;
331
321
  };
332
322
 
323
+ this.accessory.currentOperationMode = !power ? 0 : this.accessory.currentOperationMode;
333
324
  this.accessory.operationModeSetPropsMinValue = hasAutoVentilationMode ? 0 : 1;
334
325
  this.accessory.operationModeSetPropsMaxValue = hasAutoVentilationMode ? 2 : 2;
335
326
  this.accessory.operationModeSetPropsValidValues = hasAutoVentilationMode ? (hasBypassVentilationMode ? [0, 1, 2] : [0, 2]) : (hasBypassVentilationMode ? [1, 2] : [2]);
@@ -367,41 +358,33 @@ class DeviceErv extends EventEmitter {
367
358
  break;
368
359
  case 2: //Thermostat
369
360
  //operation mode - 0, HEAT, 2, COOL, 4, 5, 6, FAN, AUTO
370
- switch (power) {
371
- case true:
372
- switch (ventilationMode) {
361
+ switch (ventilationMode) {
362
+ case 0: //LOSSNAY
363
+ this.accessory.currentOperationMode = 1; //OFF, HEAT, COOL
364
+ this.accessory.targetOperationMode = 1; //OFF, HEAT, COOL, AUTO
365
+ break;
366
+ case 1: //BYPASS
367
+ this.accessory.currentOperationMode = 2;
368
+ this.accessory.targetOperationMode = 2;
369
+ break;
370
+ case 2: //AUTO
371
+ switch (actualVentilationMode) {
373
372
  case 0: //LOSSNAY
374
- this.accessory.currentOperationMode = 1; //OFF, HEAT, COOL
375
- this.accessory.targetOperationMode = 1; //OFF, HEAT, COOL, AUTO
373
+ this.accessory.currentOperationMode = 1;
376
374
  break;
377
375
  case 1: //BYPASS
378
376
  this.accessory.currentOperationMode = 2;
379
- this.accessory.targetOperationMode = 2;
380
- break;
381
- case 2: //AUTO
382
- switch (actualVentilationMode) {
383
- case 0: //LOSSNAY
384
- this.accessory.currentOperationMode = 1;
385
- break;
386
- case 1: //BYPASS
387
- this.accessory.currentOperationMode = 2;
388
- break;
389
- default:
390
- this.emit('warn', `Unknown actual ventilation mode: ${actualVentilationMode}`);
391
- break;
392
- };
393
- this.accessory.targetOperationMode = 3;
394
377
  break;
395
378
  default:
396
- this.emit('warn', `Unknown ventilation mode: ${ventilationMode}`);
379
+ this.emit('warn', `Unknown actual ventilation mode: ${actualVentilationMode}`);
397
380
  break;
398
381
  };
399
- break;
400
- case false:
401
- this.accessory.currentOperationMode = 0;
402
- this.accessory.targetOperationMode = 0;
382
+ this.accessory.targetOperationMode = 3;
403
383
  break;
404
384
  };
385
+
386
+ this.accessory.currentOperationMode = !power ? 0 : this.accessory.currentOperationMode;
387
+ this.accessory.targetOperationMode = !power ? 0 : this.accessory.targetOperationMode;
405
388
  this.accessory.operationModeSetPropsMinValue = hasAutoVentilationMode ? 0 : 0;
406
389
  this.accessory.operationModeSetPropsMaxValue = hasAutoVentilationMode ? 3 : 2;
407
390
  this.accessory.operationModeSetPropsValidValues = hasAutoVentilationMode ? (hasBypassVentilationMode ? [0, 1, 2, 3] : [0, 2, 3]) : (hasBypassVentilationMode ? [0, 1, 2] : [0, 2]);