homebridge-melcloud-control 4.2.2-beta.9 → 4.2.3-beta.0

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,11 +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
29
  - added in standby mode sensor
30
+ - fix device control after some time
30
31
  - added connect sensor
31
32
  - config schema updated
32
33
  - readme updated
package/README.md CHANGED
@@ -245,8 +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[].inStandbySensor` | This enable `In Standby` sensor to use with automations in HomeKit app. |
249
- | `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. |
250
250
  | `ataDevices[].errorSensor` | This enable `Error` sensor to use with automations in HomeKit app. |
251
251
  | `ataDevices[].frostProtectionSupport` | This enable extra `Frost Protectio` control and sensors to use with automations in HomeKit app. |
252
252
  | `ataDevices[].overheatProtectionSupport` | This enable extra `Overheat Protection` control and sensors to use with automations in HomeKit app. |
@@ -281,8 +281,8 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
281
281
  | `atwDevices[].temperatureReturnWaterTankSensor` | This enable extra `Return Water Tank` temperature sensor to use with automations in HomeKit app. |
282
282
  | `atwDevices[].temperatureFlowZone2Sensor` | This enable extra `Flow Zone 2` temperature sensor to use with automations in HomeKit app. |
283
283
  | `atwDevices[].temperatureReturnZone2Sensor` | This enable extra `Return Zone 2` temperature sensor to use with automations in HomeKit app. |
284
- | `atwDevices[].inStandbySensor` | This enable `In Standby` sensor to use with automations in HomeKit app. |
285
- | `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. |
286
286
  | `atwDevices[].errorSensor` | This enable `Error` sensors to use with automations in HomeKit app. |
287
287
  | `atwDevices[].holidayModeSupport` | This enable extra `Holiday Mode` control and sensors to use with automations in HomeKit app. |
288
288
  | `atwDevices[].refreshInterval` | Here set the background devices state refresh time in (sec), default `5s`. |
@@ -308,8 +308,8 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
308
308
  | `ervDevices[].temperatureSensor` | This enable extra `Room` temperature sensor to use with automations in HomeKit app. |
309
309
  | `ervDevices[].temperatureOutdoorSensor` | This enable extra `Outdoor` temperature sensor to use with automations in HomeKit app. |
310
310
  | `ervDevices[].temperatureSupplySensor` | This enable extra `Supply` temperature sensor to use with automations in HomeKit app. |
311
- | `atwDevices[].inStandbySensor` | This enable `In Standby` sensor to use with automations in HomeKit app. |
312
- | `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. |
313
313
  | `ervDevices[].errorSensor` | This enable `Error` sensors to use with automations in HomeKit app. |
314
314
  | `ervDevices[].holidayModeSupport` | This enable extra `Holiday Mode` control and sensors to use with automations in HomeKit app. |
315
315
  | `ervDevices[].refreshInterval` | Here set the background devices state refresh time in (sec), default `5s`. |
@@ -405,7 +405,7 @@
405
405
  "title": "Connect",
406
406
  "type": "boolean",
407
407
  "default": false,
408
- "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."
409
409
  },
410
410
  "errorSensor": {
411
411
  "title": "Error",
@@ -1129,7 +1129,7 @@
1129
1129
  "title": "Connect",
1130
1130
  "type": "boolean",
1131
1131
  "default": false,
1132
- "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."
1133
1133
  },
1134
1134
  "errorSensor": {
1135
1135
  "title": "Error",
@@ -1613,7 +1613,7 @@
1613
1613
  "title": "Connect",
1614
1614
  "type": "boolean",
1615
1615
  "default": false,
1616
- "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."
1617
1617
  },
