homebridge-melcloud-control 4.2.2-beta.8 → 4.2.2

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
@@ -22,10 +22,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
22
22
 
23
23
  - Do not use Homebridge UI > v5.5.0 because of break config.json
24
24
 
25
- ## [4.2.2] - (xx.11.2025)
25
+ ## [4.2.2] - (14.11.2025)
26
26
 
27
27
  ## Changes
28
28
 
29
+ - added in standby mode sensor
30
+ - fix device control after some time
29
31
  - added connect sensor
30
32
  - config schema updated
31
33
  - readme updated
package/README.md CHANGED
@@ -245,7 +245,8 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
245
245
  | `ataDevices[].autoDryFanMode` | Here select the operatiing mode for `Auto`, if this mode is not supported, it will be disabled.. |
246
246
  | `ataDevices[].temperatureSensor` | This enable extra `Room` temperature sensor to use with automations in HomeKit app. |
247
247
  | `ataDevices[].temperatureOutdoorSensor` | This enable extra `Outdoor` temperature sensor to use with automations in HomeKit app. |
248
- | `ataDevices[].connectSensor` | This enable `Connect` sensor to use with automations in HomeKit app. |
248
+ | `ataDevices[].inStandbySensor` | This enable `In Standby Mode` sensor to use with automations in HomeKit app. |
249
+ | `ataDevices[].connectSensor` | This enable `Connect State` sensor to use with automations in HomeKit app. |
249
250
  | `ataDevices[].errorSensor` | This enable `Error` sensor to use with automations in HomeKit app. |
250
251
  | `ataDevices[].frostProtectionSupport` | This enable extra `Frost Protectio` control and sensors to use with automations in HomeKit app. |
251
252
  | `ataDevices[].overheatProtectionSupport` | This enable extra `Overheat Protection` control and sensors to use with automations in HomeKit app. |
@@ -280,7 +281,8 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
280
281
  | `atwDevices[].temperatureReturnWaterTankSensor` | This enable extra `Return Water Tank` temperature sensor to use with automations in HomeKit app. |
281
282
  | `atwDevices[].temperatureFlowZone2Sensor` | This enable extra `Flow Zone 2` temperature sensor to use with automations in HomeKit app. |
282
283
  | `atwDevices[].temperatureReturnZone2Sensor` | This enable extra `Return Zone 2` temperature sensor to use with automations in HomeKit app. |
283
- | `atwDevices[].connectSensor` | This enable `Connect` sensor to use with automations in HomeKit app. |
284
+ | `atwDevices[].inStandbySensor` | This enable `In Standby Mode` sensor to use with automations in HomeKit app. |
285
+ | `atwDevices[].connectSensor` | This enable `Connect State` sensor to use with automations in HomeKit app. |
284
286
  | `atwDevices[].errorSensor` | This enable `Error` sensors to use with automations in HomeKit app. |
285
287
  | `atwDevices[].holidayModeSupport` | This enable extra `Holiday Mode` control and sensors to use with automations in HomeKit app. |
286
288
  | `atwDevices[].refreshInterval` | Here set the background devices state refresh time in (sec), default `5s`. |
@@ -306,7 +308,8 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
306
308
  | `ervDevices[].temperatureSensor` | This enable extra `Room` temperature sensor to use with automations in HomeKit app. |
307
309
  | `ervDevices[].temperatureOutdoorSensor` | This enable extra `Outdoor` temperature sensor to use with automations in HomeKit app. |
308
310
  | `ervDevices[].temperatureSupplySensor` | This enable extra `Supply` temperature sensor to use with automations in HomeKit app. |
309
- | `ervDevices[].connectSensor` | This enable `Connect` sensor to use with automations in HomeKit app. |
311
+ | `atwDevices[].inStandbySensor` | This enable `In Standby Mode` sensor to use with automations in HomeKit app. |
312
+ | `ervDevices[].connectSensor` | This enable `Connect State` sensor to use with automations in HomeKit app. |
310
313
  | `ervDevices[].errorSensor` | This enable `Error` sensors to use with automations in HomeKit app. |
311
314
  | `ervDevices[].holidayModeSupport` | This enable extra `Holiday Mode` control and sensors to use with automations in HomeKit app. |
312
315
  | `ervDevices[].refreshInterval` | Here set the background devices state refresh time in (sec), default `5s`. |
@@ -395,11 +395,17 @@
395
395
  "default": false,
396
396
  "description": "This enable extra outdoor temperature sensor to use with automations in HomeKit app."
397
397
  },
398
+ "inStandbySensor": {
399
+ "title": "In Standby",
400
+ "type": "boolean",
401
+ "default": false,
402
+ "description": "This enable in standby mode sensor to use with automations in HomeKit app."
403
+ },
398
404
  "connectSensor": {
399
405
  "title": "Connect",
400
406
  "type": "boolean",
401
407
  "default": false,
402
- "description": "This enable connect sensor to use with automations in HomeKit app."
408
+ "description": "This enable connect state sensor to use with automations in HomeKit app."
403
409
  },
404
410
  "errorSensor": {
405
411
  "title": "Error",
@@ -1113,11 +1119,17 @@
1113
1119
  "default": false,
1114
1120
  "description": "This enable extra Return Zone 2 temperature sensor to use with automations in HomeKit app."
1115
1121
  },
1122
+ "inStandbySensor": {
1123
+ "title": "In Standby",
1124
+ "type": "boolean",
1125
+ "default": false,
1126
+ "description": "This enable in standby mode sensor to use with automations in HomeKit app."
1127
+ },
1116
1128
  "connectSensor": {
1117
1129
  "title": "Connect",
1118
1130
  "type": "boolean",
1119
1131
  "default": false,
1120
- "description": "This enable connect sensor to use with automations in HomeKit app."
1132
+ "description": "This enable connect state sensor to use with automations in HomeKit app."
1121
1133
  },
1122
1134
  "errorSensor": {
1123
1135
  "title": "Error",
@@ -1591,11 +1603,17 @@
1591
1603
  "default": false,
1592
1604
  "description": "This enable extra supply temperature sensor to use with automations in HomeKit app."
1593
1605
  },
1606
+ "inStandbySensor": {
1607
+ "title": "In Standby",
1608
+ "type": "boolean",
1609
+ "default": false,
1610
+ "description": "This enable in standby mode sensor to use with automations in HomeKit app."
1611
+ },
1594
1612
  "connectSensor": {
1595
1613
  "title": "Connect",
1596
1614
  "type": "boolean",
1597
1615
  "default": false,
1598
- "description": "This enable connect sensor to use with automations in HomeKit app."
1616
+ "description": "This enable connect state sensor to use with automations in HomeKit app."
1599
1617
  },
