homebridge-melcloud-control 4.1.3-beta.15 → 4.1.3-beta.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config.schema.json +41 -11
- package/package.json +1 -1
- package/src/deviceata.js +116 -33
- package/src/deviceatw.js +30 -26
- package/src/deviceerv.js +28 -23
- package/src/melcloudata.js +39 -9
- package/src/melcloudatw.js +21 -9
- package/src/melclouderv.js +21 -9
package/config.schema.json
CHANGED
|
@@ -395,29 +395,38 @@
|
|
|
395
395
|
"default": false,
|
|
396
396
|
"description": "This enable extra outdoor temperature sensor to use with automations in HomeKit app."
|
|
397
397
|
},
|
|
398
|
-
"
|
|
399
|
-
"title": "
|
|
398
|
+
"errorSensor": {
|
|
399
|
+
"title": "Error",
|
|
400
|
+
"type": "boolean",
|
|
401
|
+
"default": false,
|
|
402
|
+
"description": "This enable error sensor to use with automations in HomeKit app."
|
|
403
|
+
},
|
|
404
|
+
"frostProtectionSupport": {
|
|
405
|
+
"title": "Frost Protection Support",
|
|
400
406
|
"type": "boolean",
|
|
401
407
|
"default": false,
|
|
402
|
-
"description": "This enable extra frost protection
|
|
408
|
+
"description": "This enable extra frost protection control and sensors to use with automations in HomeKit app.",
|
|
403
409
|
"condition": {
|
|
404
410
|
"functionBody": "return model.accounts[arrayIndices[0]].type === 'melcloudhome';"
|
|
405
411
|
}
|
|
406
412
|
},
|
|
407
|
-
"
|
|
408
|
-
"title": "Overheat Protection",
|
|
413
|
+
"overheatProtectionSupport": {
|
|
414
|
+
"title": "Overheat Protection Support",
|
|
409
415
|
"type": "boolean",
|
|
410
416
|
"default": false,
|
|
411
|
-
"description": "This enable extra overheat protection
|
|
417
|
+
"description": "This enable extra overheat protection control and sensors to use with automations in HomeKit app.",
|
|
412
418
|
"condition": {
|
|
413
419
|
"functionBody": "return model.accounts[arrayIndices[0]].type === 'melcloudhome';"
|
|
414
420
|
}
|
|
415
421
|
},
|
|
416
|
-
"
|
|
417
|
-
"title": "
|
|
422
|
+
"holidayModeSupport": {
|
|
423
|
+
"title": "Holiday Mode Support",
|
|
418
424
|
"type": "boolean",
|
|
419
425
|
"default": false,
|
|
420
|
-
"description": "This enable
|
|
426
|
+
"description": "This enable extra holiday mode control and sensors to use with automations in HomeKit app.",
|
|
427
|
+
"condition": {
|
|
428
|
+
"functionBody": "return model.accounts[arrayIndices[0]].type === 'melcloudhome';"
|
|
429
|
+
}
|
|
421
430
|
},
|
|
422
431
|
"refreshInterval": {
|
|
423
432
|
"title": "Refresh Interval",
|
|
@@ -1104,6 +1113,15 @@
|
|
|
1104
1113
|
"default": false,
|
|
1105
1114
|
"description": "This enable error sensor to use with automations in HomeKit app."
|
|
1106
1115
|
},
|
|
1116
|
+
"holidayModeSupport": {
|
|
1117
|
+
"title": "Holiday Mode Support",
|
|
1118
|
+
"type": "boolean",
|
|
1119
|
+
"default": false,
|
|
1120
|
+
"description": "This enable extra holiday mode control and sensors to use with automations in HomeKit app.",
|
|
1121
|
+
"condition": {
|
|
1122
|
+
"functionBody": "return model.accounts[arrayIndices[0]].type === 'melcloudhome';"
|
|
1123
|
+
}
|
|
1124
|
+
},
|
|
1107
1125
|
"refreshInterval": {
|
|
1108
1126
|
"title": "Refresh Interval",
|
|
1109
1127
|
"type": "integer",
|
|
@@ -1567,6 +1585,15 @@
|
|
|
1567
1585
|
"default": false,
|
|
1568
1586
|
"description": "This enable error sensor to use with automations in HomeKit app."
|
|
1569
1587
|
},
|
|
1588
|
+
"holidayModeSupport": {
|
|
1589
|
+
"title": "Holiday Mode Support",
|
|
1590
|
+
"type": "boolean",
|
|
1591
|
+
"default": false,
|
|
1592
|
+
"description": "This enable extra holiday mode control and sensors to use with automations in HomeKit app.",
|
|
1593
|
+
"condition": {
|
|
1594
|
+
"functionBody": "return model.accounts[arrayIndices[0]].type === 'melcloudhome';"
|
|
1595
|
+
}
|
|
1596
|
+
},
|
|
1570
1597
|
"refreshInterval": {
|
|
1571
1598
|
"title": "Refresh Interval",
|
|
1572
1599
|
"type": "integer",
|
|
@@ -2112,6 +2139,9 @@
|
|
|
2112
2139
|
"accounts[].ataDevices[].heatDryFanMode",
|
|
2113
2140
|
"accounts[].ataDevices[].coolDryFanMode",
|
|
2114
2141
|
"accounts[].ataDevices[].autoDryFanMode",
|
|
2142
|
+
"accounts[].ataDevices[].frostProtectionSupportr",
|
|
2143
|
+
"accounts[].ataDevices[].overheatProtectionSupport",
|
|
2144
|
+
"accounts[].ataDevices[].holidayModeSupport",
|
|
2115
2145
|
"accounts[].ataDevices[].refreshInterval"
|
|
2116
2146
|
],
|
|
2117
2147
|
"condition": {
|
|
@@ -2191,8 +2221,6 @@
|
|
|
2191
2221
|
{
|
|
2192
2222
|
"title": "System",
|
|
2193
2223
|
"items": [
|
|
2194
|
-
"accounts[].ataDevices[].frostProtectionSensor",
|
|
2195
|
-
"accounts[].ataDevices[].overheatProtectionSensor",
|
|
2196
2224
|
"accounts[].ataDevices[].errorSensor"
|
|
2197
2225
|
]
|
|
2198
2226
|
},
|
|
@@ -2257,6 +2285,7 @@
|
|
|
2257
2285
|
"items": [
|
|
2258
2286
|
"accounts[].atwDevices[].hideZone",
|
|
2259
2287
|
"accounts[].atwDevices[].name",
|
|
2288
|
+
"accounts[].atwDevices[].holidayModeSupport",
|
|
2260
2289
|
"accounts[].atwDevices[].refreshInterval"
|
|
2261
2290
|
],
|
|
2262
2291
|
"condition": {
|
|
@@ -2406,6 +2435,7 @@
|
|
|
2406
2435
|
"expanded": false,
|
|
2407
2436
|
"items": [
|
|
2408
2437
|
"accounts[].ervDevices[].name",
|
|
2438
|
+
"accounts[].ervDevices[].holidayModeSupport",
|
|
2409
2439
|
"accounts[].ervDevices[].refreshInterval"
|
|
2410
2440
|
],
|
|
2411
2441
|
"condition": {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.1.3-beta.
|
|
4
|
+
"version": "4.1.3-beta.16",
|
|
5
5
|
"description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|
package/src/deviceata.js
CHANGED
|
@@ -29,9 +29,10 @@ class DeviceAta extends EventEmitter {
|
|
|
29
29
|
this.displayType = device.displayType;
|
|
30
30
|
this.temperatureSensor = device.temperatureSensor || false;
|
|
31
31
|
this.temperatureOutdoorSensor = device.temperatureOutdoorSensor || false;
|
|
32
|
-
this.frostProtectionSensor = device.frostProtectionSensor || false;
|
|
33
|
-
this.overheatProtectionSensor = device.overheatProtectionSensor || false;
|
|
34
32
|
this.errorSensor = device.errorSensor || false;
|
|
33
|
+
this.frostProtectionSupport = device.frostProtectionSupport || false;
|
|
34
|
+
this.overheatProtectionSupport = device.overheatProtectionSupport || false;
|
|
35
|
+
this.holidayModeSupport = device.holidayModeSupport || false;
|
|
35
36
|
this.heatDryFanMode = device.heatDryFanMode || 1; //NONE, HEAT, DRY, FAN
|
|
36
37
|
this.coolDryFanMode = device.coolDryFanMode || 1; //NONE, COOL, DRY, FAN
|
|
37
38
|
this.autoDryFanMode = device.autoDryFanMode || 1; //NONE, AUTO, DRY, FAN
|
|
@@ -617,10 +618,57 @@ class DeviceAta extends EventEmitter {
|
|
|
617
618
|
accessory.addService(this.outdoorTemperatureSensorService);
|
|
618
619
|
};
|
|
619
620
|
|
|
620
|
-
//
|
|
621
|
-
if (this.
|
|
621
|
+
//error sensor
|
|
622
|
+
if (this.errorSensor && this.accessory.isInError !== null) {
|
|
623
|
+
if (this.logDebug) this.emit('debug', `Prepare error service`);
|
|
624
|
+
this.errorService = new Service.ContactSensor(`${serviceName} Error`, `Error Sensor ${deviceId}`);
|
|
625
|
+
this.errorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
626
|
+
this.errorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Error`);
|
|
627
|
+
this.errorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
628
|
+
.onGet(async () => {
|
|
629
|
+
const state = this.accessory.isInError;
|
|
630
|
+
return state;
|
|
631
|
+
})
|
|
632
|
+
accessory.addService(this.errorService);
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
//frost protection
|
|
636
|
+
if (this.frostProtectionSupport && this.accessory.frostProtectionEnabled !== null) {
|
|
637
|
+
//control
|
|
638
|
+
if (this.logDebug) this.emit('debug', `Prepare frost protection control service`);
|
|
639
|
+
this.frostProtectionControlService = new Service.Switch(`${serviceName} Frost Protection`, `frostProtectionControlService${deviceId}`);
|
|
640
|
+
this.frostProtectionControlService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
641
|
+
this.frostProtectionControlService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName}Frost Protection`);
|
|
642
|
+
this.frostProtectionControlService.getCharacteristic(Characteristic.On)
|
|
643
|
+
.onGet(async () => {
|
|
644
|
+
const state = this.accessory.holidayModeEnabled;
|
|
645
|
+
return state;
|
|
646
|
+
})
|
|
647
|
+
.onSet(async (state) => {
|
|
648
|
+
try {
|
|
649
|
+
deviceData.FrostProtection.Enabled = state;
|
|
650
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'frostprotection');
|
|
651
|
+
if (this.logInfo) this.emit('info', `Frost protection: ${state ? 'Enabled' : 'Disabled'}`);
|
|
652
|
+
} catch (error) {
|
|
653
|
+
if (this.logWarn) this.emit('warn', `Set frost protection error: ${error}`);
|
|
654
|
+
};
|
|
655
|
+
});
|
|
656
|
+
accessory.addService(this.frostProtectionControlService);
|
|
657
|
+
|
|
658
|
+
if (this.logDebug) this.emit('debug', `Prepare frost protection control sensor service`);
|
|
659
|
+
this.frostProtectionControlSensorService = new Service.ContactSensor(`${serviceName} Frost Protection Control`, `frostProtectionControlSensorService${deviceId}`);
|
|
660
|
+
this.frostProtectionControlSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
661
|
+
this.frostProtectionControlSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Frost Protection Control`);
|
|
662
|
+
this.frostProtectionControlSensorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
663
|
+
.onGet(async () => {
|
|
664
|
+
const state = this.accessory.holidayModeEnabled;
|
|
665
|
+
return state;
|
|
666
|
+
})
|
|
667
|
+
accessory.addService(this.frostProtectionControlSensorService);
|
|
668
|
+
|
|
669
|
+
//sensor
|
|
622
670
|
if (this.logDebug) this.emit('debug', `Prepare frost protection service`);
|
|
623
|
-
this.frostProtectionSensorService = new Service.ContactSensor(`${serviceName} Frost Protection`, `
|
|
671
|
+
this.frostProtectionSensorService = new Service.ContactSensor(`${serviceName} Frost Protection`, `frostProtectionSensorService${deviceId}`);
|
|
624
672
|
this.frostProtectionSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
625
673
|
this.frostProtectionSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Frost Protection`);
|
|
626
674
|
this.frostProtectionSensorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
@@ -631,10 +679,42 @@ class DeviceAta extends EventEmitter {
|
|
|
631
679
|
accessory.addService(this.frostProtectionSensorService);
|
|
632
680
|
}
|
|
633
681
|
|
|
634
|
-
//overheat
|
|
635
|
-
if (this.
|
|
636
|
-
|
|
637
|
-
this.
|
|
682
|
+
//overheat protection
|
|
683
|
+
if (this.overheatProtectionSupport && this.accessory.overheatProtectionEnabled !== null) {
|
|
684
|
+
//control
|
|
685
|
+
if (this.logDebug) this.emit('debug', `Prepare overheat protection control service`);
|
|
686
|
+
this.overheatProtectionControlService = new Service.Switch(`${serviceName} Overheat Protection`, `overheatProtectionControlService${deviceId}`);
|
|
687
|
+
this.overheatProtectionControlService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
688
|
+
this.overheatProtectionControlService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Overheat Protection`);
|
|
689
|
+
this.overheatProtectionControlService.getCharacteristic(Characteristic.On)
|
|
690
|
+
.onGet(async () => {
|
|
691
|
+
const state = this.accessory.overheatProtectionEnabled;
|
|
692
|
+
return state;
|
|
693
|
+
})
|
|
694
|
+
.onSet(async (state) => {
|
|
695
|
+
try {
|
|
696
|
+
deviceData.OverheatProtection.Enabled = state;
|
|
697
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'overheatprotection');
|
|
698
|
+
if (this.logInfo) this.emit('info', `Overheat protection: ${state ? 'Enabled' : 'Disabled'}`);
|
|
699
|
+
} catch (error) {
|
|
700
|
+
if (this.logWarn) this.emit('warn', `Set overheat protection error: ${error}`);
|
|
701
|
+
};
|
|
702
|
+
});
|
|
703
|
+
accessory.addService(this.overheatProtectionControlService);
|
|
704
|
+
|
|
705
|
+
if (this.logDebug) this.emit('debug', `Prepare overheat protection control sensor service`);
|
|
706
|
+
this.overheatProtectionControlSensorService = new Service.ContactSensor(`${serviceName} Overheat Protection Control`, `overheatProtectionControlSensorService${deviceId}`);
|
|
707
|
+
this.overheatProtectionControlSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
708
|
+
this.overheatProtectionControlSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Overheat Protection Control`);
|
|
709
|
+
this.overheatProtectionControlSensorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
710
|
+
.onGet(async () => {
|
|
711
|
+
const state = this.accessory.overheatProtectionEnabled;
|
|
712
|
+
return state;
|
|
713
|
+
})
|
|
714
|
+
accessory.addService(this.overheatProtectionControlSensorService);
|
|
715
|
+
|
|
716
|
+
if (this.logDebug) this.emit('debug', `Prepare overheat protection sensor service`);
|
|
717
|
+
this.overheatProtectionSensorService = new Service.ContactSensor(`${serviceName} Overheat Protection`, `overheatProtectionSensorService${deviceId}`);
|
|
638
718
|
this.overheatProtectionSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
639
719
|
this.overheatProtectionSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Overheat Protection`);
|
|
640
720
|
this.overheatProtectionSensorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
@@ -646,7 +726,7 @@ class DeviceAta extends EventEmitter {
|
|
|
646
726
|
}
|
|
647
727
|
|
|
648
728
|
//holiday mode
|
|
649
|
-
if (this.accessory.holidayModeEnabled !== null) {
|
|
729
|
+
if (this.holidayModeSupport && this.accessory.holidayModeEnabled !== null) {
|
|
650
730
|
//control
|
|
651
731
|
if (this.logDebug) this.emit('debug', `Prepare holiday mode control service`);
|
|
652
732
|
this.holidayModeControlService = new Service.Switch(`${serviceName} Holiday Mode`, `Holiday Mode Control ${deviceId}`);
|
|
@@ -692,20 +772,6 @@ class DeviceAta extends EventEmitter {
|
|
|
692
772
|
accessory.addService(this.holidayModeSensorService);
|
|
693
773
|
}
|
|
694
774
|
|
|
695
|
-
//error sensor
|
|
696
|
-
if (this.errorSensor && this.accessory.isInError !== null) {
|
|
697
|
-
if (this.logDebug) this.emit('debug', `Prepare error service`);
|
|
698
|
-
this.errorService = new Service.ContactSensor(`${serviceName} Error`, `Error Sensor ${deviceId}`);
|
|
699
|
-
this.errorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
700
|
-
this.errorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Error`);
|
|
701
|
-
this.errorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
702
|
-
.onGet(async () => {
|
|
703
|
-
const state = this.accessory.isInError;
|
|
704
|
-
return state;
|
|
705
|
-
})
|
|
706
|
-
accessory.addService(this.errorService);
|
|
707
|
-
}
|
|
708
|
-
|
|
709
775
|
//presets services
|
|
710
776
|
if (this.presets.length > 0) {
|
|
711
777
|
if (this.logDebug) this.emit('debug', `Prepare presets services`);
|
|
@@ -789,7 +855,7 @@ class DeviceAta extends EventEmitter {
|
|
|
789
855
|
.onSet(async (state) => {
|
|
790
856
|
try {
|
|
791
857
|
deviceData.ScheduleEnabled = state;
|
|
792
|
-
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, '
|
|
858
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'schedule');
|
|
793
859
|
if (this.logInfo) this.emit('info', `Schedule: ${state ? 'Enabled' : 'Disabled'}`);
|
|
794
860
|
} catch (error) {
|
|
795
861
|
if (this.logWarn) this.emit('warn', `Set schedule error: ${error}`);
|
|
@@ -1360,16 +1426,33 @@ class DeviceAta extends EventEmitter {
|
|
|
1360
1426
|
};
|
|
1361
1427
|
this.accessory = obj;
|
|
1362
1428
|
|
|
1429
|
+
//senors
|
|
1363
1430
|
this.roomTemperatureSensorService?.updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature);
|
|
1364
1431
|
this.outdoorTemperatureSensorService?.updateCharacteristic(Characteristic.CurrentTemperature, outdoorTemperature);
|
|
1365
|
-
this.frostProtectionSensorService?.updateCharacteristic(Characteristic.ContactSensorState, frostProtectionActive);
|
|
1366
|
-
this.overheatProtectionSensorService?.updateCharacteristic(Characteristic.ContactSensorState, overheatProtectionActive);
|
|
1367
|
-
this.holidayModeControlService?.updateCharacteristic(Characteristic.On, holidayModeEnabled);
|
|
1368
|
-
this.holidayModeControlSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayModeEnabled);
|
|
1369
|
-
this.holidayModeSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayModeActive);
|
|
1370
1432
|
this.errorService?.updateCharacteristic(Characteristic.ContactSensorState, isInError);
|
|
1371
1433
|
|
|
1372
|
-
//
|
|
1434
|
+
//frost protection
|
|
1435
|
+
if (this.frostProtectionSupport && frostProtectionEnabled !== null) {
|
|
1436
|
+
this.frostProtectionControlService?.updateCharacteristic(Characteristic.On, frostProtectionEnabled);
|
|
1437
|
+
this.frostProtectionControlSensorService?.updateCharacteristic(Characteristic.ContactSensorState, frostProtectionEnabled);
|
|
1438
|
+
this.frostProtectionSensorService?.updateCharacteristic(Characteristic.ContactSensorState, frostProtectionActive);
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
//overheat protection
|
|
1442
|
+
if (this.overheatProtectionSupport && overheatProtectionEnabled !== null) {
|
|
1443
|
+
this.overheatProtectionControlService?.updateCharacteristic(Characteristic.On, overheatProtectionEnabled);
|
|
1444
|
+
this.overheatProtectionControlSensorService.updateCharacteristic(Characteristic.ContactSensorState, overheatProtectionEnabled);
|
|
1445
|
+
this.overheatProtectionSensorService?.updateCharacteristic(Characteristic.ContactSensorState, overheatProtectionActive);
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
//holiday mode
|
|
1449
|
+
if (this.holidayModeSupport && holidayModeEnabled !== null) {
|
|
1450
|
+
this.holidayModeControlService?.updateCharacteristic(Characteristic.On, holidayModeEnabled);
|
|
1451
|
+
this.holidayModeControlSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayModeEnabled);
|
|
1452
|
+
this.holidayModeSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayModeActive);
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
//presets
|
|
1373
1456
|
if (this.presets.length > 0) {
|
|
1374
1457
|
this.presets.forEach((preset, i) => {
|
|
1375
1458
|
const presetData = presetsOnServer.find(p => p.ID === preset.id);
|
|
@@ -1386,7 +1469,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1386
1469
|
});
|
|
1387
1470
|
};
|
|
1388
1471
|
|
|
1389
|
-
//
|
|
1472
|
+
//schedules
|
|
1390
1473
|
if (this.schedules.length > 0 && scheduleEnabled !== null) {
|
|
1391
1474
|
this.schedules.forEach((schedule, i) => {
|
|
1392
1475
|
//control
|
|
@@ -1404,7 +1487,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1404
1487
|
});
|
|
1405
1488
|
};
|
|
1406
1489
|
|
|
1407
|
-
//
|
|
1490
|
+
//buttons
|
|
1408
1491
|
if (this.buttons.length > 0) {
|
|
1409
1492
|
this.buttons.forEach((button, i) => {
|
|
1410
1493
|
const mode = button.mode;
|
package/src/deviceatw.js
CHANGED
|
@@ -38,6 +38,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
38
38
|
this.temperatureFlowZone2Sensor = device.temperatureFlowZone2Sensor || false;
|
|
39
39
|
this.temperatureReturnZone2Sensor = device.temperatureReturnZone2Sensor || false;
|
|
40
40
|
this.errorSensor = device.errorSensor || false;
|
|
41
|
+
this.holidayModeSupport = device.holidayModeSupport || false;
|
|
41
42
|
this.presets = this.accountType === 'melcloud' ? (device.presets || []).filter(preset => (preset.displayType ?? 0) > 0 && preset.id !== '0') : [];
|
|
42
43
|
this.schedules = this.accountType === 'melcloudhome' ? (device.schedules || []).filter(schedule => (schedule.displayType ?? 0) > 0 && schedule.id !== '0') : [];
|
|
43
44
|
this.buttons = (device.buttonsSensors || []).filter(button => (button.displayType ?? 0) > 0);
|
|
@@ -1047,11 +1048,25 @@ class DeviceAtw extends EventEmitter {
|
|
|
1047
1048
|
});
|
|
1048
1049
|
};
|
|
1049
1050
|
|
|
1051
|
+
//error sensor
|
|
1052
|
+
if (this.errorSensor && this.accessory.isInError !== null) {
|
|
1053
|
+
if (this.logDebug) this.emit('debug', `Prepare error service`);
|
|
1054
|
+
const serviceName = `${deviceTypeText} ${accessoryName}`;
|
|
1055
|
+
this.errorService = new Service.ContactSensor(`${serviceName} Error`, `Error Sensor ${deviceId}`);
|
|
1056
|
+
this.errorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
1057
|
+
this.errorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Error`);
|
|
1058
|
+
this.errorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
1059
|
+
.onGet(async () => {
|
|
1060
|
+
const state = this.accessory.isInError;
|
|
1061
|
+
return state;
|
|
1062
|
+
})
|
|
1063
|
+
accessory.addService(this.errorService);
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1050
1066
|
//holiday mode
|
|
1051
|
-
if (this.accessory.holidayModeEnabled !== null) {
|
|
1067
|
+
if (this.holidayModeSupport && this.accessory.holidayModeEnabled !== null) {
|
|
1052
1068
|
//control
|
|
1053
1069
|
if (this.logDebug) this.emit('debug', `Prepare holiday mode control service`);
|
|
1054
|
-
const serviceName = `${deviceTypeText} ${accessoryName}`;
|
|
1055
1070
|
this.holidayModeControlService = new Service.Switch(`${serviceName} Holiday Mode`, `Holiday Mode Control ${deviceId}`);
|
|
1056
1071
|
this.holidayModeControlService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
1057
1072
|
this.holidayModeControlService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Holiday Mode`);
|
|
@@ -1082,7 +1097,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1082
1097
|
})
|
|
1083
1098
|
accessory.addService(this.holidayModeControlSensorService);
|
|
1084
1099
|
|
|
1085
|
-
//
|
|
1100
|
+
//sensors
|
|
1086
1101
|
if (this.logDebug) this.emit('debug', `Prepare holiday mode sensor service`);
|
|
1087
1102
|
this.holidayModeSensorService = new Service.ContactSensor(`${serviceName} Holiday Mode`, `Holiday Mode Sensor ${deviceId}`);
|
|
1088
1103
|
this.holidayModeSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
@@ -1095,21 +1110,6 @@ class DeviceAtw extends EventEmitter {
|
|
|
1095
1110
|
accessory.addService(this.holidayModeSensorService);
|
|
1096
1111
|
}
|
|
1097
1112
|
|
|
1098
|
-
//error sensor
|
|
1099
|
-
if (this.errorSensor && this.accessory.isInError !== null) {
|
|
1100
|
-
if (this.logDebug) this.emit('debug', `Prepare error service`);
|
|
1101
|
-
const serviceName = `${deviceTypeText} ${accessoryName}`;
|
|
1102
|
-
this.errorService = new Service.ContactSensor(`${serviceName} Error`, `Error Sensor ${deviceId}`);
|
|
1103
|
-
this.errorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
1104
|
-
this.errorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Error`);
|
|
1105
|
-
this.errorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
1106
|
-
.onGet(async () => {
|
|
1107
|
-
const state = this.accessory.isInError;
|
|
1108
|
-
return state;
|
|
1109
|
-
})
|
|
1110
|
-
accessory.addService(this.errorService);
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
1113
|
//presets services
|
|
1114
1114
|
if (this.presets.length > 0) {
|
|
1115
1115
|
if (this.logDebug) this.emit('debug', `Prepare presets services`);
|
|
@@ -1206,7 +1206,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1206
1206
|
.onSet(async (state) => {
|
|
1207
1207
|
try {
|
|
1208
1208
|
deviceData.ScheduleEnabled = state;
|
|
1209
|
-
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, '
|
|
1209
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'schedule');
|
|
1210
1210
|
if (this.logInfo) this.emit('info', `Schedule: ${state ? 'Enabled' : 'Disabled'}`);
|
|
1211
1211
|
} catch (error) {
|
|
1212
1212
|
if (this.logWarn) this.emit('warn', `Set schedule error: ${error}`);
|
|
@@ -1945,13 +1945,17 @@ class DeviceAtw extends EventEmitter {
|
|
|
1945
1945
|
};
|
|
1946
1946
|
this.accessory = obj;
|
|
1947
1947
|
|
|
1948
|
-
//
|
|
1949
|
-
this.holidayModeControlService?.updateCharacteristic(Characteristic.On, holidayModeEnabled);
|
|
1950
|
-
this.holidayModeControlSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayModeEnabled);
|
|
1951
|
-
this.holidayModeSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayModeActive);
|
|
1948
|
+
//error sensor
|
|
1952
1949
|
this.errorService?.updateCharacteristic(Characteristic.ContactSensorState, isInError);
|
|
1953
1950
|
|
|
1954
|
-
//
|
|
1951
|
+
//holiday mode
|
|
1952
|
+
if (this.holidayModeSupport && holidayModeEnabled !== null) {
|
|
1953
|
+
this.holidayModeControlService?.updateCharacteristic(Characteristic.On, holidayModeEnabled);
|
|
1954
|
+
this.holidayModeControlSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayModeEnabled);
|
|
1955
|
+
this.holidayModeSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayModeActive);
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
//presets
|
|
1955
1959
|
if (this.presets.length > 0) {
|
|
1956
1960
|
this.presets.forEach((preset, i) => {
|
|
1957
1961
|
const presetData = presetsOnServer.find(p => p[presetsIdKey] === preset.id);
|
|
@@ -1974,7 +1978,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1974
1978
|
});
|
|
1975
1979
|
};
|
|
1976
1980
|
|
|
1977
|
-
//
|
|
1981
|
+
//schedules
|
|
1978
1982
|
if (this.schedules.length > 0 && scheduleEnabled !== null) {
|
|
1979
1983
|
this.schedules.forEach((schedule, i) => {
|
|
1980
1984
|
//control
|
|
@@ -1989,7 +1993,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1989
1993
|
});
|
|
1990
1994
|
};
|
|
1991
1995
|
|
|
1992
|
-
//
|
|
1996
|
+
//buttons
|
|
1993
1997
|
if (this.buttons.length > 0) {
|
|
1994
1998
|
this.buttons.forEach((button, i) => {
|
|
1995
1999
|
const mode = button.mode;
|
package/src/deviceerv.js
CHANGED
|
@@ -31,6 +31,7 @@ class DeviceErv extends EventEmitter {
|
|
|
31
31
|
this.temperatureOutdoorSensor = device.temperatureOutdoorSensor || false;
|
|
32
32
|
this.temperatureSupplySensor = device.temperatureSupplySensor || false;
|
|
33
33
|
this.errorSensor = device.errorSensor || false;
|
|
34
|
+
this.holidayModeSupport = device.holidayModeSupport || false;
|
|
34
35
|
this.presets = this.accountType === 'melcloud' ? (device.presets || []).filter(preset => (preset.displayType ?? 0) > 0 && preset.id !== '0') : [];
|
|
35
36
|
this.schedules = this.accountType === 'melcloudhome' ? (device.schedules || []).filter(schedule => (schedule.displayType ?? 0) > 0 && schedule.id !== '0') : [];
|
|
36
37
|
this.buttons = (device.buttonsSensors || []).filter(button => (button.displayType ?? 0) > 0);
|
|
@@ -666,8 +667,22 @@ class DeviceErv extends EventEmitter {
|
|
|
666
667
|
accessory.addService(this.airQualitySensorService);
|
|
667
668
|
}
|
|
668
669
|
|
|
670
|
+
//error sensor
|
|
671
|
+
if (this.errorSensor && this.accessory.isInError !== null) {
|
|
672
|
+
if (this.logDebug) this.emit('debug', `Prepare error service`);
|
|
673
|
+
this.errorService = new Service.ContactSensor(`${serviceName} Error`, `Error Sensor ${deviceId}`);
|
|
674
|
+
this.errorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
675
|
+
this.errorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Error`);
|
|
676
|
+
this.errorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
677
|
+
.onGet(async () => {
|
|
678
|
+
const state = this.accessory.isInError;
|
|
679
|
+
return state;
|
|
680
|
+
})
|
|
681
|
+
accessory.addService(this.errorService);
|
|
682
|
+
}
|
|
683
|
+
|
|
669
684
|
//holiday mode
|
|
670
|
-
if (this.accessory.holidayModeEnabled !== null) {
|
|
685
|
+
if (this.holidayModeSupport && this.accessory.holidayModeEnabled !== null) {
|
|
671
686
|
//control
|
|
672
687
|
if (this.logDebug) this.emit('debug', `Prepare holiday mode control service`);
|
|
673
688
|
this.holidayModeControlService = new Service.Switch(`${serviceName} Holiday Mode`, `Holiday Mode Control ${deviceId}`);
|
|
@@ -700,7 +715,7 @@ class DeviceErv extends EventEmitter {
|
|
|
700
715
|
})
|
|
701
716
|
accessory.addService(this.holidayModeControlSensorService);
|
|
702
717
|
|
|
703
|
-
//
|
|
718
|
+
//sensors
|
|
704
719
|
if (this.logDebug) this.emit('debug', `Prepare holiday mode sensor service`);
|
|
705
720
|
this.holidayModeSensorService = new Service.ContactSensor(`${serviceName} Holiday Mode`, `Holiday Mode Sensor ${deviceId}`);
|
|
706
721
|
this.holidayModeSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
@@ -713,20 +728,6 @@ class DeviceErv extends EventEmitter {
|
|
|
713
728
|
accessory.addService(this.holidayModeSensorService);
|
|
714
729
|
}
|
|
715
730
|
|
|
716
|
-
//error sensor
|
|
717
|
-
if (this.errorSensor && this.accessory.isInError !== null) {
|
|
718
|
-
if (this.logDebug) this.emit('debug', `Prepare error service`);
|
|
719
|
-
this.errorService = new Service.ContactSensor(`${serviceName} Error`, `Error Sensor ${deviceId}`);
|
|
720
|
-
this.errorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
721
|
-
this.errorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Error`);
|
|
722
|
-
this.errorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
723
|
-
.onGet(async () => {
|
|
724
|
-
const state = this.accessory.isInError;
|
|
725
|
-
return state;
|
|
726
|
-
})
|
|
727
|
-
accessory.addService(this.errorService);
|
|
728
|
-
}
|
|
729
|
-
|
|
730
731
|
//presets services
|
|
731
732
|
if (this.presets.length > 0) {
|
|
732
733
|
if (this.logDebug) this.emit('debug', `Prepare presets services`);
|
|
@@ -808,7 +809,7 @@ class DeviceErv extends EventEmitter {
|
|
|
808
809
|
.onSet(async (state) => {
|
|
809
810
|
try {
|
|
810
811
|
deviceData.ScheduleEnabled = state;
|
|
811
|
-
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, '
|
|
812
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'schedule');
|
|
812
813
|
if (this.logInfo) this.emit('info', `Schedule: ${state ? 'Enabled' : 'Disabled'}`);
|
|
813
814
|
} catch (error) {
|
|
814
815
|
if (this.logWarn) this.emit('warn', `Set schedule error: ${error}`);
|
|
@@ -1238,12 +1239,16 @@ class DeviceErv extends EventEmitter {
|
|
|
1238
1239
|
.updateCharacteristic(Characteristic.PM2_5Density, pM25Level);
|
|
1239
1240
|
|
|
1240
1241
|
//error sensor
|
|
1241
|
-
this.holidayModeControlService?.updateCharacteristic(Characteristic.On, holidayModeEnabled);
|
|
1242
|
-
this.holidayModeControlSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayModeEnabled);
|
|
1243
|
-
this.holidayModeSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayModeActive);
|
|
1244
1242
|
this.errorService?.updateCharacteristic(Characteristic.ContactSensorState, isInError);
|
|
1245
1243
|
|
|
1246
|
-
//
|
|
1244
|
+
//holiday mode
|
|
1245
|
+
if (this.holidayModeSupport && holidayModeEnabled !== null) {
|
|
1246
|
+
this.holidayModeControlService?.updateCharacteristic(Characteristic.On, holidayModeEnabled);
|
|
1247
|
+
this.holidayModeControlSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayModeEnabled);
|
|
1248
|
+
this.holidayModeSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayModeActive);
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
//presets
|
|
1247
1252
|
if (this.presets.length > 0) {
|
|
1248
1253
|
this.presets.forEach((preset, i) => {
|
|
1249
1254
|
const presetData = presetsOnServer.find(p => p[presetsIdKey] === preset.id);
|
|
@@ -1259,7 +1264,7 @@ class DeviceErv extends EventEmitter {
|
|
|
1259
1264
|
});
|
|
1260
1265
|
};
|
|
1261
1266
|
|
|
1262
|
-
//
|
|
1267
|
+
//schedules
|
|
1263
1268
|
if (this.schedules.length > 0 && scheduleEnabled !== null) {
|
|
1264
1269
|
this.schedules.forEach((schedule, i) => {
|
|
1265
1270
|
//control
|
|
@@ -1274,7 +1279,7 @@ class DeviceErv extends EventEmitter {
|
|
|
1274
1279
|
});
|
|
1275
1280
|
};
|
|
1276
1281
|
|
|
1277
|
-
//
|
|
1282
|
+
//buttons
|
|
1278
1283
|
if (this.buttons.length > 0) {
|
|
1279
1284
|
this.buttons.forEach((button, i) => {
|
|
1280
1285
|
const mode = button.mode;;
|
package/src/melcloudata.js
CHANGED
|
@@ -183,14 +183,6 @@ class MelCloudAta extends EventEmitter {
|
|
|
183
183
|
this.updateData(deviceData);
|
|
184
184
|
return true;
|
|
185
185
|
case "melcloudhome":
|
|
186
|
-
const axiosInstancePut = axios.create({
|
|
187
|
-
method: 'PUT',
|
|
188
|
-
baseURL: ApiUrlsHome.BaseURL,
|
|
189
|
-
timeout: 10000,
|
|
190
|
-
headers: deviceData.Headers,
|
|
191
|
-
withCredentials: true
|
|
192
|
-
});
|
|
193
|
-
|
|
194
186
|
if (displayType === 1 && deviceData.Device.OperationMode === 8) {
|
|
195
187
|
deviceData.Device.SetTemperature = (deviceData.Device.DefaultCoolingSetTemperature + deviceData.Device.DefaultHeatingSetTemperature) / 2;
|
|
196
188
|
|
|
@@ -203,15 +195,44 @@ class MelCloudAta extends EventEmitter {
|
|
|
203
195
|
}
|
|
204
196
|
}
|
|
205
197
|
|
|
198
|
+
let method = null
|
|
206
199
|
let settings = {};
|
|
207
200
|
let path = '';
|
|
208
201
|
switch (effectiveFlags) {
|
|
209
|
-
case '
|
|
202
|
+
case 'frostprotection':
|
|
203
|
+
settings = {
|
|
204
|
+
data: {
|
|
205
|
+
enabled: deviceData.FrostProtection.Enabled
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
method = 'POST';
|
|
209
|
+
path = ApiUrlsHome.PostProtectionFrost.replace('deviceid', deviceData.DeviceID);
|
|
210
|
+
break;
|
|
211
|
+
case 'overheatprotection':
|
|
212
|
+
settings = {
|
|
213
|
+
data: {
|
|
214
|
+
enabled: deviceData.OverheatProtection.Enabled
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
method = 'POST';
|
|
218
|
+
path = ApiUrlsHome.PostProtectionOverheat.replace('deviceid', deviceData.DeviceID);
|
|
219
|
+
break;
|
|
220
|
+
case 'holidaymode':
|
|
221
|
+
settings = {
|
|
222
|
+
data: {
|
|
223
|
+
enabled: deviceData.HolidayMode.Enabled
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
method = 'POST';
|
|
227
|
+
path = ApiUrlsHome.PostHolidayMode.replace('deviceid', deviceData.DeviceID);
|
|
228
|
+
break;
|
|
229
|
+
case 'schedule':
|
|
210
230
|
settings = {
|
|
211
231
|
data: {
|
|
212
232
|
enabled: deviceData.ScheduleEnabled
|
|
213
233
|
}
|
|
214
234
|
};
|
|
235
|
+
method = 'PUT';
|
|
215
236
|
path = ApiUrlsHome.PutScheduleEnable.replace('deviceid', deviceData.DeviceID);
|
|
216
237
|
break;
|
|
217
238
|
default:
|
|
@@ -225,10 +246,19 @@ class MelCloudAta extends EventEmitter {
|
|
|
225
246
|
VaneVerticalDirection: AirConditioner.VaneVerticalDirectionMapEnumToString[deviceData.Device.VaneVerticalDirection],
|
|
226
247
|
}
|
|
227
248
|
};
|
|
249
|
+
method = 'PUT';
|
|
228
250
|
path = ApiUrlsHome.SetAta.replace('deviceid', deviceData.DeviceID);
|
|
229
251
|
break
|
|
230
252
|
}
|
|
231
253
|
|
|
254
|
+
const axiosInstancePut = axios.create({
|
|
255
|
+
method: method,
|
|
256
|
+
baseURL: ApiUrlsHome.BaseURL,
|
|
257
|
+
timeout: 10000,
|
|
258
|
+
headers: deviceData.Headers,
|
|
259
|
+
withCredentials: true
|
|
260
|
+
});
|
|
261
|
+
|
|
232
262
|
if (this.logDebug) this.emit('debug', `Send Data: ${JSON.stringify(settings.data, null, 2)}`);
|
|
233
263
|
await axiosInstancePut(path, settings);
|
|
234
264
|
this.updateData(deviceData);
|
package/src/melcloudatw.js
CHANGED
|
@@ -187,23 +187,26 @@ class MelCloudAtw extends EventEmitter {
|
|
|
187
187
|
this.updateData(deviceData);
|
|
188
188
|
return true;
|
|
189
189
|
case "melcloudhome":
|
|
190
|
-
|
|
191
|
-
method: 'PUT',
|
|
192
|
-
baseURL: ApiUrlsHome.BaseURL,
|
|
193
|
-
timeout: 10000,
|
|
194
|
-
headers: deviceData.Headers,
|
|
195
|
-
withCredentials: true
|
|
196
|
-
});
|
|
197
|
-
|
|
190
|
+
let method = null
|
|
198
191
|
let settings = {};
|
|
199
192
|
let path = '';
|
|
200
193
|
switch (effectiveFlags) {
|
|
201
|
-
case '
|
|
194
|
+
case 'holidaymode':
|
|
195
|
+
settings = {
|
|
196
|
+
data: {
|
|
197
|
+
enabled: deviceData.HolidayMode.Enabled
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
method = 'POST';
|
|
201
|
+
path = ApiUrlsHome.PostHolidayMode.replace('deviceid', deviceData.DeviceID);
|
|
202
|
+
break;
|
|
203
|
+
case 'schedule':
|
|
202
204
|
settings = {
|
|
203
205
|
data: {
|
|
204
206
|
enabled: deviceData.ScheduleEnabled
|
|
205
207
|
}
|
|
206
208
|
};
|
|
209
|
+
method = 'PUT';
|
|
207
210
|
path = ApiUrlsHome.PutScheduleEnable.replace('deviceid', deviceData.DeviceID);
|
|
208
211
|
break;
|
|
209
212
|
default:
|
|
@@ -224,10 +227,19 @@ class MelCloudAtw extends EventEmitter {
|
|
|
224
227
|
EcoHotWater: deviceData.Device.EcoHotWater,
|
|
225
228
|
}
|
|
226
229
|
};
|
|
230
|
+
method = 'PUT';
|
|
227
231
|
path = ApiUrlsHome.SetAtw.replace('deviceid', deviceData.DeviceID);
|
|
228
232
|
break
|
|
229
233
|
}
|
|
230
234
|
|
|
235
|
+
const axiosInstancePut = axios.create({
|
|
236
|
+
method: method,
|
|
237
|
+
baseURL: ApiUrlsHome.BaseURL,
|
|
238
|
+
timeout: 10000,
|
|
239
|
+
headers: deviceData.Headers,
|
|
240
|
+
withCredentials: true
|
|
241
|
+
});
|
|
242
|
+
|
|
231
243
|
if (this.logDebug) this.emit('debug', `Send Data: ${JSON.stringify(settings.data, null, 2)}`);
|
|
232
244
|
await axiosInstancePut(path, settings);
|
|
233
245
|
this.updateData(deviceData);
|
package/src/melclouderv.js
CHANGED
|
@@ -191,14 +191,6 @@ class MelCloudErv extends EventEmitter {
|
|
|
191
191
|
this.updateData(deviceData);
|
|
192
192
|
return true;
|
|
193
193
|
case "melcloudhome":
|
|
194
|
-
const axiosInstancePut = axios.create({
|
|
195
|
-
method: 'PUT',
|
|
196
|
-
baseURL: ApiUrlsHome.BaseURL,
|
|
197
|
-
timeout: 10000,
|
|
198
|
-
headers: deviceData.Headers,
|
|
199
|
-
withCredentials: true
|
|
200
|
-
});
|
|
201
|
-
|
|
202
194
|
if (displayType === 1 && deviceData.Device.VentilationMode === 2) {
|
|
203
195
|
deviceData.Device.SetTemperature = (deviceData.Device.DefaultCoolingSetTemperature + deviceData.Device.DefaultHeatingSetTemperature) / 2;
|
|
204
196
|
|
|
@@ -211,15 +203,26 @@ class MelCloudErv extends EventEmitter {
|
|
|
211
203
|
}
|
|
212
204
|
}
|
|
213
205
|
|
|
206
|
+
let method = null;
|
|
214
207
|
let settings = {};
|
|
215
208
|
let path = '';
|
|
216
209
|
switch (effectiveFlags) {
|
|
217
|
-
case '
|
|
210
|
+
case 'holidaymode':
|
|
211
|
+
settings = {
|
|
212
|
+
data: {
|
|
213
|
+
enabled: deviceData.HolidayMode.Enabled
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
method = 'POST';
|
|
217
|
+
path = ApiUrlsHome.PostHolidayMode.replace('deviceid', deviceData.DeviceID);
|
|
218
|
+
break;
|
|
219
|
+
case 'schedule':
|
|
218
220
|
settings = {
|
|
219
221
|
data: {
|
|
220
222
|
enabled: deviceData.ScheduleEnabled
|
|
221
223
|
}
|
|
222
224
|
};
|
|
225
|
+
method = 'PUT';
|
|
223
226
|
path = ApiUrlsHome.PutScheduleEnable.replace('deviceid', deviceData.DeviceID);
|
|
224
227
|
break;
|
|
225
228
|
default:
|
|
@@ -232,10 +235,19 @@ class MelCloudErv extends EventEmitter {
|
|
|
232
235
|
VentilationMode: Ventilation.VentilationModeMapEnumToString[deviceData.Device.VentilationMode],
|
|
233
236
|
}
|
|
234
237
|
};
|
|
238
|
+
method = 'PUT';
|
|
235
239
|
path = ApiUrlsHome.SetErv.replace('deviceid', deviceData.DeviceID);
|
|
236
240
|
break
|
|
237
241
|
}
|
|
238
242
|
|
|
243
|
+
const axiosInstancePut = axios.create({
|
|
244
|
+
method: method,
|
|
245
|
+
baseURL: ApiUrlsHome.BaseURL,
|
|
246
|
+
timeout: 10000,
|
|
247
|
+
headers: deviceData.Headers,
|
|
248
|
+
withCredentials: true
|
|
249
|
+
});
|
|
250
|
+
|
|
239
251
|
if (this.logDebug) this.emit('debug', `Send Data: ${JSON.stringify(settings.data, null, 2)}`);
|
|
240
252
|
await axiosInstancePut(path, settings);
|
|
241
253
|
this.updateData(deviceData);
|