1618
1618
  "errorSensor": {
1619
1619
  "title": "Error",
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.9",
4
+ "version": "4.2.3-beta.0",
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
@@ -665,7 +665,7 @@ class DeviceAta extends EventEmitter {
665
665
  this.inStandbyService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} In Standby`);
666
666
  this.inStandbyService.getCharacteristic(Characteristic.ContactSensorState)
667
667
  .onGet(async () => {
668
- const state = this.accessory.isConnected;
668
+ const state = this.accessory.inStandbyMode;
669
669
  return state;
670
670
  })
671
671
  accessory.addService(this.inStandbyService);
@@ -1268,6 +1268,7 @@ class DeviceAta extends EventEmitter {
1268
1268
  const hideDryModeControl = deviceData.HideDryModeControl ?? false;
1269
1269
 
1270
1270
  //device info
1271
+ const supportsStanbyMode = deviceData.Device[supportStandbyKey];
1271
1272
  const supportsAutomaticFanSpeed = deviceData.Device.HasAutomaticFanSpeed ?? false;
1272
1273
  const supportsAirDirectionFunction = deviceData.Device[supportAirDirectionKey];
1273
1274
  const supportsSwingFunction = deviceData.Device[supportSwingKey];
@@ -1282,7 +1283,6 @@ class DeviceAta extends EventEmitter {
1282
1283
  const supportsCool1 = deviceData.Device[supportCoolKey];
1283
1284
  const supportsCool = this.coolDryFanMode >= 1 && supportsCool1;
1284
1285
  const numberOfFanSpeeds = supportsFanSpeed ? deviceData.Device.NumberOfFanSpeeds : 0;
1285
- const supportsStanbyMode = deviceData.Device[supportStandbyKey];
1286
1286
  const minTempHeat = 10;
1287
1287
  const maxTempHeat = 31;
1288
1288
  const minTempCoolDryAuto = 16;
@@ -1364,70 +1364,66 @@ class DeviceAta extends EventEmitter {
1364
1364
  //operating mode 0, HEAT, DRY, COOL, 4, 5, 6, FAN, AUTO, ISEE HEAT, ISEE DRY, ISEE COOL
1365
1365
  switch (this.displayType) {
1366
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
+
1367
1372
  switch (operationMode) {
1368
- case 1: //HEAT
1369
- obj.currentOperationMode = roomTemperature > setTemperature ? 1 : 2; //INACTIVE, IDLE, HEATING, COOLING
1370
- obj.targetOperationMode = 1; //AUTO, HEAT, COOL
1373
+ case 1: // HEAT
1374
+ obj.currentOperationMode = roomTemperature > setTemperature ? 1 : 2;
1375
+ obj.targetOperationMode = 1;
1371
1376
  break;
1372
- case 2: //DRY
1377
+ case 2: // DRY
1373
1378
  obj.currentOperationMode = 1;
1374
- obj.targetOperationMode = this.autoDryFanMode === 2 ? 0 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : obj.targetOperationMode ?? 0;
1379
+ obj.targetOperationMode = resolveTargetOperation(2, obj);
1375
1380
  break;
1376
- case 3: //COOL
1381
+ case 3: // COOL
1377
1382
  obj.currentOperationMode = roomTemperature < setTemperature ? 1 : 3;
1378
1383
  obj.targetOperationMode = 2;
1379
1384
  break;
1380
- case 7: //FAN
1385
+ case 7: // FAN
1381
1386
  obj.currentOperationMode = 1;
1382
- obj.targetOperationMode = this.autoDryFanMode === 3 ? 0 : this.heatDryFanMode === 3 ? 1 : this.coolDryFanMode === 3 ? 2 : obj.targetOperationMode ?? 0;
1387
+ obj.targetOperationMode = resolveTargetOperation(3, obj);
1383
1388
  break;
1384
- case 8: //AUTO
1389
+ case 8: // AUTO
1385
1390
  obj.currentOperationMode = roomTemperature > setTemperature ? 3 : roomTemperature < setTemperature ? 2 : 1;
1386
1391
  obj.targetOperationMode = 0;
1387
1392
  break;
1388
- case 9: //ISEE HEAT
1389
- obj.currentOperationMode = roomTemperature > setTemperature ? 1 : 2
1393
+ case 9: // ISEE HEAT
1394
+ obj.currentOperationMode = roomTemperature > setTemperature ? 1 : 2;
1390
1395
  obj.targetOperationMode = 1;
1391
1396
  break;
1392
- case 10: //ISEE DRY
1397
+ case 10: // ISEE DRY
1393
1398
  obj.currentOperationMode = 1;
1394
- obj.targetOperationMode = this.autoDryFanMode === 2 ? 0 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : obj.targetOperationMode ?? 0;
1399
+ obj.targetOperationMode = resolveTargetOperation(2, obj);
1395
1400
  break;
1396
- case 11: //ISEE COOL;
1401
+ case 11: // ISEE COOL
1397
1402
  obj.currentOperationMode = roomTemperature < setTemperature ? 1 : 3;
1398
1403
  obj.targetOperationMode = 2;
1399
1404
  break;
1400
1405
  default:
1401
1406
  if (this.logWarn) this.emit('warn', `Unknown operating mode: ${operationMode}`);
1402
- return
1403
- };
1407
+ }
1404
1408
 
1405
- obj.currentOperationMode = !power ? 0 : inStandbyMode ? 1 : obj.currentOperationMode;
1409
+ obj.currentOperationMode = !power ? 0 : (inStandbyMode ? 1 : obj.currentOperationMode);
1406
1410
  obj.operationModeSetPropsMinValue = supportsAuto && supportsHeat ? 0 : !supportsAuto && supportsHeat ? 1 : supportsAuto && !supportsHeat ? 0 : 2;
1407
1411
  obj.operationModeSetPropsMaxValue = 2
1408
1412
  obj.operationModeSetPropsValidValues = supportsAuto && supportsHeat ? [0, 1, 2] : !supportsAuto && supportsHeat ? [1, 2] : supportsAuto && !supportsHeat ? [0, 2] : [2];
1409
1413
 
1410
1414
  //fan speed mode
1411
1415
  if (supportsFanSpeed) {
1412
- switch (numberOfFanSpeeds) {
1413
- case 2: //Fan speed mode 2
1414
- obj.currentFanSpeed = supportsAutomaticFanSpeed ? [3, 1, 2][setFanSpeed] : [0, 1, 2][setFanSpeed];
1415
- obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 3 : 2;
1416
- break;
1417
- case 3: //Fan speed mode 3
1418
- obj.currentFanSpeed = supportsAutomaticFanSpeed ? [4, 1, 2, 3][setFanSpeed] : [0, 1, 2, 3][setFanSpeed];
1419
- obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 4 : 3;
1420
- break;
1421
- case 4: //Fan speed mode 4
1422
- obj.currentFanSpeed = supportsAutomaticFanSpeed ? [5, 1, 2, 3, 4][setFanSpeed] : [0, 1, 2, 3, 4][setFanSpeed];
1423
- obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 5 : 4;
1424
- break;
1425
- case 5: //Fan speed mode 5
1426
- obj.currentFanSpeed = supportsAutomaticFanSpeed ? [6, 1, 2, 3, 4, 5][setFanSpeed] : [0, 1, 2, 3, 4, 5][setFanSpeed];
1427
- obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 6 : 5;
1428
- break;
1429
- };
1430
- };
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
+ }
1431
1427
 
1432
1428
  //update characteristics
1433
1429
  this.melCloudService
@@ -1443,43 +1439,56 @@ class DeviceAta extends EventEmitter {
1443
1439
  if (supportsSwingFunction) this.melCloudService?.updateCharacteristic(Characteristic.SwingMode, obj.currentSwingMode);
1444
1440
  break;
1445
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
+
1446
1447
  switch (operationMode) {
1447
- case 1: //HEAT
1448
- obj.currentOperationMode = roomTemperature > setTemperature ? 0 : 1; //OFF, HEATING, COOLING
1449
- obj.targetOperationMode = 1; //OFF, HEAT, COOL, AUTO
1448
+ case 1: // HEAT
1449
+ obj.currentOperationMode = roomTemperature > setTemperature ? 0 : 1;
1450
+ obj.targetOperationMode = 1;
1450
1451
  break;
1451
- case 2: //DRY
1452
+
1453
+ case 2: // DRY
1452
1454
  obj.currentOperationMode = 0;
1453
- obj.targetOperationMode = this.autoDryFanMode === 2 ? 3 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : obj.targetOperationMode ?? 0;
1455
+ obj.targetOperationMode = resolveTargetOperation1(2, obj);
1454
1456
  break;
1455
- case 3: //COOL
1457
+
1458
+ case 3: // COOL
1456
1459
  obj.currentOperationMode = roomTemperature < setTemperature ? 0 : 2;
1457
1460
  obj.targetOperationMode = 2;
1458
1461
  break;
1459
- case 7: //FAN
1462
+
1463
+ case 7: // FAN
1460
1464
  obj.currentOperationMode = 0;
1461
- obj.targetOperationMode = this.autoDryFanMode === 3 ? 3 : this.heatDryFanMode === 3 ? 1 : this.coolDryFanMode === 3 ? 2 : obj.targetOperationMode ?? 0;
1465
+ obj.targetOperationMode = resolveTargetOperation1(3, obj);
1462
1466
  break;
1463
- case 8: //AUTO
1467
+
1468
+ case 8: // AUTO
1464
1469
  obj.currentOperationMode = roomTemperature < setTemperature ? 1 : roomTemperature > setTemperature ? 2 : 0;
1465
1470
  obj.targetOperationMode = 3;
1466
1471
  break;
1467
- case 9: //ISEE HEAT
1472
+
1473
+ case 9: // ISEE HEAT
1468
1474
  obj.currentOperationMode = roomTemperature > setTemperature ? 0 : 1;
1469
1475
  obj.targetOperationMode = 1;
1470
1476
  break;
1471
- case 10: //ISEE DRY
1477
+
1478
+ case 10: // ISEE DRY
1472
1479
  obj.currentOperationMode = 0;
1473
- obj.targetOperationMode = this.autoDryFanMode === 2 ? 3 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : obj.targetOperationMode ?? 0;
1480
+ obj.targetOperationMode = resolveTargetOperation1(2, obj);
1474
1481
  break;
1475
- case 11: //ISEE COOL;
1482
+
1483
+ case 11: // ISEE COOL
1476
1484
  obj.currentOperationMode = roomTemperature < setTemperature ? 0 : 2;
1477
1485
  obj.targetOperationMode = 2;
1478
1486
  break;
1487
+
1479
1488
  default:
1480
1489
  if (this.logWarn) this.emit('warn', `Unknown operating mode: ${operationMode}`);
1481
1490
  break;
1482
- };
1491
+ }
1483
1492
 
1484
1493
  obj.currentOperationMode = !power ? 0 : obj.currentOperationMode;
1485
1494
  obj.targetOperationMode = !power ? 0 : obj.targetOperationMode;
package/src/deviceatw.js CHANGED
@@ -1077,7 +1077,7 @@ class DeviceAtw extends EventEmitter {
1077
1077
  this.inStandbyService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} In Standby`);