1600
1618
  "errorSensor": {
1601
1619
  "title": "Error",
@@ -2239,6 +2257,7 @@
2239
2257
  {
2240
2258
  "title": "System",
2241
2259
  "items": [
2260
+ "accounts[].ataDevices[].inStandbySensor",
2242
2261
  "accounts[].ataDevices[].connectSensor",
2243
2262
  "accounts[].ataDevices[].errorSensor"
2244
2263
  ]
@@ -2391,6 +2410,7 @@
2391
2410
  {
2392
2411
  "title": "System",
2393
2412
  "items": [
2413
+ "accounts[].atwDevices[].inStandbySensor",
2394
2414
  "accounts[].atwDevices[].connectSensor",
2395
2415
  "accounts[].atwDevices[].errorSensor"
2396
2416
  ]
@@ -2536,6 +2556,7 @@
2536
2556
  {
2537
2557
  "title": "System",
2538
2558
  "items": [
2559
+ "accounts[].ervDevices[].inStandbySensor",
2539
2560
  "accounts[].ervDevices[].connectSensor",
2540
2561
  "accounts[].ervDevices[].errorSensor"
2541
2562
  ]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.2.2-beta.8",
4
+ "version": "4.2.2",
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
@@ -35,6 +35,7 @@ class DeviceAta extends EventEmitter {
35
35
  this.autoDryFanMode = device.autoDryFanMode || 1; //NONE, AUTO, DRY, FAN
36
36
  this.temperatureSensor = device.temperatureSensor || false;
37
37
  this.temperatureOutdoorSensor = device.temperatureOutdoorSensor || false;
38
+ this.inStandbySensor = device.inStandbySensor || false;
38
39
  this.connectSensor = device.connectSensor || false;
39
40
  this.errorSensor = device.errorSensor || false;
40
41
  this.frostProtectionSupport = device.frostProtectionSupport || false;
@@ -656,9 +657,23 @@ class DeviceAta extends EventEmitter {
656
657
  accessory.addService(this.outdoorTemperatureSensorService);
657
658
  };
658
659
 
660
+ //connect sensor
661
+ if (this.inStandbySensor && this.accessory.inStandbyMode !== null) {
662
+ if (this.logDebug) this.emit('debug', `Prepare in standby mode service`);
663
+ this.inStandbyService = new Service.ContactSensor(`${serviceName} In Standby`, `inStandbyService${deviceId}`);
664
+ this.inStandbyService.addOptionalCharacteristic(Characteristic.ConfiguredName);
665
+ this.inStandbyService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} In Standby`);
666
+ this.inStandbyService.getCharacteristic(Characteristic.ContactSensorState)
667
+ .onGet(async () => {
668
+ const state = this.accessory.inStandbyMode;
669
+ return state;
670
+ })
671
+ accessory.addService(this.inStandbyService);
672
+ }
673
+
659
674
  //connect sensor
660
675
  if (this.connectSensor && this.accessory.isConnected !== null) {
661
- if (this.logDebug) this.emit('debug', `Prepare error service`);
676
+ if (this.logDebug) this.emit('debug', `Prepare connect service`);
662
677
  this.connectService = new Service.ContactSensor(`${serviceName} Connected`, `connectService${deviceId}`);
663
678
  this.connectService.addOptionalCharacteristic(Characteristic.ConfiguredName);
664
679
  this.connectService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Connected`);
@@ -1233,6 +1248,7 @@ class DeviceAta extends EventEmitter {
1233
1248
  const supportHeatKey = accountTypeMelcloud ? 'ModelSupportsHeat' : 'HasHeatOperationMode';
1234
1249
  const supportDryKey = accountTypeMelcloud ? 'ModelSupportsDry' : 'HasDryOperationMode';
1235
1250
  const supportCoolKey = accountTypeMelcloud ? 'ModelSupportsCool' : 'HasCoolOperationMode';
1251
+ const supportStandbyKey = accountTypeMelcloud ? 'ModelSupportsStandbyMode' : 'HasStandby';
1236
1252
 
1237
1253
  //presets schedules
1238
1254
  const scheduleEnabled = deviceData.ScheduleEnabled;
@@ -1252,11 +1268,12 @@ class DeviceAta extends EventEmitter {
1252
1268
  const hideDryModeControl = deviceData.HideDryModeControl ?? false;
1253
1269
 
1254
1270
  //device info
1271
+ const supportsStanbyMode = deviceData.Device[supportStandbyKey];
1255
1272
  const supportsAutomaticFanSpeed = deviceData.Device.HasAutomaticFanSpeed ?? false;
1256
1273
  const supportsAirDirectionFunction = deviceData.Device[supportAirDirectionKey];
1257
1274
  const supportsSwingFunction = deviceData.Device[supportSwingKey];
1258
1275
  const supportsWideVane = deviceData.Device[supportVideWaneKey];
1259
- const supportsOutdoorTemperature = deviceData.Device.HasOutdoorTemperature ?? false;
1276
+ const supportsOutdoorTemperature = deviceData.Device.HasOutdoorTemperature;
1260
1277
  const supportsFanSpeed = accountTypeMelcloud ? deviceData.Device.ModelSupportsFanSpeed : deviceData.Device.NumberOfFanSpeeds > 0;
1261
1278
  const supportsAuto1 = deviceData.Device[supportAutoKey];
1262
1279
  const supportsAuto = this.autoDryFanMode >= 1 && supportsAuto1
@@ -1273,7 +1290,7 @@ class DeviceAta extends EventEmitter {
1273
1290
 
1274
1291
  //device state
1275
1292
  const power = deviceData.Device.Power ?? false;
1276
- const inStandbyMode = deviceData.Device.InStandbyMode ?? false;
1293
+ const inStandbyMode = deviceData.Device.InStandbyMode;
1277
1294
  const roomTemperature = deviceData.Device.RoomTemperature;
1278
1295
  const setTemperature = deviceData.Device.SetTemperature;
1279
1296
  const defaultHeatingSetTemperature = deviceData.Device.DefaultHeatingSetTemperature;
@@ -1309,6 +1326,7 @@ class DeviceAta extends EventEmitter {
1309
1326
  supportsHeat: supportsHeat,
1310
1327
  supportsDry: supportsDry,
1311
1328
  supportsCool: supportsCool,
1329
+ supportsStanbyMode: supportsStanbyMode,
1312
1330
  minTempHeat: minTempHeat,
1313
1331
  maxTempHeat: maxTempHeat,
1314
1332
  minTempCoolDryAuto: minTempCoolDryAuto,
@@ -1346,70 +1364,66 @@ class DeviceAta extends EventEmitter {
1346
1364
  //operating mode 0, HEAT, DRY, COOL, 4, 5, 6, FAN, AUTO, ISEE HEAT, ISEE DRY, ISEE COOL
1347
1365
  switch (this.displayType) {
1348
1366
  case 1: //Heater Cooler
1367
+ // Helper to map fan mode (2 or 3) into operation target
1368
+ const resolveTargetOperation = (modeValue, obj) => {
1369
+ return this.autoDryFanMode === modeValue ? 0 : this.heatDryFanMode === modeValue ? 1 : this.coolDryFanMode === modeValue ? 2 : (obj.targetOperationMode ?? 0);
1370
+ };
1371
+
1349
1372
  switch (operationMode) {
1350
- case 1: //HEAT
1351
- obj.currentOperationMode = roomTemperature > setTemperature ? 1 : 2; //INACTIVE, IDLE, HEATING, COOLING
1352
- obj.targetOperationMode = 1; //AUTO, HEAT, COOL
1373
+ case 1: // HEAT
1374
+ obj.currentOperationMode = roomTemperature > setTemperature ? 1 : 2;
1375
+ obj.targetOperationMode = 1;
1353
1376
  break;
1354
- case 2: //DRY
1377
+ case 2: // DRY
1355
1378
  obj.currentOperationMode = 1;
1356
- obj.targetOperationMode = this.autoDryFanMode === 2 ? 0 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : obj.targetOperationMode ?? 0;
1379
+ obj.targetOperationMode = resolveTargetOperation(2, obj);
1357
1380
  break;
1358
- case 3: //COOL
1381
+ case 3: // COOL
1359
1382
  obj.currentOperationMode = roomTemperature < setTemperature ? 1 : 3;
1360
1383
  obj.targetOperationMode = 2;
1361
1384
  break;
1362
- case 7: //FAN
1385
+ case 7: // FAN
1363
1386
  obj.currentOperationMode = 1;
1364
- obj.targetOperationMode = this.autoDryFanMode === 3 ? 0 : this.heatDryFanMode === 3 ? 1 : this.coolDryFanMode === 3 ? 2 : obj.targetOperationMode ?? 0;
1387
+ obj.targetOperationMode = resolveTargetOperation(3, obj);
1365
1388
  break;
1366
- case 8: //AUTO
1389
+ case 8: // AUTO
1367
1390
  obj.currentOperationMode = roomTemperature > setTemperature ? 3 : roomTemperature < setTemperature ? 2 : 1;
1368
1391
  obj.targetOperationMode = 0;
1369
1392
  break;
1370
- case 9: //ISEE HEAT
1371
- obj.currentOperationMode = roomTemperature > setTemperature ? 1 : 2
1393
+ case 9: // ISEE HEAT
1394
+ obj.currentOperationMode = roomTemperature > setTemperature ? 1 : 2;
1372
1395
  obj.targetOperationMode = 1;
1373
1396
  break;
1374
- case 10: //ISEE DRY
1397
+ case 10: // ISEE DRY
1375
1398
  obj.currentOperationMode = 1;
1376
- obj.targetOperationMode = this.autoDryFanMode === 2 ? 0 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : obj.targetOperationMode ?? 0;
1399
+ obj.targetOperationMode = resolveTargetOperation(2, obj);
1377
1400
  break;
1378
- case 11: //ISEE COOL;
1401
+ case 11: // ISEE COOL
1379
1402
  obj.currentOperationMode = roomTemperature < setTemperature ? 1 : 3;
1380
1403
  obj.targetOperationMode = 2;
1381
1404
  break;
1382
1405
  default:
1383
1406
  if (this.logWarn) this.emit('warn', `Unknown operating mode: ${operationMode}`);
1384
- return
1385
- };
1407
+ }
1386
1408
 
1387
- obj.currentOperationMode = !power ? 0 : inStandbyMode ? 1 : obj.currentOperationMode;
1409
+ obj.currentOperationMode = !power ? 0 : (inStandbyMode ? 1 : obj.currentOperationMode);
1388
1410
  obj.operationModeSetPropsMinValue = supportsAuto && supportsHeat ? 0 : !supportsAuto && supportsHeat ? 1 : supportsAuto && !supportsHeat ? 0 : 2;
1389
1411
  obj.operationModeSetPropsMaxValue = 2
1390
1412
  obj.operationModeSetPropsValidValues = supportsAuto && supportsHeat ? [0, 1, 2] : !supportsAuto && supportsHeat ? [1, 2] : supportsAuto && !supportsHeat ? [0, 2] : [2];
1391
1413
 
1392
1414
  //fan speed mode
1393
1415
  if (supportsFanSpeed) {
1394
- switch (numberOfFanSpeeds) {
1395
- case 2: //Fan speed mode 2
1396
- obj.currentFanSpeed = supportsAutomaticFanSpeed ? [3, 1, 2][setFanSpeed] : [0, 1, 2][setFanSpeed];
1397
- obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 3 : 2;
1398
- break;
1399
- case 3: //Fan speed mode 3
1400
- obj.currentFanSpeed = supportsAutomaticFanSpeed ? [4, 1, 2, 3][setFanSpeed] : [0, 1, 2, 3][setFanSpeed];
1401
- obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 4 : 3;
1402
- break;
1403
- case 4: //Fan speed mode 4
1404
- obj.currentFanSpeed = supportsAutomaticFanSpeed ? [5, 1, 2, 3, 4][setFanSpeed] : [0, 1, 2, 3, 4][setFanSpeed];
1405
- obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 5 : 4;
1406
- break;
1407
- case 5: //Fan speed mode 5
1408
- obj.currentFanSpeed = supportsAutomaticFanSpeed ? [6, 1, 2, 3, 4, 5][setFanSpeed] : [0, 1, 2, 3, 4, 5][setFanSpeed];
1409
- obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 6 : 5;
1410
- break;
1411
- };
1412
- };
1416
+ const max = numberOfFanSpeeds;
1417
+ const autoIndex = supportsAutomaticFanSpeed ? max + 1 : 0;
1418
+ const speeds = [autoIndex];
1419
+
1420
+ for (let i = 1; i <= max; i++) {
1421
+ speeds.push(i);
1422
+ }
1423
+
1424
+ obj.currentFanSpeed = speeds[setFanSpeed];
1425
+ obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? max + 1 : max;
1426
+ }
1413
1427
 
1414
1428
  //update characteristics
1415
1429
  this.melCloudService
@@ -1425,43 +1439,56 @@ class DeviceAta extends EventEmitter {
1425
1439
  if (supportsSwingFunction) this.melCloudService?.updateCharacteristic(Characteristic.SwingMode, obj.currentSwingMode);
1426
1440
  break;
1427
1441
  case 2: //Thermostat
1442
+ // Helper for mapping target operation in DRY / FAN modes
1443
+ const resolveTargetOperation1 = (modeValue, obj) => {
1444
+ return this.autoDryFanMode === modeValue ? 3 : this.heatDryFanMode === modeValue ? 1 : this.coolDryFanMode === modeValue ? 2 : (obj.targetOperationMode ?? 0);
1445
+ };
1446
+
1428
1447
  switch (operationMode) {
1429
- case 1: //HEAT
1430
- obj.currentOperationMode = roomTemperature > setTemperature ? 0 : 1; //OFF, HEATING, COOLING
1431
- obj.targetOperationMode = 1; //OFF, HEAT, COOL, AUTO
1448
+ case 1: // HEAT
1449
+ obj.currentOperationMode = roomTemperature > setTemperature ? 0 : 1;
1450
+ obj.targetOperationMode = 1;
1432
1451
  break;
1433
- case 2: //DRY
1452
+
1453
+ case 2: // DRY
1434
1454
  obj.currentOperationMode = 0;
1435
- obj.targetOperationMode = this.autoDryFanMode === 2 ? 3 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : obj.targetOperationMode ?? 0;
1455
+ obj.targetOperationMode = resolveTargetOperation1(2, obj);
1436
1456
  break;
1437
- case 3: //COOL
1457
+
1458
+ case 3: // COOL
1438
1459
  obj.currentOperationMode = roomTemperature < setTemperature ? 0 : 2;
1439
1460
  obj.targetOperationMode = 2;
1440
1461
  break;
1441
- case 7: //FAN
1462
+
1463
+ case 7: // FAN
1442
1464
  obj.currentOperationMode = 0;
1443
- obj.targetOperationMode = this.autoDryFanMode === 3 ? 3 : this.heatDryFanMode === 3 ? 1 : this.coolDryFanMode === 3 ? 2 : obj.targetOperationMode ?? 0;
1465
+ obj.targetOperationMode = resolveTargetOperation1(3, obj);
1444
1466
  break;
1445
- case 8: //AUTO
1467
+
1468
+ case 8: // AUTO
1446
1469
  obj.currentOperationMode = roomTemperature < setTemperature ? 1 : roomTemperature > setTemperature ? 2 : 0;
1447
1470
  obj.targetOperationMode = 3;
1448
1471
  break;
1449
- case 9: //ISEE HEAT
1472
+
1473
+ case 9: // ISEE HEAT
1450
1474
  obj.currentOperationMode = roomTemperature > setTemperature ? 0 : 1;
1451
1475
  obj.targetOperationMode = 1;
1452
1476
  break;
1453
- case 10: //ISEE DRY
1477
+
1478
+ case 10: // ISEE DRY
1454
1479
  obj.currentOperationMode = 0;
1455
- obj.targetOperationMode = this.autoDryFanMode === 2 ? 3 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : obj.targetOperationMode ?? 0;
1480
+ obj.targetOperationMode = resolveTargetOperation1(2, obj);
1456
1481
  break;
1457
- case 11: //ISEE COOL;
1482
+
1483
+ case 11: // ISEE COOL
1458
1484
  obj.currentOperationMode = roomTemperature < setTemperature ? 0 : 2;
1459
1485
  obj.targetOperationMode = 2;
1460
1486
  break;
1487
+
1461
1488
  default:
1462
1489
  if (this.logWarn) this.emit('warn', `Unknown operating mode: ${operationMode}`);
1463
1490
  break;
1464
- };
1491
+ }
1465
1492
 
1466
1493
  obj.currentOperationMode = !power ? 0 : obj.currentOperationMode;
1467
1494
  obj.targetOperationMode = !power ? 0 : obj.targetOperationMode;
@@ -1480,9 +1507,10 @@ class DeviceAta extends EventEmitter {
1480
1507
  };
1481
1508
  this.accessory = obj;
1482
1509
 
1483
- //senors
1510
+ //other sensors
1484
1511
  this.roomTemperatureSensorService?.updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature);
1485
1512
  this.outdoorTemperatureSensorService?.updateCharacteristic(Characteristic.CurrentTemperature, outdoorTemperature);
1513
+ this.inStandbyService?.updateCharacteristic(Characteristic.ContactSensorState, inStandbyMode);
1486
1514
  this.connectService?.updateCharacteristic(Characteristic.ContactSensorState, isConnected);
1487
1515
  this.errorService?.updateCharacteristic(Characteristic.ContactSensorState, isInError);
1488
1516
 
package/src/deviceatw.js CHANGED
@@ -37,6 +37,7 @@ class DeviceAtw extends EventEmitter {
37
37
  this.temperatureReturnWaterTankSensor = device.temperatureReturnWaterTankSensor || false;
38
38
  this.temperatureFlowZone2Sensor = device.temperatureFlowZone2Sensor || false;
39
39
  this.temperatureReturnZone2Sensor = device.temperatureReturnZone2Sensor || false;
40
+ this.inStandbySensor = device.inStandbySensor || false;
40
41
  this.connectSensor = device.connectSensor || false;
41
42
  this.errorSensor = device.errorSensor || false;
42
43
  this.holidayModeSupport = device.holidayModeSupport || false;
@@ -1069,9 +1070,22 @@ class DeviceAtw extends EventEmitter {
1069
1070
  });
1070
1071
  };
1071
1072
 
1073
+ if (this.inStandbySensor && this.accessory.inStandbyMode !== null) {
1074
+ if (this.logDebug) this.emit('debug', `Prepare in standby mode service`);
1075
+ this.inStandbyService = new Service.ContactSensor(`${serviceName} In Standby`, `inStandbyService${deviceId}`);
1076
+ this.inStandbyService.addOptionalCharacteristic(Characteristic.ConfiguredName);
1077
+ this.inStandbyService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} In Standby`);
1078
+ this.inStandbyService.getCharacteristic(Characteristic.ContactSensorState)
1079
+ .onGet(async () => {
1080
+ const state = this.accessory.inStandbyMode;
1081
+ return state;
1082
+ })
1083
+ accessory.addService(this.inStandbyService);
1084
+ }
1085
+
1072
1086
  //connect sensor
1073
1087
  if (this.connectSensor && this.accessory.isConnected !== null) {
1074
- if (this.logDebug) this.emit('debug', `Prepare error service`);
1088
+ if (this.logDebug) this.emit('debug', `Prepare connect service`);
1075
1089
  this.connectService = new Service.ContactSensor(`${serviceName} Connected`, `connectService${deviceId}`);
1076
1090
  this.connectService.addOptionalCharacteristic(Characteristic.ConfiguredName);
1077
1091
  this.connectService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Connected`);
@@ -1457,7 +1471,7 @@ class DeviceAtw extends EventEmitter {
1457
1471
  try {
1458
1472
  //melcloud device
1459
1473
  this.melCloudAtw = new MelCloudAtw(this.account, this.device, this.devicesFile, this.defaultTempsFile)
1460
- .on('deviceInfo', (manufacturer, modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion, hasHotWaterTank, hasZone2) => {
1474
+ .on('deviceInfo', (manufacturer, modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion, supportsHotWaterTank, supportsZone2) => {
1461
1475
  if (this.logDeviceInfo && this.displayDeviceInfo) {
1462
1476
  this.emit('devInfo', `---- ${this.deviceTypeText}: ${this.deviceName} ----`);
1463
1477
  this.emit('devInfo', `Account: ${this.accountName}`);
@@ -1468,8 +1482,8 @@ class DeviceAtw extends EventEmitter {
1468
1482
  this.emit('devInfo', `Manufacturer: ${manufacturer}`);
1469
1483
  this.emit('devInfo', '----------------------------------');
1470
1484
  this.emit('devInfo', `Zone 1: Yes`);
1471
- this.emit('devInfo', `Hot Water Tank: ${hasHotWaterTank ? 'Yes' : 'No'}`);
1472
- this.emit('devInfo', `Zone 2: ${hasZone2 ? 'Yes' : 'No'}`);
1485
+ this.emit('devInfo', `Hot Water Tank: ${supportsHotWaterTank ? 'Yes' : 'No'}`);
1486
+ this.emit('devInfo', `Zone 2: ${supportsZone2 ? 'Yes' : 'No'}`);
1473
1487
  this.emit('devInfo', '----------------------------------');
1474
1488
  this.displayDeviceInfo = false;
1475
1489
  }
@@ -1490,6 +1504,7 @@ class DeviceAtw extends EventEmitter {
1490
1504
  const tempStepKey = this.accountType === 'melcloud' ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
1491
1505
  const connectKey = this.accountType === 'melcloud' ? 'Offline' : 'IsConnected';
1492
1506
  const errorKey = this.accountType === 'melcloud' ? 'HasError' : 'IsInError';
1507
+ const supportStandbyKey = accountTypeMelcloud ? 'ModelSupportsStandbyMode' : 'HasStandby';
1493
1508
 
1494
1509
  //presets schedule
1495
1510
  const scheduleEnabled = deviceData.ScheduleEnabled;
@@ -1499,10 +1514,11 @@ class DeviceAtw extends EventEmitter {
1499
1514
  const holidayModeActive = deviceData.HolidayMode?.Active ?? false;
1500
1515
 
1501
1516
  //device info
1502
- const hasHeatPump = ![1, 2, 3, 4, 5, 6, 7, 15].includes(this.hideZone);
1503
- const hasZone1 = ![2, 3, 4, 8, 9, 10, 11, 15].includes(this.hideZone);
1504
- const hasHotWaterTank = ![3, 5, 6, 9, 10, 12, 13, 15].includes(this.hideZone) && deviceData.Device.HasHotWaterTank;
1505
- const hasZone2 = ![4, 6, 7, 10, 11, 13, 14, 15].includes(this.hideZone) && deviceData.Device.HasZone2;
1517
+ const supportsStanbyMode = deviceData.Device[supportStandbyKey];
1518
+ const supportsHeatPump = ![1, 2, 3, 4, 5, 6, 7, 15].includes(this.hideZone);
1519
+ const supportsZone1 = ![2, 3, 4, 8, 9, 10, 11, 15].includes(this.hideZone);
1520
+ const supportsHotWaterTank = ![3, 5, 6, 9, 10, 12, 13, 15].includes(this.hideZone) && deviceData.Device.HasHotWaterTank;
1521
+ const supportsZone2 = ![4, 6, 7, 10, 11, 13, 14, 15].includes(this.hideZone) && deviceData.Device.HasZone2;
1506
1522
  const canHeat = deviceData.Device.CanHeat ?? false;
1507
1523
  const canCool = deviceData.Device.CanCool ?? false;
1508
1524
  const heatCoolModes = canHeat && canCool ? 0 : canHeat ? 1 : canCool ? 2 : 3;
@@ -1513,10 +1529,10 @@ class DeviceAtw extends EventEmitter {
1513
1529
 
1514
1530
  //zones
1515
1531
  let currentZoneCase = 0;
1516
- const caseHeatPump = hasHeatPump ? currentZoneCase++ : -1;
1517
- const caseZone1 = hasZone1 ? currentZoneCase++ : -1;
1518
- const caseHotWater = hasHotWaterTank ? currentZoneCase++ : -1;
1519
- const caseZone2 = hasZone2 ? currentZoneCase++ : -1;
1532
+ const caseHeatPump = supportsHeatPump ? currentZoneCase++ : -1;
1533
+ const caseZone1 = supportsZone1 ? currentZoneCase++ : -1;
1534
+ const caseHotWater = supportsHotWaterTank ? currentZoneCase++ : -1;
1535
+ const caseZone2 = supportsZone2 ? currentZoneCase++ : -1;
1520
1536
  const zonesCount = currentZoneCase;
1521
1537
 
1522
1538
  //zones sensors
@@ -1530,6 +1546,7 @@ class DeviceAtw extends EventEmitter {
1530
1546
  //heat pump
1531
1547
  const heatPumpName = 'Heat Pump';
1532
1548
  const power = deviceData.Device.Power ?? false;
1549
+ const inStandbyMode = deviceData.Device.InStandbyMode;
1533
1550
  const unitStatus = deviceData.Device.UnitStatus ?? 0;
1534
1551
  const operationMode = deviceData.Device.OperationMode;
1535
1552
  const outdoorTemperature = deviceData.Device.OutdoorTemperature;
@@ -1578,15 +1595,17 @@ class DeviceAtw extends EventEmitter {
1578
1595
  presets: presetsOnServer,
1579
1596
  schedules: schedulesOnServer,
1580
1597
  power: power ? 1 : 0,
1598
+ inStandbyMode: inStandbyMode,
1581
1599
  unitStatus: unitStatus,
1582
1600
  idleZone1: idleZone1,
1583
1601
  idleZone2: idleZone2,
1584
1602
  temperatureIncrement: temperatureIncrement,
1585
- hasHeatPump: hasHeatPump,
1586
- hasZone1: hasZone1,
1587
- hasHotWaterTank: hasHotWaterTank,
1588
- hasZone2: hasZone2,
1603
+ supportsHeatPump: supportsHeatPump,
1604
+ supportsZone1: supportsZone1,
1605
+ supportsHotWaterTank: supportsHotWaterTank,
1606
+ supportsZone2: supportsZone2,
1589
1607
  heatCoolModes: heatCoolModes,
1608
+ supportsStanbyMode: supportsStanbyMode,
1590
1609
  caseHeatPump: caseHeatPump,
1591
1610
  caseZone1: caseZone1,
1592
1611
  caseHotWater: caseHotWater,
@@ -1632,12 +1651,12 @@ class DeviceAtw extends EventEmitter {
1632
1651
  case caseHeatPump: //Heat Pump Operation Mode - IDLE, HOT WATER, HEATING ZONES, COOLING, HOT WATER STORAGE, FREEZE STAT, LEGIONELLA, HEATING ECO, MODE 1, MODE 2, MODE 3, HEATING UP /// Unit Status - HEAT, COOL
1633
1652
  name = heatPumpName;
1634
1653
  operationModeZone = operationMode;
1635
- currentOperationMode = !power ? 0 : [1, 2, 2, 3, 2, 1, 1, 2, 1, 1, 1, 2][operationMode]; //INACTIVE, IDLE, HEATING, COOLING
1654
+ currentOperationMode = !power ? 0 : (inStandbyMode ? 1 : [1, 2, 2, 3, 2, 1, 1, 2, 1, 1, 1, 2][operationMode]); //INACTIVE, IDLE, HEATING, COOLING
1636
1655
  targetOperationMode = [1, 2][unitStatus]; //AUTO, HEAT, COOL
1637
1656
  roomTemperature = outdoorTemperature;
1638
1657
  setTemperature = outdoorTemperature;
1639
1658
 
1640
- lockPhysicalControl = hasHotWaterTank && hasZone2 ? (prohibitZone1 && prohibitHotWater && prohibitZone2 ? 1 : 0) : hasHotWaterTank ? (prohibitZone1 && prohibitHotWater ? 1 : 0) : hasZone2 ? (prohibitZone1 && prohibitZone2 ? 1 : 0) : 0;
1659
+ lockPhysicalControl = supportsHotWaterTank && supportsZone2 ? (prohibitZone1 && prohibitHotWater && prohibitZone2 ? 1 : 0) : supportsHotWaterTank ? (prohibitZone1 && prohibitHotWater ? 1 : 0) : supportsZone2 ? (prohibitZone1 && prohibitZone2 ? 1 : 0) : 0;
1641
1660
  operationModeSetPropsMinValue = [1, 1, 2, 0][heatCoolModes];
1642
1661
  operationModeSetPropsMaxValue = [2, 1, 2, 0][heatCoolModes];
1643
1662
  operationModeSetPropsValidValues = [[1, 2], [1], [2], [0]][heatCoolModes];
@@ -1647,7 +1666,7 @@ class DeviceAtw extends EventEmitter {
1647
1666
  case caseZone1: //Zone 1 - HEAT THERMOSTAT, HEAT FLOW, HEAT CURVE, COOL THERMOSTAT, COOL FLOW, FLOOR DRY UP
1648
1667
  name = zone1Name;
1649
1668
  operationModeZone = operationMode;
1650
- currentOperationMode = !power ? 0 : idleZone1 ? 1 : [2, 2, 2, 3, 3, 2][operationModeZone1]; //INACTIVE, IDLE, HEATING, COOLING
1669
+ currentOperationMode = !power ? 0 : (idleZone1 ? 1 : [2, 2, 2, 3, 3, 2][operationModeZone1]); //INACTIVE, IDLE, HEATING, COOLING
1651
1670
  targetOperationMode = [1, 2, 0, 1, 2, 1][operationModeZone1]; //AUTO, HEAT, COOL
1652
1671
 
1653
1672
  switch (operationModeZone1) {
@@ -1679,7 +1698,7 @@ class DeviceAtw extends EventEmitter {
1679
1698
  case caseHotWater: //Hot Water - NORMAL, HEAT NOW
1680
1699
  name = hotWaterName;
1681
1700
  operationModeZone = operationMode;
1682
- currentOperationMode = !power ? 0 : operationMode === 1 ? 2 : [1, 2][forcedHotWaterMode]; //INACTIVE, IDLE, HEATING, COOLING
1701
+ currentOperationMode = !power ? 0 : (operationMode === 1 ? 2 : [1, 2][forcedHotWaterMode]); //INACTIVE, IDLE, HEATING, COOLING
1683
1702
  targetOperationMode = [0, 1][forcedHotWaterMode] //AUTO, HEAT, COOL
1684
1703
  roomTemperature = tankWaterTemperature;
1685
1704
  setTemperature = setTankWaterTemperature;
@@ -1694,7 +1713,7 @@ class DeviceAtw extends EventEmitter {
1694
1713
  case caseZone2: //Zone 2 - HEAT THERMOSTAT, HEAT FLOW, HEAT CURVE, COOL THERMOSTAT, COOL FLOW, FLOOR DRY UP
1695
1714
  name = zone2Name;
1696
1715
  operationModeZone = operationMode;
1697
- currentOperationMode = !power ? 0 : idleZone2 ? 1 : [2, 2, 2, 3, 3, 2][operationModeZone2]; //INACTIVE, IDLE, HEATING, COOLING
1716
+ currentOperationMode = !power ? 0 : (idleZone2 ? 1 : [2, 2, 2, 3, 3, 2][operationModeZone2]); //INACTIVE, IDLE, HEATING, COOLING
1698
1717
  targetOperationMode = [1, 2, 0, 1, 2, 1][operationModeZone2]; //AUTO, HEAT, COOL
1699
1718
 
1700
1719
  switch (operationModeZone2) {
@@ -1785,7 +1804,7 @@ class DeviceAtw extends EventEmitter {
1785
1804
  case caseHotWater: //Hot Water - NORMAL, HEAT NOW
1786
1805
  name = hotWaterName;
1787
1806
  operationModeZone = operationMode;
1788
- currentOperationMode = !power ? 0 : operationMode === 1 ? 1 : [0, 1][forcedHotWaterMode]; //OFF, HEAT, COOL
1807
+ currentOperationMode = !power ? 0 : (operationMode === 1 ? 1 : [0, 1][forcedHotWaterMode]); //OFF, HEAT, COOL
1789
1808
  targetOperationMode = [3, 1][forcedHotWaterMode] //OFF, HEAT, COOL, AUTO
1790
1809
  roomTemperature = tankWaterTemperature;
1791
1810
  setTemperature = setTankWaterTemperature;
@@ -1799,7 +1818,7 @@ class DeviceAtw extends EventEmitter {
1799
1818
  case caseZone2: //Zone 2 - HEAT THERMOSTAT, HEAT FLOW, HEAT CURVE, COOL THERMOSTAT, COOL FLOW, FLOOR DRY UP
1800
1819
  name = zone2Name;
1801
1820
  operationModeZone = operationMode;
1802
- currentOperationMode = !power ? 0 : idleZone2 ? 0 : [1, 1, 1, 2, 2, 1][operationModeZone2]; //OFF, HEAT, COOL
1821
+ currentOperationMode = !power ? 0 : (idleZone2 ? 0 : [1, 1, 1, 2, 2, 1][operationModeZone2]); //OFF, HEAT, COOL
1803
1822
  targetOperationMode = [1, 2, 3, 1, 2, 1][operationModeZone2]; //OFF, HEAT, COOL, AUTO
1804
1823
 
1805
1824
  switch (operationModeZone2) {
@@ -1981,7 +2000,8 @@ class DeviceAtw extends EventEmitter {
1981
2000
  };
1982
2001
  this.accessory = obj;
1983
2002
 
1984
- //error sensor
2003
+ //other sensors
2004
+ this.inStandbyService?.updateCharacteristic(Characteristic.ContactSensorState, inStandbyMode);
1985
2005
  this.connectService?.updateCharacteristic(Characteristic.ContactSensorState, isConnected);
1986
2006
  this.errorService?.updateCharacteristic(Characteristic.ContactSensorState, isInError);
1987
2007
 
package/src/deviceerv.js CHANGED
@@ -30,6 +30,7 @@ class DeviceErv extends EventEmitter {
30
30
  this.temperatureSensor = device.temperatureSensor || false;
31
31
  this.temperatureOutdoorSensor = device.temperatureOutdoorSensor || false;
32
32
  this.temperatureSupplySensor = device.temperatureSupplySensor || false;
33
+ this.inStandbySensor = device.inStandbySensor || false;
33
34
  this.connectSensor = device.connectSensor || false;
34
35
  this.errorSensor = device.errorSensor || false;
35
36
  this.holidayModeSupport = device.holidayModeSupport || false;
@@ -262,16 +263,17 @@ class DeviceErv extends EventEmitter {
262
263
  const accountName = this.accountName;
263
264
  const presetsOnServer = this.accessory.presets;
264
265
  const schedulesOnServer = this.accessory.schedules;
265
- const hasRoomTemperature = this.accessory.hasRoomTemperature;
266
- const hasSupplyTemperature = this.accessory.hasSupplyTemperature;
267
- const hasOutdoorTemperature = this.accessory.hasOutdoorTemperature;
268
- const hasCoolOperationMode = this.accessory.hasCoolOperationMode;
269
- const hasHeatOperationMode = this.accessory.hasHeatOperationMode;
270
- const hasAutoVentilationMode = this.accessory.hasAutoVentilationMode;
271
- const hasBypassVentilationMode = this.accessory.hasBypassVentilationMode;
272
- const hasAutomaticFanSpeed = this.accessory.hasAutomaticFanSpeed;
273
- const hasCO2Sensor = this.accessory.hasCO2Sensor;
274
- const hasPM25Sensor = this.accessory.hasPM25Sensor;
266
+ const supportsRoomTemperature = this.accessory.supportsRoomTemperature;
267
+ const supportsSupplyTemperature = this.accessory.supportsSupplyTemperature;
268
+ const supportsOutdoorTemperature = this.accessory.supportsOutdoorTemperature;
269
+ const supportsCoolOperationMode = this.accessory.supportsCoolOperationMode;
270
+ const supportsHeatOperationMode = this.accessory.supportsHeatOperationMode;
271
+ const supportsAutoVentilationMode = this.accessory.supportsAutoVentilationMode;
272
+ const supportsBypassVentilationMode = this.accessory.supportsBypassVentilationMode;
273
+ const supportsAutomaticFanSpeed = this.accessory.supportsAutomaticFanSpeed;
274
+ const supportsCO2Sensor = this.accessory.supportsCO2Sensor;
275
+ const supportsPM25Sensor = this.accessory.supportsPM25Sensor;
276
+ const supportsFanSpeed = this.accessory.supportsFanSpeed;
275
277
  const numberOfFanSpeeds = this.accessory.numberOfFanSpeeds;
276
278
 
277
279
  //accessory
@@ -332,13 +334,13 @@ class DeviceErv extends EventEmitter {
332
334
  try {
333
335
  switch (value) {
334
336
  case 0: //AUTO - AUTO
335
- deviceData.Device.VentilationMode = hasAutoVentilationMode ? 2 : 0;
337
+ deviceData.Device.VentilationMode = supportsAutoVentilationMode ? 2 : 0;
336
338
  break;
337
339
  case 1: //HEAT - LOSSNAY
338
340
  deviceData.Device.VentilationMode = 0;
339
341
  break;
340
342
  case 2: //COOL - BYPASS
341
- deviceData.Device.VentilationMode = hasBypassVentilationMode ? 1 : 0;
343
+ deviceData.Device.VentilationMode = supportsBypassVentilationMode ? 1 : 0;
342
344
  break;
343
345
  };
344
346
 
@@ -354,42 +356,44 @@ class DeviceErv extends EventEmitter {
354
356
  const value = this.accessory.roomTemperature;
355
357
  return value;
356
358
  });
357
- this.melCloudService.getCharacteristic(Characteristic.RotationSpeed)
358
- .setProps({
359
- minValue: 0,
360
- maxValue: this.accessory.fanSpeedSetPropsMaxValue,
361
- minStep: 1
362
- })
363
- .onGet(async () => {
364
- const value = this.accessory.fanSpeed; //STOP, 1, 2, 3, 4, OFF
365
- return value;
366
- })
367
- .onSet(async (value) => {
368
- try {
369
- switch (numberOfFanSpeeds) {
370
- case 2: //Fan speed mode 2
371
- value = hasAutomaticFanSpeed ? [0, 1, 2, 0][value] : [1, 1, 2][value];
372
- break;
373
- case 3: //Fan speed mode 3
374
- value = hasAutomaticFanSpeed ? [0, 1, 2, 3, 0][value] : [1, 1, 2, 3][value];
375
- break;
376
- case 4: //Fan speed mode 4
377
- value = hasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 0][value] : [1, 1, 2, 3, 4][value];
378
- break;
379
- case 5: //Fan speed mode 5
380
- value = hasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 5, 0][value] : [1, 1, 2, 3, 4, 5][value];
381
- break;;
382
- };
359
+ if (supportsFanSpeed) {
360
+ this.melCloudService.getCharacteristic(Characteristic.RotationSpeed)
361
+ .setProps({
362
+ minValue: 0,
363
+ maxValue: this.accessory.fanSpeedSetPropsMaxValue,
364
+ minStep: 1
365
+ })
366
+ .onGet(async () => {
367
+ const value = this.accessory.fanSpeed; //STOP, 1, 2, 3, 4, OFF
368
+ return value;
369
+ })
370
+ .onSet(async (value) => {
371
+ try {
372
+ switch (numberOfFanSpeeds) {
373
+ case 2: //Fan speed mode 2
374
+ value = supportsAutomaticFanSpeed ? [0, 1, 2, 0][value] : [1, 1, 2][value];
375
+ break;
376
+ case 3: //Fan speed mode 3
377
+ value = supportsAutomaticFanSpeed ? [0, 1, 2, 3, 0][value] : [1, 1, 2, 3][value];
378
+ break;
379
+ case 4: //Fan speed mode 4
380
+ value = supportsAutomaticFanSpeed ? [0, 1, 2, 3, 4, 0][value] : [1, 1, 2, 3, 4][value];
381
+ break;
382
+ case 5: //Fan speed mode 5
383
+ value = supportsAutomaticFanSpeed ? [0, 1, 2, 3, 4, 5, 0][value] : [1, 1, 2, 3, 4, 5][value];
384
+ break;;
385
+ };
383
386
 
384
- deviceData.Device.SetFanSpeed = value
385
- await this.melCloudErv.send(this.accountType, this.displayType, deviceData, Ventilation.EffectiveFlags.SetFanSpeed);
386
- if (this.logInfo) this.emit('info', `Set fan speed mode: ${Ventilation.FanSpeedMapEnumToString[value]}`);
387
- } catch (error) {
388
- if (this.logWarn) this.emit('warn', `Set fan speed mode error: ${error}`);
389
- };
390
- });
387
+ deviceData.Device.SetFanSpeed = value
388
+ await this.melCloudErv.send(this.accountType, this.displayType, deviceData, Ventilation.EffectiveFlags.SetFanSpeed);
389
+ if (this.logInfo) this.emit('info', `Set fan speed mode: ${Ventilation.FanSpeedMapEnumToString[value]}`);
390
+ } catch (error) {
391
+ if (this.logWarn) this.emit('warn', `Set fan speed mode error: ${error}`);
392
+ };
393
+ });
394
+ }
391
395
  //device can cool
392
- if (hasAutoVentilationMode && hasCoolOperationMode) {
396
+ if (supportsAutoVentilationMode && supportsCoolOperationMode) {
393
397
  this.melCloudService.getCharacteristic(Characteristic.CoolingThresholdTemperature)
394
398
  .setProps({
395
399
  minValue: this.accessory.minTempCoolDry,
@@ -411,7 +415,7 @@ class DeviceErv extends EventEmitter {
411
415
  });
412
416
  };
413
417
  //device can heat
414
- if (hasAutoVentilationMode && hasHeatOperationMode) {
418
+ if (supportsAutoVentilationMode && supportsHeatOperationMode) {
415
419
  this.melCloudService.getCharacteristic(Characteristic.HeatingThresholdTemperature)
416
420
  .setProps({
417
421
  minValue: this.accessory.minTempHeat,
@@ -501,12 +505,12 @@ class DeviceErv extends EventEmitter {
501
505
  break;
502
506
  case 2: //COOL - BYPASS
503
507
  deviceData.Device.Power = true;
504
- deviceData.Device.VentilationMode = hasBypassVentilationMode ? 1 : 0;
508
+ deviceData.Device.VentilationMode = supportsBypassVentilationMode ? 1 : 0;
505
509
  effectiveFlags = Ventilation.EffectiveFlags.Power + Ventilation.EffectiveFlags.VentilationMode;
506
510
  break;
507
511
  case 3: //AUTO - AUTO
508
512
  deviceData.Device.Power = true;
509
- deviceData.Device.VentilationMode = hasAutoVentilationMode ? 2 : 0;
513
+ deviceData.Device.VentilationMode = supportsAutoVentilationMode ? 2 : 0;
510
514
  effectiveFlags = Ventilation.EffectiveFlags.Power + Ventilation.EffectiveFlags.VentilationMode;
511
515
  break;
512
516
  };
@@ -564,7 +568,7 @@ class DeviceErv extends EventEmitter {
564
568
  };
565
569
 
566
570
  //temperature sensor service room
567
- if (this.temperatureSensor && hasRoomTemperature && this.accessory.roomTemperature !== null) {
571
+ if (this.temperatureSensor && supportsRoomTemperature && this.accessory.roomTemperature !== null) {
568
572
  if (this.logDebug) this.emit('debug', `Prepare room temperature sensor service`);
569
573
  this.roomTemperatureSensorService = new Service.TemperatureSensor(`${serviceName} Room`, `Room Temperature Sensor ${deviceId}`);
570
574
  this.roomTemperatureSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
@@ -583,7 +587,7 @@ class DeviceErv extends EventEmitter {
583
587
  };
584
588
 
585
589
  //temperature sensor service supply
586
- if (this.temperatureSupplySensor && hasSupplyTemperature && this.accessory.supplyTemperature !== null) {
590
+ if (this.temperatureSupplySensor && supportsSupplyTemperature && this.accessory.supplyTemperature !== null) {
587
591
  if (this.logDebug) this.emit('debug', `Prepare supply temperature sensor service`);
588
592
  this.supplyTemperatureSensorService = new Service.TemperatureSensor(`${serviceName} Supply`, `Supply Temperature Sensor ${deviceId}`);
589
593
  this.supplyTemperatureSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
@@ -602,7 +606,7 @@ class DeviceErv extends EventEmitter {
602
606
  };
603
607
 
604
608
  //temperature sensor service outdoor
605
- if (this.temperatureOutdoorSensor && hasOutdoorTemperature && this.accessory.outdoorTemperature !== null) {
609
+ if (this.temperatureOutdoorSensor && supportsOutdoorTemperature && this.accessory.outdoorTemperature !== null) {
606
610
  if (this.logDebug) this.emit('debug', `Prepare outdoor temperature sensor service`);
607
611
  this.outdoorTemperatureSensorService = new Service.TemperatureSensor(`${serviceName} Outdoor`, `Outdoor Temperature Sensor ${deviceId}`);
608
612
  this.outdoorTemperatureSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
@@ -653,7 +657,7 @@ class DeviceErv extends EventEmitter {
653
657
  }
654
658
 
655
659
  //room CO2 sensor
656
- if (hasCO2Sensor) {
660
+ if (supportsCO2Sensor) {
657
661
  this.carbonDioxideSensorService = new Service.CarbonDioxideSensor(`${serviceName} CO2 Sensor`, `CO2Sensor ${deviceId}`);
658
662
  this.carbonDioxideSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
659
663
  this.carbonDioxideSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} CO2 Sensor`);
@@ -671,7 +675,7 @@ class DeviceErv extends EventEmitter {
671
675
  }
672
676
 
673
677
  //room PM2.5 sensor
674
- if (hasPM25Sensor) {
678
+ if (supportsPM25Sensor) {
675
679
  this.airQualitySensorService = new Service.AirQualitySensor(`${serviceName} PM2.5 Sensor`, `PM25Sensor ${deviceId}`);
676
680
  this.airQualitySensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
677
681
  this.airQualitySensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} PM2.5 Sensor`);
@@ -688,9 +692,22 @@ class DeviceErv extends EventEmitter {
688
692
  accessory.addService(this.airQualitySensorService);
689
693
  }
690
694
 
695
+ if (this.inStandbySensor && this.accessory.inStandbyMode !== null) {
696
+ if (this.logDebug) this.emit('debug', `Prepare in standby mode service`);
697
+ this.inStandbyService = new Service.ContactSensor(`${serviceName} In Standby`, `inStandbyService${deviceId}`);
698
+ this.inStandbyService.addOptionalCharacteristic(Characteristic.ConfiguredName);
699
+ this.inStandbyService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} In Standby`);
700
+ this.inStandbyService.getCharacteristic(Characteristic.ContactSensorState)
701
+ .onGet(async () => {
702
+ const state = this.accessory.inStandbyMode;
703
+ return state;
704
+ })
705
+ accessory.addService(this.inStandbyService);
706
+ }
707
+
691
708
  //connect sensor
692
709
  if (this.connectSensor && this.accessory.isConnected !== null) {
693
- if (this.logDebug) this.emit('debug', `Prepare error service`);
710
+ if (this.logDebug) this.emit('debug', `Prepare connect service`);
694
711
  this.connectService = new Service.ContactSensor(`${serviceName} Connected`, `connectService${deviceId}`);
695
712
  this.connectService.addOptionalCharacteristic(Characteristic.ConfiguredName);
696
713
  this.connectService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Connected`);
@@ -1035,6 +1052,7 @@ class DeviceErv extends EventEmitter {
1035
1052
  const tempStepKey = this.accountType === 'melcloud' ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
1036
1053
  const connectKey = this.accountType === 'melcloud' ? 'Offline' : 'IsConnected';
1037
1054
  const errorKey = this.accountType === 'melcloud' ? 'HasError' : 'IsInError';
1055
+ const supportStandbyKey = accountTypeMelcloud ? 'ModelSupportsStandbyMode' : 'HasStandby';
1038
1056
 
1039
1057
  //presets schedule
1040
1058
  const scheduleEnabled = deviceData.ScheduleEnabled;
@@ -1049,26 +1067,28 @@ class DeviceErv extends EventEmitter {
1049
1067
  const hideOutdoorTemperature = deviceData.HideOutdoorTemperature;
1050
1068
 
1051
1069
  //device info
1052
- const hasCoolOperationMode = deviceData.Device.HasCoolOperationMode ?? false;
1053
- const hasHeatOperationMode = deviceData.Device.HasHeatOperationMode ?? false;
1054
- const hasAutoOperationMode = deviceData.Device.HasAutoOperationMode ?? false;
1055
- const hasRoomTemperature = deviceData.Device.HasRoomTemperature ?? false;
1056
- const hasSupplyTemperature = deviceData.Device.HasSupplyTemperature ?? false;
1057
- const hasOutdoorTemperature = deviceData.Device.HasOutdoorTemperature ?? false;
1058
- const hasCO2Sensor = deviceData.Device.HasCO2Sensor ?? false;
1070
+ const supportsStanbyMode = deviceData.Device[supportStandbyKey];
1071
+ const supportsCoolOperationMode = deviceData.Device.HasCoolOperationMode ?? false;
1072
+ const supportsHeatOperationMode = deviceData.Device.HasHeatOperationMode ?? false;
1073
+ const supportsAutoOperationMode = deviceData.Device.HasAutoOperationMode ?? false;
1074
+ const supportsRoomTemperature = deviceData.Device.HasRoomTemperature ?? false;
1075
+ const supportsSupplyTemperature = deviceData.Device.HasSupplyTemperature ?? false;
1076
+ const supportsOutdoorTemperature = deviceData.Device.HasOutdoorTemperature ?? false;
1077
+ const supportsCO2Sensor = deviceData.Device.HasCO2Sensor ?? false;
1059
1078
  const roomCO2Level = deviceData.Device.RoomCO2Level ?? false;
1060
- const roomCO2Detected = hasCO2Sensor && roomCO2Level > 1000 ? true : false;
1061
- const hasPM25Sensor = deviceData.Device.HasPM25Sensor ?? false;
1062
- const pM25SensorStatus = hasPM25Sensor ? deviceData.Device.PM25SensorStatus : 0;
1063
- const pM25Level = hasPM25Sensor ? deviceData.Device.PM25Level : 0;
1064
- const pM25AirQuality = hasPM25Sensor ? pM25Level <= 13 ? 1 : pM25Level <= 35 ? 2 : pM25Level <= 55 ? 3 : pM25Level <= 75 ? 4 : pM25Level <= 110 ? 5 : 0 : 0;
1065
- const hasAutoVentilationMode = deviceData.Device.HasAutoVentilationMode ?? false;
1066
- const hasBypassVentilationMode = deviceData.Device.HasBypassVentilationMode ?? false;
1067
- const hasAutomaticFanSpeed = deviceData.Device.HasAutomaticFanSpeed ?? false;
1068
- const coreMaintenanceRequired = deviceData.Device.CoreMaintenanceRequired;
1069
- const filterMaintenanceRequired = deviceData.Device.FilterMaintenanceRequired;
1079
+ const roomCO2Detected = supportsCO2Sensor && roomCO2Level > 1000 ? true : false;
1080
+ const supportsPM25Sensor = deviceData.Device.HasPM25Sensor ?? false;
1081
+ const pM25SensorStatus = supportsPM25Sensor ? deviceData.Device.PM25SensorStatus : 0;
1082
+ const pM25Level = supportsPM25Sensor ? deviceData.Device.PM25Level : 0;
1083
+ const pM25AirQuality = supportsPM25Sensor ? pM25Level <= 13 ? 1 : pM25Level <= 35 ? 2 : pM25Level <= 55 ? 3 : pM25Level <= 75 ? 4 : pM25Level <= 110 ? 5 : 0 : 0;
1084
+ const supportsAutoVentilationMode = deviceData.Device.HasAutoVentilationMode ?? false;
1085
+ const supportsBypassVentilationMode = deviceData.Device.HasBypassVentilationMode ?? false;
1086
+ const supportsAutomaticFanSpeed = deviceData.Device.HasAutomaticFanSpeed ?? false;
1070
1087
  const actualVentilationMode = deviceData.Device.ActualVentilationMode;
1071
1088
  const numberOfFanSpeeds = deviceData.Device.NumberOfFanSpeeds;
1089
+ const supportsFanSpeed = numberOfFanSpeeds > 0;
1090
+ const coreMaintenanceRequired = deviceData.Device.CoreMaintenanceRequired;
1091
+ const filterMaintenanceRequired = deviceData.Device.FilterMaintenanceRequired;
1072
1092
  const temperatureIncrement = deviceData.Device[tempStepKey] ?? 1;
1073
1093
  const minTempHeat = 10;
1074
1094
  const maxTempHeat = 31;
@@ -1077,6 +1097,7 @@ class DeviceErv extends EventEmitter {
1077
1097
 
1078
1098
  //device state
1079
1099
  const power = deviceData.Device.Power;
1100
+ const inStandbyMode = deviceData.Device.InStandbyMode;
1080
1101
  const roomTemperature = deviceData.Device.RoomTemperature;
1081
1102
  const supplyTemperature = deviceData.Device.SupplyTemperature;
1082
1103
  const outdoorTemperature = deviceData.Device.OutdoorTemperature;
@@ -1094,26 +1115,29 @@ class DeviceErv extends EventEmitter {
1094
1115
  const obj = {
1095
1116
  presets: presetsOnServer,
1096
1117
  schedules: schedulesOnServer,
1097
- hasRoomTemperature: hasRoomTemperature,
1098
- hasSupplyTemperature: hasSupplyTemperature,
1099
- hasOutdoorTemperature: hasOutdoorTemperature,
1100
- hasCoolOperationMode: hasCoolOperationMode,
1101
- hasHeatOperationMode: hasHeatOperationMode,
1102
- hasCO2Sensor: hasCO2Sensor,
1118
+ supportsRoomTemperature: supportsRoomTemperature,
1119
+ supportsSupplyTemperature: supportsSupplyTemperature,
1120
+ supportsOutdoorTemperature: supportsOutdoorTemperature,
1121
+ supportsCoolOperationMode: supportsCoolOperationMode,
1122
+ supportsHeatOperationMode: supportsHeatOperationMode,
1123
+ supportsCO2Sensor: supportsCO2Sensor,
1103
1124
  roomCO2Level: roomCO2Level,
1104
1125
  roomCO2Detected: roomCO2Detected,
1105
- hasPM25Sensor: hasPM25Sensor,
1126
+ supportsPM25Sensor: supportsPM25Sensor,
1106
1127
  pM25SensorStatus: pM25SensorStatus,
1107
1128
  pM25Level: pM25Level,
1108
1129
  pM25AirQuality: pM25AirQuality,
1109
- hasAutoVentilationMode: hasAutoVentilationMode,
1110
- hasBypassVentilationMode: hasBypassVentilationMode,
1111
- hasAutomaticFanSpeed: hasAutomaticFanSpeed,
1130
+ supportsAutoVentilationMode: supportsAutoVentilationMode,
1131
+ supportsBypassVentilationMode: supportsBypassVentilationMode,
1132
+ supportsAutomaticFanSpeed: supportsAutomaticFanSpeed,
1133
+ supportsStanbyMode: supportsStanbyMode,
1112
1134
  coreMaintenanceRequired: coreMaintenanceRequired,
1113
1135
  filterMaintenanceRequired: filterMaintenanceRequired,
1114
1136
  actualVentilationMode: actualVentilationMode,
1115
1137
  numberOfFanSpeeds: numberOfFanSpeeds,
1138
+ supportsFanSpeed: supportsFanSpeed,
1116
1139
  power: power ? 1 : 0,
1140
+ inStandbyMode: inStandbyMode,
1117
1141
  operationMode: operationMode,
1118
1142
  currentOperationMode: 0,
1119
1143
  targetOperationMode: 0,
@@ -1173,26 +1197,27 @@ class DeviceErv extends EventEmitter {
1173
1197
 
1174
1198
  obj.currentOperationMode = !power ? 0 : obj.currentOperationMode;
1175
1199
  obj.targetOperationMode = obj.targetOperationMode;
1176
- obj.operationModeSetPropsMinValue = hasAutoVentilationMode ? 0 : 1;
1177
- obj.operationModeSetPropsMaxValue = hasAutoVentilationMode ? 2 : 2;
1178
- obj.operationModeSetPropsValidValues = hasAutoVentilationMode ? (hasBypassVentilationMode ? [0, 1, 2] : [0, 2]) : (hasBypassVentilationMode ? [1, 2] : [2]);
1200
+ obj.operationModeSetPropsMinValue = supportsAutoVentilationMode ? 0 : 1;
1201
+ obj.operationModeSetPropsMaxValue = supportsAutoVentilationMode ? 2 : 2;
1202
+ obj.operationModeSetPropsValidValues = supportsAutoVentilationMode ? (supportsBypassVentilationMode ? [0, 1, 2] : [0, 2]) : (supportsBypassVentilationMode ? [1, 2] : [2]);
1179
1203
 
1180
1204
  //fan speed mode
1181
1205
  obj.fanSpeedSetPropsMaxValue = 2;
1182
- switch (numberOfFanSpeeds) {
1183
- case 2: //Fan speed mode 2
1184
- obj.fanSpeed = hasAutomaticFanSpeed ? [3, 1, 2][setFanSpeed] : [0, 1, 2][setFanSpeed];
1185
- obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 3 : 2;
1186
- break;
1187
- case 3: //Fan speed mode 3
1188
- this.obj.fanSpeed = hasAutomaticFanSpeed ? [4, 1, 2, 3][setFanSpeed] : [0, 1, 2, 3][setFanSpeed];
1189
- obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 4 : 3;
1190
- break;
1191
- case 4: //Fan speed mode 4
1192
- obj.fanSpeed = hasAutomaticFanSpeed ? [5, 1, 2, 3, 4][setFanSpeed] : [0, 1, 2, 3, 4][setFanSpeed];
1193
- obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 5 : 4;
1194
- break;
1195
- };
1206
+
1207
+ // fan speed mode
1208
+ if (supportsFanSpeed) {
1209
+ const max = numberOfFanSpeeds;
1210
+ const autoIndex = supportsAutomaticFanSpeed ? max + 1 : 0;
1211
+
1212
+ // Tworzymy tablicę prędkości: [auto?, 1..N]
1213
+ const speeds = [autoIndex];
1214
+ for (let i = 1; i <= max; i++) {
1215
+ speeds.push(i);
1216
+ }
1217
+
1218
+ obj.fanSpeed = speeds[setFanSpeed];
1219
+ obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? max + 1 : max;
1220
+ }
1196
1221
 
1197
1222
  //update characteristics
1198
1223
  this.melCloudService
@@ -1203,8 +1228,8 @@ class DeviceErv extends EventEmitter {
1203
1228
  .updateCharacteristic(Characteristic.RotationSpeed, obj.fanSpeed)
1204
1229
  .updateCharacteristic(Characteristic.LockPhysicalControls, obj.lockPhysicalControl)
1205
1230
  .updateCharacteristic(Characteristic.TemperatureDisplayUnits, obj.useFahrenheit);
1206
- const updateDefCool = hasCoolOperationMode ? this.melCloudService?.updateCharacteristic(Characteristic.CoolingThresholdTemperature, defaultCoolingSetTemperature) : false;
1207
- const updateDefHeat = hasHeatOperationMode ? this.melCloudService?.updateCharacteristic(Characteristic.HeatingThresholdTemperature, defaultHeatingSetTemperature) : false;
1231
+ const updateDefCool = supportsCoolOperationMode ? this.melCloudService?.updateCharacteristic(Characteristic.CoolingThresholdTemperature, defaultCoolingSetTemperature) : false;
1232
+ const updateDefHeat = supportsHeatOperationMode ? this.melCloudService?.updateCharacteristic(Characteristic.HeatingThresholdTemperature, defaultHeatingSetTemperature) : false;
1208
1233
  break;
1209
1234
  case 2: //Thermostat
1210
1235
  //operation mode - 0, HEAT, 2, COOL, 4, 5, 6, FAN, AUTO
@@ -1238,9 +1263,9 @@ class DeviceErv extends EventEmitter {
1238
1263
 
1239
1264
  obj.currentOperationMode = !power ? 0 : obj.currentOperationMode;
1240
1265
  obj.targetOperationMode = !power ? 0 : obj.targetOperationMode;
1241
- obj.operationModeSetPropsMinValue = hasAutoVentilationMode ? 0 : 0;
1242
- obj.operationModeSetPropsMaxValue = hasAutoVentilationMode ? 3 : 2;
1243
- obj.operationModeSetPropsValidValues = hasAutoVentilationMode ? (hasBypassVentilationMode ? [0, 1, 2, 3] : [0, 2, 3]) : (hasBypassVentilationMode ? [0, 1, 2] : [0, 2]);
1266
+ obj.operationModeSetPropsMinValue = supportsAutoVentilationMode ? 0 : 0;
1267
+ obj.operationModeSetPropsMaxValue = supportsAutoVentilationMode ? 3 : 2;
1268
+ obj.operationModeSetPropsValidValues = supportsAutoVentilationMode ? (supportsBypassVentilationMode ? [0, 1, 2, 3] : [0, 2, 3]) : (supportsBypassVentilationMode ? [0, 1, 2] : [0, 2]);
1244
1269
 
1245
1270
  //update characteristics
1246
1271
  this.melCloudService
@@ -1274,7 +1299,8 @@ class DeviceErv extends EventEmitter {
1274
1299
  ?.updateCharacteristic(Characteristic.AirQuality, pM25AirQuality)
1275
1300
  .updateCharacteristic(Characteristic.PM2_5Density, pM25Level);
1276
1301
 
1277
- //error sensor
1302
+ //other sensors
1303
+ this.inStandbyService?.updateCharacteristic(Characteristic.ContactSensorState, inStandbyMode);
1278
1304
  this.connectService?.updateCharacteristic(Characteristic.ContactSensorState, isConnected);
1279
1305
  this.errorService?.updateCharacteristic(Characteristic.ContactSensorState, isInError);
1280
1306
 
@@ -1381,16 +1407,16 @@ class DeviceErv extends EventEmitter {
1381
1407
  this.emit('info', `Current ventilation mode: ${Ventilation.OperationModeMapEnumToString[actualVentilationMode]}`);
1382
1408
  this.emit('info', `Target temperature: ${setTemperature}${obj.temperatureUnit}`);
1383
1409
  this.emit('info', `Room temperature: ${roomTemperature}${obj.temperatureUnit}`);
1384
- if (hasSupplyTemperature && deviceData.Device.SupplyTemperature !== null) this.emit('info', `Supply temperature: ${roomTemperature}${obj.temperatureUnit}`);
1385
- if (hasOutdoorTemperature && deviceData.Device.OutdoorTemperature !== null) this.emit('info', `Outdoor temperature: ${roomTemperature}${obj.temperatureUnit}`);
1410
+ if (supportsSupplyTemperature && deviceData.Device.SupplyTemperature !== null) this.emit('info', `Supply temperature: ${roomTemperature}${obj.temperatureUnit}`);
1411
+ if (supportsOutdoorTemperature && deviceData.Device.OutdoorTemperature !== null) this.emit('info', `Outdoor temperature: ${roomTemperature}${obj.temperatureUnit}`);
1386
1412
  this.emit('info', `Fan speed mode: ${Ventilation.FanSpeedMapEnumToString[setFanSpeed]}`);
1387
1413
  this.emit('info', `Temperature display unit: ${obj.temperatureUnit}`);
1388
1414
  this.emit('info', `Core maintenance: ${Ventilation.CoreMaintenanceMapEnumToString[coreMaintenanceRequired]}`);
1389
1415
  this.emit('info', `Filter maintenance: ${Ventilation.FilterMaintenanceMapEnumToString[filterMaintenanceRequired]}`);
1390
- if (hasCO2Sensor) this.emit('info', `CO2 detected: ${Ventilation.Co2DetectedMapEnumToString[roomCO2Detected]}`);
1391
- if (hasCO2Sensor) this.emit('info', `CO2 level: ${roomCO2Level} ppm`);
1392
- if (hasPM25Sensor) this.emit('info', `PM2.5 air quality: ${Ventilation.PM25AirQualityMapEnumToString[pM25AirQuality]}`);
1393
- if (hasPM25Sensor) this.emit('info', `PM2.5 level: ${pM25Level} µg/m`);
1416
+ if (supportsCO2Sensor) this.emit('info', `CO2 detected: ${Ventilation.Co2DetectedMapEnumToString[roomCO2Detected]}`);
1417
+ if (supportsCO2Sensor) this.emit('info', `CO2 level: ${roomCO2Level} ppm`);
1418
+ if (supportsPM25Sensor) this.emit('info', `PM2.5 air quality: ${Ventilation.PM25AirQualityMapEnumToString[pM25AirQuality]}`);
1419
+ if (supportsPM25Sensor) this.emit('info', `PM2.5 level: ${pM25Level} µg/m`);
1394
1420
  };
1395
1421
  })
1396
1422
  .on('success', (success) => this.emit('success', success))
package/src/melcloud.js CHANGED
@@ -283,10 +283,7 @@ class MelCloud extends EventEmitter {
283
283
  if (device.FrostProtection) device.FrostProtection = { ...capitalizeKeys(device.FrostProtection || {}) };
284
284
  if (device.OverheatProtection) device.OverheatProtection = { ...capitalizeKeys(device.OverheatProtection || {}) };
285
285
  if (device.HolidayMode) device.HolidayMode = { ...capitalizeKeys(device.HolidayMode || {}) };
286
-
287
- if (Array.isArray(device.Schedule)) {
288
- device.Schedule = device.Schedule.map(capitalizeKeysDeep);
289
- }
286
+ if (Array.isArray(device.Schedule)) device.Schedule = device.Schedule.map(capitalizeKeysDeep);
290
287
 
291
288
  // Usuń stare pola Settings i Capabilities
292
289
  const { Settings, Capabilities, Id, GivenDisplayName, ...rest } = device;
@@ -23,6 +23,7 @@ class MelCloudAta extends EventEmitter {
23
23
 
24
24
  //set default values
25
25
  this.deviceData = {};
26
+ this.headers = {};
26
27
 
27
28
  //lock flags
28
29
  this.locks = true;
@@ -57,6 +58,7 @@ class MelCloudAta extends EventEmitter {
57
58
  return null;
58
59
  }
59
60
  const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
61
+ this.headers = deviceData.Headers;
60
62
 
61
63
  if (this.accountType === 'melcloudhome') {
62
64
  deviceData.SerialNumber = deviceData.DeviceID || '4.0.0';
@@ -102,9 +104,7 @@ class MelCloudAta extends EventEmitter {
102
104
  }, { indoor: {}, outdoor: {} });
103
105
 
104
106
  //display info if units are not configured in MELCloud service
105
- if (unitsCount === 0) {
106
- if (this.logDebug) this.emit('debug', `Units are not configured in MELCloud service`);
107
- };
107
+ if (unitsCount === 0 && this.logDebug) if (this.logDebug) this.emit('debug', `Units are not configured in MELCloud service`);
108
108
 
109
109
  //restFul
110
110
  if (this.restFulEnabled) {
@@ -149,7 +149,7 @@ class MelCloudAta extends EventEmitter {
149
149
  method: 'POST',
150
150
  baseURL: ApiUrls.BaseURL,
151
151
  timeout: 10000,
152
- headers: deviceData.Headers,
152
+ headers: this.headers,
153
153
  withCredentials: true
154
154
  });
155
155
 
@@ -262,7 +262,7 @@ class MelCloudAta extends EventEmitter {
262
262
  method: method,
263
263
  baseURL: ApiUrlsHome.BaseURL,
264
264
  timeout: 10000,
265
- headers: deviceData.Headers,
265
+ headers: this.headers,
266
266
  withCredentials: true
267
267
  });
268
268
 
@@ -23,6 +23,7 @@ class MelCloudAtw extends EventEmitter {
23
23
 
24
24
  //set default values
25
25
  this.devicesData = {};
26
+ this.headers = {};
26
27
 
27
28
  //lock flags
28
29
  this.locks = true;
@@ -57,6 +58,7 @@ class MelCloudAtw extends EventEmitter {
57
58
  return null;
58
59
  }
59
60
  const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
61
+ this.headers = deviceData.Headers;
60
62
 
61
63
  if (this.accountType === 'melcloudhome') {
62
64
  deviceData.SerialNumber = deviceData.DeviceID || '4.0.0';
@@ -93,9 +95,7 @@ class MelCloudAtw extends EventEmitter {
93
95
  }, { indoor: {}, outdoor: {} });
94
96
 
95
97
  //display info if units are not configured in MELCloud service
96
- if (unitsCount === 0) {
97
- if (this.logDebug) this.emit('debug', `Units are not configured in MELCloud service`);
98
- };
98
+ if (unitsCount === 0 && this.logDebug) if (this.logDebug) this.emit('debug', `Units are not configured in MELCloud service`);
99
99
 
100
100
  //restFul
101
101
  if (this.restFulEnabled) {
@@ -154,7 +154,7 @@ class MelCloudAtw extends EventEmitter {
154
154
  method: 'POST',
155
155
  baseURL: ApiUrls.BaseURL,
156
156
  timeout: 10000,
157
- headers: deviceData.Headers,
157
+ headers: this.headers,
158
158
  withCredentials: true
159
159
  });
160
160
 
@@ -232,7 +232,7 @@ class MelCloudAtw extends EventEmitter {
232
232
  method: method,
233
233
  baseURL: ApiUrlsHome.BaseURL,
234
234
  timeout: 10000,
235
- headers: deviceData.Headers,
235
+ headers: this.headers,
236
236
  withCredentials: true
237
237
  });
238
238
 
@@ -23,6 +23,7 @@ class MelCloudErv extends EventEmitter {
23
23
 
24
24
  //set default values
25
25
  this.devicesData = {};
26
+ this.headers = {};
26
27
 
27
28
  //lock flags
28
29
  this.locks = true;
@@ -57,6 +58,7 @@ class MelCloudErv extends EventEmitter {
57
58
  return null;
58
59
  }
59
60
  const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
61
+ this.headers = deviceData.Headers;
60
62
 
61
63
  if (this.accountType === 'melcloudhome') {
62
64
  deviceData.SerialNumber = deviceData.DeviceID || '4.0.0';
@@ -96,9 +98,7 @@ class MelCloudErv extends EventEmitter {
96
98
  }, { indoor: {}, outdoor: {} });
97
99
 
98
100
  //display info if units are not configured in MELCloud service
99
- if (unitsCount === 0) {
100
- if (this.logDebug) this.emit('debug', `Units are not configured in MELCloud service`);
101
- };
101
+ if (unitsCount === 0 && this.logDebug) if (this.logDebug) this.emit('debug', `Units are not configured in MELCloud service`);
102
102
 
103
103
  //restFul
104
104
  if (this.restFulEnabled) {
@@ -143,7 +143,7 @@ class MelCloudErv extends EventEmitter {
143
143
  method: 'POST',
144
144
  baseURL: ApiUrls.BaseURL,
145
145
  timeout: 10000,
146
- headers: deviceData.Headers,
146
+ headers: this.headers,
147
147
  withCredentials: true
148
148
  });
149
149
 
@@ -240,7 +240,7 @@ class MelCloudErv extends EventEmitter {
240
240
  method: method,
241
241
  baseURL: ApiUrlsHome.BaseURL,
242
242
  timeout: 10000,
243
- headers: deviceData.Headers,
243
+ headers: this.headers,
244
244
  withCredentials: true
245
245
  });
246
246