1078
1078
  this.inStandbyService.getCharacteristic(Characteristic.ContactSensorState)
1079
1079
  .onGet(async () => {
1080
- const state = this.accessory.isConnected;
1080
+ const state = this.accessory.inStandbyMode;
1081
1081
  return state;
1082
1082
  })
1083
1083
  accessory.addService(this.inStandbyService);
@@ -1514,6 +1514,7 @@ class DeviceAtw extends EventEmitter {
1514
1514
  const holidayModeActive = deviceData.HolidayMode?.Active ?? false;
1515
1515
 
1516
1516
  //device info
1517
+ const supportsStanbyMode = deviceData.Device[supportStandbyKey];
1517
1518
  const supportsHeatPump = ![1, 2, 3, 4, 5, 6, 7, 15].includes(this.hideZone);
1518
1519
  const supportsZone1 = ![2, 3, 4, 8, 9, 10, 11, 15].includes(this.hideZone);
1519
1520
  const supportsHotWaterTank = ![3, 5, 6, 9, 10, 12, 13, 15].includes(this.hideZone) && deviceData.Device.HasHotWaterTank;
@@ -1525,7 +1526,6 @@ class DeviceAtw extends EventEmitter {
1525
1526
  const minSetTemperature = deviceData.Device.MinSetTemperature ?? 10;
1526
1527
  const maxSetTemperature = deviceData.Device.MaxSetTemperature ?? 30;
1527
1528
  const maxTankTemperature = deviceData.Device.MaxTankTemperature ?? 70;
1528
- const supportsStanbyMode = deviceData.Device[supportStandbyKey];
1529
1529
 
1530
1530
  //zones
1531
1531
  let currentZoneCase = 0;
@@ -1546,6 +1546,7 @@ class DeviceAtw extends EventEmitter {
1546
1546
  //heat pump
1547
1547
  const heatPumpName = 'Heat Pump';
1548
1548
  const power = deviceData.Device.Power ?? false;
1549
+ const inStandbyMode = deviceData.Device.InStandbyMode;
1549
1550
  const unitStatus = deviceData.Device.UnitStatus ?? 0;
1550
1551
  const operationMode = deviceData.Device.OperationMode;
1551
1552
  const outdoorTemperature = deviceData.Device.OutdoorTemperature;
@@ -1594,6 +1595,7 @@ class DeviceAtw extends EventEmitter {
1594
1595
  presets: presetsOnServer,
1595
1596
  schedules: schedulesOnServer,
1596
1597
  power: power ? 1 : 0,
1598
+ inStandbyMode: inStandbyMode,
1597
1599
  unitStatus: unitStatus,
1598
1600
  idleZone1: idleZone1,
1599
1601
  idleZone2: idleZone2,
@@ -1649,7 +1651,7 @@ class DeviceAtw extends EventEmitter {
1649
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
1650
1652
  name = heatPumpName;
1651
1653
  operationModeZone = operationMode;
1652
- 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
1653
1655
  targetOperationMode = [1, 2][unitStatus]; //AUTO, HEAT, COOL
1654
1656
  roomTemperature = outdoorTemperature;
1655
1657
  setTemperature = outdoorTemperature;
@@ -1664,7 +1666,7 @@ class DeviceAtw extends EventEmitter {
1664
1666
  case caseZone1: //Zone 1 - HEAT THERMOSTAT, HEAT FLOW, HEAT CURVE, COOL THERMOSTAT, COOL FLOW, FLOOR DRY UP
1665
1667
  name = zone1Name;
1666
1668
  operationModeZone = operationMode;
1667
- 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
1668
1670
  targetOperationMode = [1, 2, 0, 1, 2, 1][operationModeZone1]; //AUTO, HEAT, COOL
1669
1671
 
1670
1672
  switch (operationModeZone1) {
@@ -1696,7 +1698,7 @@ class DeviceAtw extends EventEmitter {
1696
1698
  case caseHotWater: //Hot Water - NORMAL, HEAT NOW
1697
1699
  name = hotWaterName;
1698
1700
  operationModeZone = operationMode;
1699
- 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
1700
1702
  targetOperationMode = [0, 1][forcedHotWaterMode] //AUTO, HEAT, COOL
1701
1703
  roomTemperature = tankWaterTemperature;
1702
1704
  setTemperature = setTankWaterTemperature;
@@ -1711,7 +1713,7 @@ class DeviceAtw extends EventEmitter {
1711
1713
  case caseZone2: //Zone 2 - HEAT THERMOSTAT, HEAT FLOW, HEAT CURVE, COOL THERMOSTAT, COOL FLOW, FLOOR DRY UP
1712
1714
  name = zone2Name;
1713
1715
  operationModeZone = operationMode;
1714
- 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
1715
1717
  targetOperationMode = [1, 2, 0, 1, 2, 1][operationModeZone2]; //AUTO, HEAT, COOL
1716
1718
 
1717
1719
  switch (operationModeZone2) {
@@ -1802,7 +1804,7 @@ class DeviceAtw extends EventEmitter {
1802
1804
  case caseHotWater: //Hot Water - NORMAL, HEAT NOW
1803
1805
  name = hotWaterName;
1804
1806
  operationModeZone = operationMode;
1805
- 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
1806
1808
  targetOperationMode = [3, 1][forcedHotWaterMode] //OFF, HEAT, COOL, AUTO
1807
1809
  roomTemperature = tankWaterTemperature;
1808
1810
  setTemperature = setTankWaterTemperature;
@@ -1816,7 +1818,7 @@ class DeviceAtw extends EventEmitter {
1816
1818
  case caseZone2: //Zone 2 - HEAT THERMOSTAT, HEAT FLOW, HEAT CURVE, COOL THERMOSTAT, COOL FLOW, FLOOR DRY UP
1817
1819
  name = zone2Name;
1818
1820
  operationModeZone = operationMode;
1819
- 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
1820
1822
  targetOperationMode = [1, 2, 3, 1, 2, 1][operationModeZone2]; //OFF, HEAT, COOL, AUTO
1821
1823
 
1822
1824
  switch (operationModeZone2) {
package/src/deviceerv.js CHANGED
@@ -273,6 +273,7 @@ class DeviceErv extends EventEmitter {
273
273
  const supportsAutomaticFanSpeed = this.accessory.supportsAutomaticFanSpeed;
274
274
  const supportsCO2Sensor = this.accessory.supportsCO2Sensor;
275
275
  const supportsPM25Sensor = this.accessory.supportsPM25Sensor;
276
+ const supportsFanSpeed = this.accessory.supportsFanSpeed;
276
277
  const numberOfFanSpeeds = this.accessory.numberOfFanSpeeds;
277
278
 
278
279
  //accessory
@@ -355,40 +356,42 @@ class DeviceErv extends EventEmitter {
355
356
  const value = this.accessory.roomTemperature;
356
357
  return value;
357
358
  });
358
- this.melCloudService.getCharacteristic(Characteristic.RotationSpeed)
359
- .setProps({
360
- minValue: 0,
361
- maxValue: this.accessory.fanSpeedSetPropsMaxValue,
362
- minStep: 1
363
- })
364
- .onGet(async () => {
365
- const value = this.accessory.fanSpeed; //STOP, 1, 2, 3, 4, OFF
366
- return value;
367
- })
368
- .onSet(async (value) => {
369
- try {
370
- switch (numberOfFanSpeeds) {
371
- case 2: //Fan speed mode 2
372
- value = supportsAutomaticFanSpeed ? [0, 1, 2, 0][value] : [1, 1, 2][value];
373
- break;
374
- case 3: //Fan speed mode 3
375
- value = supportsAutomaticFanSpeed ? [0, 1, 2, 3, 0][value] : [1, 1, 2, 3][value];
376
- break;
377
- case 4: //Fan speed mode 4
378
- value = supportsAutomaticFanSpeed ? [0, 1, 2, 3, 4, 0][value] : [1, 1, 2, 3, 4][value];
379
- break;
380
- case 5: //Fan speed mode 5
381
- value = supportsAutomaticFanSpeed ? [0, 1, 2, 3, 4, 5, 0][value] : [1, 1, 2, 3, 4, 5][value];
382
- break;;
383
- };
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
+ };
384
386
 
385
- deviceData.Device.SetFanSpeed = value
386
- await this.melCloudErv.send(this.accountType, this.displayType, deviceData, Ventilation.EffectiveFlags.SetFanSpeed);
387
- if (this.logInfo) this.emit('info', `Set fan speed mode: ${Ventilation.FanSpeedMapEnumToString[value]}`);
388
- } catch (error) {
389
- if (this.logWarn) this.emit('warn', `Set fan speed mode error: ${error}`);
390
- };
391
- });
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
+ }
392
395
  //device can cool
393
396
  if (supportsAutoVentilationMode && supportsCoolOperationMode) {
394
397
  this.melCloudService.getCharacteristic(Characteristic.CoolingThresholdTemperature)
@@ -696,7 +699,7 @@ class DeviceErv extends EventEmitter {
696
699
  this.inStandbyService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} In Standby`);
697
700
  this.inStandbyService.getCharacteristic(Characteristic.ContactSensorState)
698
701
  .onGet(async () => {
699
- const state = this.accessory.isConnected;
702
+ const state = this.accessory.inStandbyMode;
700
703
  return state;
701
704
  })
702
705
  accessory.addService(this.inStandbyService);
@@ -1064,6 +1067,7 @@ class DeviceErv extends EventEmitter {
1064
1067
  const hideOutdoorTemperature = deviceData.HideOutdoorTemperature;
1065
1068
 
1066
1069
  //device info
1070
+ const supportsStanbyMode = deviceData.Device[supportStandbyKey];
1067
1071
  const supportsCoolOperationMode = deviceData.Device.HasCoolOperationMode ?? false;
1068
1072
  const supportsHeatOperationMode = deviceData.Device.HasHeatOperationMode ?? false;
1069
1073
  const supportsAutoOperationMode = deviceData.Device.HasAutoOperationMode ?? false;
@@ -1071,7 +1075,6 @@ class DeviceErv extends EventEmitter {
1071
1075
  const supportsSupplyTemperature = deviceData.Device.HasSupplyTemperature ?? false;
1072
1076
  const supportsOutdoorTemperature = deviceData.Device.HasOutdoorTemperature ?? false;
1073
1077
  const supportsCO2Sensor = deviceData.Device.HasCO2Sensor ?? false;
1074
- const supportsStanbyMode = deviceData.Device[supportStandbyKey];
1075
1078
  const roomCO2Level = deviceData.Device.RoomCO2Level ?? false;
1076
1079
  const roomCO2Detected = supportsCO2Sensor && roomCO2Level > 1000 ? true : false;
1077
1080
  const supportsPM25Sensor = deviceData.Device.HasPM25Sensor ?? false;
@@ -1081,10 +1084,11 @@ class DeviceErv extends EventEmitter {
1081
1084
  const supportsAutoVentilationMode = deviceData.Device.HasAutoVentilationMode ?? false;
1082
1085
  const supportsBypassVentilationMode = deviceData.Device.HasBypassVentilationMode ?? false;
1083
1086
  const supportsAutomaticFanSpeed = deviceData.Device.HasAutomaticFanSpeed ?? false;
1084
- const coreMaintenanceRequired = deviceData.Device.CoreMaintenanceRequired;
1085
- const filterMaintenanceRequired = deviceData.Device.FilterMaintenanceRequired;
1086
1087
  const actualVentilationMode = deviceData.Device.ActualVentilationMode;
1087
1088
  const numberOfFanSpeeds = deviceData.Device.NumberOfFanSpeeds;
1089
+ const supportsFanSpeed = numberOfFanSpeeds > 0;
1090
+ const coreMaintenanceRequired = deviceData.Device.CoreMaintenanceRequired;
1091
+ const filterMaintenanceRequired = deviceData.Device.FilterMaintenanceRequired;
1088
1092
  const temperatureIncrement = deviceData.Device[tempStepKey] ?? 1;
1089
1093
  const minTempHeat = 10;
1090
1094
  const maxTempHeat = 31;
@@ -1093,6 +1097,7 @@ class DeviceErv extends EventEmitter {
1093
1097
 
1094
1098
  //device state
1095
1099
  const power = deviceData.Device.Power;
1100
+ const inStandbyMode = deviceData.Device.InStandbyMode;
1096
1101
  const roomTemperature = deviceData.Device.RoomTemperature;
1097
1102
  const supplyTemperature = deviceData.Device.SupplyTemperature;
1098
1103
  const outdoorTemperature = deviceData.Device.OutdoorTemperature;
@@ -1130,7 +1135,9 @@ class DeviceErv extends EventEmitter {
1130
1135
  filterMaintenanceRequired: filterMaintenanceRequired,
1131
1136
  actualVentilationMode: actualVentilationMode,
1132
1137
  numberOfFanSpeeds: numberOfFanSpeeds,
1138
+ supportsFanSpeed: supportsFanSpeed,
1133
1139
  power: power ? 1 : 0,
1140
+ inStandbyMode: inStandbyMode,
1134
1141
  operationMode: operationMode,
1135
1142
  currentOperationMode: 0,
1136
1143
  targetOperationMode: 0,
@@ -1196,20 +1203,21 @@ class DeviceErv extends EventEmitter {
1196
1203
 
1197
1204
  //fan speed mode
1198
1205
  obj.fanSpeedSetPropsMaxValue = 2;
1199
- switch (numberOfFanSpeeds) {
1200
- case 2: //Fan speed mode 2
1201
- obj.fanSpeed = supportsAutomaticFanSpeed ? [3, 1, 2][setFanSpeed] : [0, 1, 2][setFanSpeed];
1202
- obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 3 : 2;
1203
- break;
1204
- case 3: //Fan speed mode 3
1205
- this.obj.fanSpeed = supportsAutomaticFanSpeed ? [4, 1, 2, 3][setFanSpeed] : [0, 1, 2, 3][setFanSpeed];
1206
- obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 4 : 3;
1207
- break;
1208
- case 4: //Fan speed mode 4
1209
- obj.fanSpeed = supportsAutomaticFanSpeed ? [5, 1, 2, 3, 4][setFanSpeed] : [0, 1, 2, 3, 4][setFanSpeed];
1210
- obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 5 : 4;
1211
- break;
1212
- };
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
+ }
1213
1221
 
1214
1222
  //update characteristics
1215
1223
  this.melCloudService
package/src/melcloud.js CHANGED
@@ -147,17 +147,17 @@ class MelCloud extends EventEmitter {
147
147
  method: 'POST',
148
148
  baseURL: ApiUrls.BaseURL,
149
149
  timeout: 15000,
150
+ data: {
151
+ Email: this.user,
152
+ Password: this.passwd,
153
+ Language: this.language,
154
+ AppVersion: '1.34.12',
155
+ CaptchaChallenge: '',
156
+ CaptchaResponse: '',
157
+ Persist: true
158
+ }
150
159
  });
151
160
 
152
- const data = {
153
- Email: this.user,
154
- Password: this.passwd,
155
- Language: this.language,
156
- AppVersion: '1.34.12',
157
- CaptchaChallenge: '',
158
- CaptchaResponse: '',
159
- Persist: true
160
- };
161
161
 
162
162
  const accountData = await axiosInstance(ApiUrls.ClientLogin, { data: data });
163
163
  const account = accountData.data;
@@ -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;
@@ -75,7 +75,7 @@ class MelCloudAta extends EventEmitter {
75
75
 
76
76
  const safeConfig = {
77
77
  ...deviceData,
78
- headers: 'removed',
78
+ Headers: 'removed',
79
79
  };
80
80
  if (this.logDebug) this.emit('debug', `Device Data: ${JSON.stringify(safeConfig, null, 2)}`);
81
81
 
@@ -102,9 +102,7 @@ class MelCloudAta extends EventEmitter {
102
102
  }, { indoor: {}, outdoor: {} });
103
103
 
104
104
  //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
- };
105
+ if (unitsCount === 0 && this.logDebug) if (this.logDebug) this.emit('debug', `Units are not configured in MELCloud service`);
108
106
 
109
107
  //restFul
110
108
  if (this.restFulEnabled) {
@@ -145,13 +143,6 @@ class MelCloudAta extends EventEmitter {
145
143
  let path = '';
146
144
  switch (accountType) {
147
145
  case "melcloud":
148
- const axiosInstancePost = axios.create({
149
- method: 'POST',
150
- baseURL: ApiUrls.BaseURL,
151
- timeout: 10000,
152
- headers: deviceData.Headers,
153
- withCredentials: true
154
- });
155
146
 
156
147
  if (displayType === 1 && deviceData.Device.OperationMode === 8) {
157
148
  deviceData.Device.SetTemperature = (deviceData.Device.DefaultCoolingSetTemperature + deviceData.Device.DefaultHeatingSetTemperature) / 2;
@@ -159,28 +150,34 @@ class MelCloudAta extends EventEmitter {
159
150
 
160
151
  deviceData.Device.EffectiveFlags = effectiveFlags;
161
152
  payload = {
162
- data: {
163
- DeviceID: deviceData.Device.DeviceID,
164
- EffectiveFlags: deviceData.Device.EffectiveFlags,
165
- Power: deviceData.Device.Power,
166
- SetTemperature: deviceData.Device.SetTemperature,
167
- SetFanSpeed: deviceData.Device.FanSpeed,
168
- OperationMode: deviceData.Device.OperationMode,
169
- VaneHorizontal: deviceData.Device.VaneHorizontalDirection,
170
- VaneVertical: deviceData.Device.VaneVerticalDirection,
171
- DefaultHeatingSetTemperature: deviceData.Device.DefaultHeatingSetTemperature,
172
- DefaultCoolingSetTemperature: deviceData.Device.DefaultCoolingSetTemperature,
173
- ProhibitSetTemperature: deviceData.Device.ProhibitSetTemperature,
174
- ProhibitOperationMode: deviceData.Device.ProhibitOperationMode,
175
- ProhibitPower: deviceData.Device.ProhibitPower,
176
- HideVaneControls: deviceData.HideVaneControls,
177
- HideDryModeControl: deviceData.HideDryModeControl,
178
- HasPendingCommand: true
179
- }
153
+ DeviceID: deviceData.Device.DeviceID,
154
+ EffectiveFlags: deviceData.Device.EffectiveFlags,
155
+ Power: deviceData.Device.Power,
156
+ SetTemperature: deviceData.Device.SetTemperature,
157
+ SetFanSpeed: deviceData.Device.FanSpeed,
158
+ OperationMode: deviceData.Device.OperationMode,
159
+ VaneHorizontal: deviceData.Device.VaneHorizontalDirection,
160
+ VaneVertical: deviceData.Device.VaneVerticalDirection,
161
+ DefaultHeatingSetTemperature: deviceData.Device.DefaultHeatingSetTemperature,
162
+ DefaultCoolingSetTemperature: deviceData.Device.DefaultCoolingSetTemperature,
163
+ ProhibitSetTemperature: deviceData.Device.ProhibitSetTemperature,
164
+ ProhibitOperationMode: deviceData.Device.ProhibitOperationMode,
165
+ ProhibitPower: deviceData.Device.ProhibitPower,
166
+ HideVaneControls: deviceData.HideVaneControls,
167
+ HideDryModeControl: deviceData.HideDryModeControl,
168
+ HasPendingCommand: true
180
169
  };
181
- if (this.logDebug) this.emit('debug', `Send Data: ${JSON.stringify(payload.data, null, 2)}`);
170
+ if (this.logDebug) this.emit('debug', `Send Data: ${JSON.stringify(payload, null, 2)}`);
182
171
 
183
- await axiosInstancePost(ApiUrls.SetAta, payload);
172
+ const axiosInstancePost = axios.create({
173
+ method: 'POST',
174
+ baseURL: ApiUrls.BaseURL,
175
+ timeout: 10000,
176
+ headers: deviceData.Headers,
177
+ data: payload
178
+ });
179
+
180
+ await axiosInstancePost(ApiUrls.SetAta);
184
181
  this.updateData(deviceData);
185
182
  return true;
186
183
  case "melcloudhome":
@@ -199,59 +196,47 @@ class MelCloudAta extends EventEmitter {
199
196
  switch (effectiveFlags) {
200
197
  case 'frostprotection':
201
198
  payload = {
202
- data: {
203
- enabled: deviceData.FrostProtection.Enabled,
204
- min: deviceData.FrostProtection.Min,
205
- max: deviceData.FrostProtection.Max,
206
- units: { "ATA": [deviceData.DeviceID] }
207
- }
199
+ enabled: deviceData.FrostProtection.Enabled,
200
+ min: deviceData.FrostProtection.Min,
201
+ max: deviceData.FrostProtection.Max,
202
+ units: { "ATA": [deviceData.DeviceID] }
208
203
  };
209
204
  method = 'POST';
210
205
  path = ApiUrlsHome.PostProtectionFrost;
211
206
  break;
212
207
  case 'overheatprotection':
213
208
  payload = {
214
- data: {
215
- enabled: deviceData.OverheatProtection.Enabled,
216
- min: deviceData.OverheatProtection.Min,
217
- max: deviceData.OverheatProtection.Max,
218
- units: { "ATA": [deviceData.DeviceID] }
219
- }
209
+ enabled: deviceData.OverheatProtection.Enabled,
210
+ min: deviceData.OverheatProtection.Min,
211
+ max: deviceData.OverheatProtection.Max,
212
+ units: { "ATA": [deviceData.DeviceID] }
220
213
  };
221
214
  method = 'POST';
222
215
  path = ApiUrlsHome.PostProtectionOverheat;
223
216
  break;
224
217
  case 'holidaymode':
225
218
  payload = {
226
- data: {
227
- enabled: deviceData.HolidayMode.Enabled,
228
- startDate: deviceData.HolidayMode.StartDate,
229
- endDate: deviceData.HolidayMode.EndDate,
230
- units: { "ATA": [deviceData.DeviceID] }
231
- }
219
+ enabled: deviceData.HolidayMode.Enabled,
220
+ startDate: deviceData.HolidayMode.StartDate,
221
+ endDate: deviceData.HolidayMode.EndDate,
222
+ units: { "ATA": [deviceData.DeviceID] }
232
223
  };
233
224
  method = 'POST';
234
225
  path = ApiUrlsHome.PostHolidayMode;
235
226
  break;
236
227
  case 'schedule':
237
- payload = {
238
- data: {
239
- enabled: deviceData.ScheduleEnabled
240
- }
241
- };
228
+ payload = { enabled: deviceData.ScheduleEnabled };
242
229
  method = 'PUT';
243
230
  path = ApiUrlsHome.PutScheduleEnable.replace('deviceid', deviceData.DeviceID);
244
231
  break;
245
232
  default:
246
233
  payload = {
247
- data: {
248
- Power: deviceData.Device.Power,
249
- SetTemperature: deviceData.Device.SetTemperature,
250
- SetFanSpeed: String(deviceData.Device.SetFanSpeed),
251
- OperationMode: AirConditioner.OperationModeMapEnumToString[deviceData.Device.OperationMode],
252
- VaneHorizontalDirection: AirConditioner.VaneHorizontalDirectionMapEnumToString[deviceData.Device.VaneHorizontalDirection],
253
- VaneVerticalDirection: AirConditioner.VaneVerticalDirectionMapEnumToString[deviceData.Device.VaneVerticalDirection],
254
- }
234
+ Power: deviceData.Device.Power,
235
+ SetTemperature: deviceData.Device.SetTemperature,
236
+ SetFanSpeed: String(deviceData.Device.SetFanSpeed),
237
+ OperationMode: AirConditioner.OperationModeMapEnumToString[deviceData.Device.OperationMode],
238
+ VaneHorizontalDirection: AirConditioner.VaneHorizontalDirectionMapEnumToString[deviceData.Device.VaneHorizontalDirection],
239
+ VaneVerticalDirection: AirConditioner.VaneVerticalDirectionMapEnumToString[deviceData.Device.VaneVerticalDirection],
255
240
  };
256
241
  method = 'PUT';
257
242
  path = ApiUrlsHome.SetAta.replace('deviceid', deviceData.DeviceID);
@@ -263,11 +248,11 @@ class MelCloudAta extends EventEmitter {
263
248
  baseURL: ApiUrlsHome.BaseURL,
264
249
  timeout: 10000,
265
250
  headers: deviceData.Headers,
266
- withCredentials: true
251
+ data: payload
267
252
  });
268
253
 
269
- if (this.logDebug) this.emit('debug', `Send Data: ${JSON.stringify(settings.data, null, 2)}`);
270
- await axiosInstancePut(path, payload);
254
+ if (this.logDebug) this.emit('debug', `Send Data: ${JSON.stringify(payload, null, 2)}`);
255
+ await axiosInstancePut(path);
271
256
  this.updateData(deviceData);
272
257
  return true;
273
258
  default:
@@ -64,7 +64,7 @@ class MelCloudAtw extends EventEmitter {
64
64
  }
65
65
  const safeConfig = {
66
66
  ...deviceData,
67
- headers: 'removed',
67
+ Headers: 'removed',
68
68
  };
69
69
  if (this.logDebug) this.emit('debug', `Device Data: ${JSON.stringify(safeConfig, null, 2)}`);
70
70
 
@@ -93,9 +93,7 @@ class MelCloudAtw extends EventEmitter {
93
93
  }, { indoor: {}, outdoor: {} });
94
94
 
95
95
  //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
- };
96
+ if (unitsCount === 0 && this.logDebug) if (this.logDebug) this.emit('debug', `Units are not configured in MELCloud service`);
99
97
 
100
98
  //restFul
101
99
  if (this.restFulEnabled) {
@@ -232,12 +230,11 @@ class MelCloudAtw extends EventEmitter {
232
230
  method: method,
233
231
  baseURL: ApiUrlsHome.BaseURL,
234
232
  timeout: 10000,
235
- headers: deviceData.Headers,
236
- withCredentials: true
233
+ headers: deviceData.Headers
237
234
  });
238
235
 
239
- if (this.logDebug) this.emit('debug', `Send Data: ${JSON.stringify(settings.data, null, 2)}`);
240
- await axiosInstancePut(path, settings);
236
+ if (this.logDebug) this.emit('debug', `Send Data: ${JSON.stringify(payload.data, null, 2)}`);
237
+ await axiosInstancePut(path, payload);
241
238
  this.updateData(deviceData);
242
239
  return true;
243
240
  default:
@@ -69,7 +69,7 @@ class MelCloudErv extends EventEmitter {
69
69
  }
70
70
  const safeConfig = {
71
71
  ...deviceData,
72
- headers: 'removed',
72
+ Headers: 'removed',
73
73
  };
74
74
  if (this.logDebug) this.emit('debug', `Device Data: ${JSON.stringify(safeConfig, null, 2)}`);
75
75
 
@@ -96,9 +96,7 @@ class MelCloudErv extends EventEmitter {
96
96
  }, { indoor: {}, outdoor: {} });
97
97
 
98
98
  //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
- };
99
+ if (unitsCount === 0 && this.logDebug) if (this.logDebug) this.emit('debug', `Units are not configured in MELCloud service`);
102
100
 
103
101
  //restFul
104
102
  if (this.restFulEnabled) {
@@ -240,12 +238,11 @@ class MelCloudErv extends EventEmitter {
240
238
  method: method,
241
239
  baseURL: ApiUrlsHome.BaseURL,
242
240
  timeout: 10000,
243
- headers: deviceData.Headers,
244
- withCredentials: true
241
+ headers: deviceData.Headers
245
242
  });
246
243
 
247
- if (this.logDebug) this.emit('debug', `Send Data: ${JSON.stringify(settings.data, null, 2)}`);
248
- await axiosInstancePut(path, settings);
244
+ if (this.logDebug) this.emit('debug', `Send Data: ${JSON.stringify(payload.data, null, 2)}`);
245
+ await axiosInstancePut(path, payload);
249
246
  this.updateData(deviceData);
250
247
  return true;
251
248
  default: