homebridge-melcloud-control 4.1.3-beta.0 → 4.1.3-beta.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/config.schema.json +41 -1
- package/package.json +1 -1
- package/src/constants.js +5 -4
- package/src/deviceata.js +5 -5
- package/src/deviceatw.js +55 -17
- package/src/deviceerv.js +38 -2
- package/src/melcloudata.js +26 -12
- package/src/melcloudatw.js +34 -20
- package/src/melclouderv.js +25 -11
package/config.schema.json
CHANGED
|
@@ -423,7 +423,7 @@
|
|
|
423
423
|
}
|
|
424
424
|
},
|
|
425
425
|
"scheduleSensor": {
|
|
426
|
-
"title": "Schedule",
|
|
426
|
+
"title": "Schedule Enabled",
|
|
427
427
|
"type": "boolean",
|
|
428
428
|
"default": false,
|
|
429
429
|
"description": "This enable extra schedule sensor to use with automations in HomeKit app.",
|
|
@@ -1128,6 +1128,24 @@
|
|
|
1128
1128
|
"default": false,
|
|
1129
1129
|
"description": "This enable extra Return Zone 2 temperature sensor to use with automations in HomeKit app."
|
|
1130
1130
|
},
|
|
1131
|
+
"holidayModeSensor": {
|
|
1132
|
+
"title": "Holiday Mode",
|
|
1133
|
+
"type": "boolean",
|
|
1134
|
+
"default": false,
|
|
1135
|
+
"description": "This enable extra holiday mode sensor to use with automations in HomeKit app.",
|
|
1136
|
+
"condition": {
|
|
1137
|
+
"functionBody": "return model.accounts[arrayIndices[0]].type === 'melcloudhome';"
|
|
1138
|
+
}
|
|
1139
|
+
},
|
|
1140
|
+
"scheduleSensor": {
|
|
1141
|
+
"title": "Schedule Enabled",
|
|
1142
|
+
"type": "boolean",
|
|
1143
|
+
"default": false,
|
|
1144
|
+
"description": "This enable extra schedule sensor to use with automations in HomeKit app.",
|
|
1145
|
+
"condition": {
|
|
1146
|
+
"functionBody": "return model.accounts[arrayIndices[0]].type === 'melcloudhome';"
|
|
1147
|
+
}
|
|
1148
|
+
},
|
|
1131
1149
|
"errorSensor": {
|
|
1132
1150
|
"title": "Error",
|
|
1133
1151
|
"type": "boolean",
|
|
@@ -1603,6 +1621,24 @@
|
|
|
1603
1621
|
"default": false,
|
|
1604
1622
|
"description": "This enable extra supply temperature sensor to use with automations in HomeKit app."
|
|
1605
1623
|
},
|
|
1624
|
+
"holidayModeSensor": {
|
|
1625
|
+
"title": "Holiday Mode",
|
|
1626
|
+
"type": "boolean",
|
|
1627
|
+
"default": false,
|
|
1628
|
+
"description": "This enable extra holiday mode sensor to use with automations in HomeKit app.",
|
|
1629
|
+
"condition": {
|
|
1630
|
+
"functionBody": "return model.accounts[arrayIndices[0]].type === 'melcloudhome';"
|
|
1631
|
+
}
|
|
1632
|
+
},
|
|
1633
|
+
"scheduleSensor": {
|
|
1634
|
+
"title": "Schedule Enabled",
|
|
1635
|
+
"type": "boolean",
|
|
1636
|
+
"default": false,
|
|
1637
|
+
"description": "This enable extra schedule sensor to use with automations in HomeKit app.",
|
|
1638
|
+
"condition": {
|
|
1639
|
+
"functionBody": "return model.accounts[arrayIndices[0]].type === 'melcloudhome';"
|
|
1640
|
+
}
|
|
1641
|
+
},
|
|
1606
1642
|
"errorSensor": {
|
|
1607
1643
|
"title": "Error",
|
|
1608
1644
|
"type": "boolean",
|
|
@@ -2396,6 +2432,8 @@
|
|
|
2396
2432
|
{
|
|
2397
2433
|
"title": "System",
|
|
2398
2434
|
"items": [
|
|
2435
|
+
"accounts[].atwDevices[].holidayModeSensor",
|
|
2436
|
+
"accounts[].atwDevices[].scheduleSensor",
|
|
2399
2437
|
"accounts[].atwDevices[].errorSensor"
|
|
2400
2438
|
]
|
|
2401
2439
|
},
|
|
@@ -2539,6 +2577,8 @@
|
|
|
2539
2577
|
{
|
|
2540
2578
|
"title": "System",
|
|
2541
2579
|
"items": [
|
|
2580
|
+
"accounts[].ervDevices[].holidayModeSensor",
|
|
2581
|
+
"accounts[].ervDevices[].scheduleSensor",
|
|
2542
2582
|
"accounts[].ervDevices[].errorSensor"
|
|
2543
2583
|
]
|
|
2544
2584
|
},
|
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.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/constants.js
CHANGED
|
@@ -21,12 +21,13 @@ export const ApiUrlsHome = {
|
|
|
21
21
|
BaseURL: "https://melcloudhome.com",
|
|
22
22
|
GetUserContext: "/api/user/context",
|
|
23
23
|
SetAta: "/api/ataunit/deviceid",
|
|
24
|
-
GetAtaSchedule: "/ata/deviceid/schedule",
|
|
25
24
|
SetAtw: "/api/atwunit/deviceid",
|
|
26
|
-
GetAtwSchedule: "/atw/deviceid/schedule",
|
|
27
25
|
SetErv: "/api/ervunit/deviceid",
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
PutScheduleEnable: "/api/cloudschedule/deviceid/enabled", // PUT {"enabled":true}
|
|
27
|
+
PostSchedule: " /api/cloudschedule/deviceid", // POST {"days":[2],"time":"17:59:00","enabled":true,"id":"53c5e804-0663-47d0-85c2-2d8ccd2573de","power":false,"operationMode":null,"setPoint":null,"vaneVerticalDirection":null,"vaneHorizontalDirection":null,"setFanSpeed":null}
|
|
28
|
+
PostProtectionFrost: "/api/protection/frost", // POST {"enabled":true,"min":13,"max":16,"units":{"ATA":["ef333525-2699-4290-af5a-2922566676da"]}}
|
|
29
|
+
PostProtectionOverheat: "api/protection/overheat", // POST {"enabled":true,"min":32,"max":35,"units":{"ATA":["ef333525-2699-4290-af5a-2922566676da"]}}
|
|
30
|
+
PostHolidayMode: " /api/holidaymode" // POST {"enabled":true,"startDate":"2025-11-11T17:42:24.913","endDate":"2026-06-01T09:18:00","units":{"ATA":["ef333525-2699-4290-af5a-2922566676da"]}}
|
|
30
31
|
};
|
|
31
32
|
|
|
32
33
|
export const DeviceType = [
|
package/src/deviceata.js
CHANGED
|
@@ -634,7 +634,7 @@ class DeviceAta extends EventEmitter {
|
|
|
634
634
|
}
|
|
635
635
|
|
|
636
636
|
//overheat sensor
|
|
637
|
-
if (this.overheatProtectionSensor && this.accessory.overheatProtectionEnabled) {
|
|
637
|
+
if (this.overheatProtectionSensor && this.accessory.overheatProtectionEnabled !== null) {
|
|
638
638
|
if (this.logDebug) this.emit('debug', `Prepare overheat protection service`);
|
|
639
639
|
this.overheatProtectionSensorService = new Service.ContactSensor(`${serviceName} Overheat Protection`, `Overheat Protection Sensor ${deviceId}`);
|
|
640
640
|
this.overheatProtectionSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
@@ -648,7 +648,7 @@ class DeviceAta extends EventEmitter {
|
|
|
648
648
|
}
|
|
649
649
|
|
|
650
650
|
//holiday mode sensor
|
|
651
|
-
if (this.holidayModeSensor && this.accessory.holidayModeEnabled) {
|
|
651
|
+
if (this.holidayModeSensor && this.accessory.holidayModeEnabled !== null) {
|
|
652
652
|
if (this.logDebug) this.emit('debug', `Prepare holiday mode service`);
|
|
653
653
|
this.holidayModeSensorService = new Service.ContactSensor(`${serviceName} Holiday Mode`, `Holiday Mode Sensor ${deviceId}`);
|
|
654
654
|
this.holidayModeSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
@@ -771,7 +771,7 @@ class DeviceAta extends EventEmitter {
|
|
|
771
771
|
.onSet(async (state) => {
|
|
772
772
|
try {
|
|
773
773
|
deviceData.ScheduleEnabled = state;
|
|
774
|
-
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, '
|
|
774
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'scheduleenabled');
|
|
775
775
|
if (this.logInfo) this.emit('info', `${state ? 'Set:' : 'Unset:'} ${name}`);
|
|
776
776
|
} catch (error) {
|
|
777
777
|
if (this.logWarn) this.emit('warn', `Set schedule error: ${error}`);
|
|
@@ -1077,6 +1077,8 @@ class DeviceAta extends EventEmitter {
|
|
|
1077
1077
|
const scheduleEnabled = deviceData.ScheduleEnabled;
|
|
1078
1078
|
const schedulesOnServer = deviceData.Schedule ?? [];
|
|
1079
1079
|
const presetsOnServer = deviceData.Presets ?? [];
|
|
1080
|
+
const holidayModeEnabled = deviceData.HolidayMode?.Enabled;
|
|
1081
|
+
const holidayModeActive = deviceData.HolidayMode?.Active;
|
|
1080
1082
|
|
|
1081
1083
|
|
|
1082
1084
|
//protection
|
|
@@ -1084,8 +1086,6 @@ class DeviceAta extends EventEmitter {
|
|
|
1084
1086
|
const frostProtectionActive = deviceData.FrostProtection?.Active;
|
|
1085
1087
|
const overheatProtectionEnabled = deviceData.OverheatProtection?.Enabled;
|
|
1086
1088
|
const overheatProtectionActive = deviceData.OverheatProtection?.Active;
|
|
1087
|
-
const holidayModeEnabled = deviceData.HolidayMode?.Enabled;
|
|
1088
|
-
const holidayModeActive = deviceData.HolidayMode?.Active;
|
|
1089
1089
|
|
|
1090
1090
|
//device control
|
|
1091
1091
|
const hideVaneControls = deviceData.HideVaneControls ?? false;
|
package/src/deviceatw.js
CHANGED
|
@@ -37,6 +37,8 @@ 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.holidayModeSensor = device.holidayModeSensor || false;
|
|
41
|
+
this.scheduleSensor = device.scheduleSensor || false;
|
|
40
42
|
this.errorSensor = device.errorSensor || false;
|
|
41
43
|
this.presets = this.accountType === 'melcloud' ? (device.presets || []).filter(preset => (preset.displayType ?? 0) > 0 && preset.id !== '0') : [];
|
|
42
44
|
this.schedules = this.accountType === 'melcloudhome' ? (device.schedules || []).filter(schedule => (schedule.displayType ?? 0) > 0 && schedule.id !== '0') : [];
|
|
@@ -877,20 +879,6 @@ class DeviceAtw extends EventEmitter {
|
|
|
877
879
|
})
|
|
878
880
|
accessory.addService(this.returnTemperatureSensorService);
|
|
879
881
|
};
|
|
880
|
-
|
|
881
|
-
//error sensor
|
|
882
|
-
if (this.errorSensor && this.accessory.isInError !== null) {
|
|
883
|
-
if (this.logDebug) this.emit('debug', `Prepare error service`);
|
|
884
|
-
this.errorService = new Service.ContactSensor(`${serviceName} Error`, `Error Sensor ${deviceId}`);
|
|
885
|
-
this.errorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
886
|
-
this.errorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Error`);
|
|
887
|
-
this.errorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
888
|
-
.onGet(async () => {
|
|
889
|
-
const state = this.accessory.isInError;
|
|
890
|
-
return state;
|
|
891
|
-
})
|
|
892
|
-
accessory.addService(this.errorService);
|
|
893
|
-
}
|
|
894
882
|
break;
|
|
895
883
|
case caseZone1Sensor: //Zone 1
|
|
896
884
|
if (zone.roomTemperature !== null) {
|
|
@@ -1061,6 +1049,48 @@ class DeviceAtw extends EventEmitter {
|
|
|
1061
1049
|
});
|
|
1062
1050
|
};
|
|
1063
1051
|
|
|
1052
|
+
//holiday mode sensor
|
|
1053
|
+
if (this.holidayModeSensor && this.accessory.holidayModeEnabled !== null) {
|
|
1054
|
+
if (this.logDebug) this.emit('debug', `Prepare holiday mode service`);
|
|
1055
|
+
this.holidayModeSensorService = new Service.ContactSensor(`${serviceName} Holiday Mode`, `Holiday Mode Sensor ${deviceId}`);
|
|
1056
|
+
this.holidayModeSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
1057
|
+
this.holidayModeSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Holiday Mode`);
|
|
1058
|
+
this.holidayModeSensorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
1059
|
+
.onGet(async () => {
|
|
1060
|
+
const state = this.accessory.holidayModeActive;
|
|
1061
|
+
return state;
|
|
1062
|
+
})
|
|
1063
|
+
accessory.addService(this.holidayModeSensorService);
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
//schedule sensor
|
|
1067
|
+
if (this.scheduleSensor && this.accessory.scheduleEnabled !== null) {
|
|
1068
|
+
if (this.logDebug) this.emit('debug', `Prepare schedule service`);
|
|
1069
|
+
this.scheduleSensorService = new Service.ContactSensor(`${serviceName} Schedule`, `Schedule Sensor ${deviceId}`);
|
|
1070
|
+
this.scheduleSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
1071
|
+
this.scheduleSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Schedule`);
|
|
1072
|
+
this.scheduleSensorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
1073
|
+
.onGet(async () => {
|
|
1074
|
+
const state = this.accessory.scheduleEnabled;
|
|
1075
|
+
return state;
|
|
1076
|
+
})
|
|
1077
|
+
accessory.addService(this.scheduleSensorService);
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
//error sensor
|
|
1081
|
+
if (this.errorSensor && this.accessory.isInError !== null) {
|
|
1082
|
+
if (this.logDebug) this.emit('debug', `Prepare error service`);
|
|
1083
|
+
this.errorService = new Service.ContactSensor(`${serviceName} Error`, `Error Sensor ${deviceId}`);
|
|
1084
|
+
this.errorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
1085
|
+
this.errorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Error`);
|
|
1086
|
+
this.errorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
1087
|
+
.onGet(async () => {
|
|
1088
|
+
const state = this.accessory.isInError;
|
|
1089
|
+
return state;
|
|
1090
|
+
})
|
|
1091
|
+
accessory.addService(this.errorService);
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1064
1094
|
//presets services
|
|
1065
1095
|
if (this.presets.length > 0) {
|
|
1066
1096
|
if (this.logDebug) this.emit('debug', `Prepare presets services`);
|
|
@@ -1156,7 +1186,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1156
1186
|
.onSet(async (state) => {
|
|
1157
1187
|
try {
|
|
1158
1188
|
deviceData.ScheduleEnabled = state;
|
|
1159
|
-
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, '
|
|
1189
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'scheduleenabled');
|
|
1160
1190
|
if (this.logInfo) this.emit('info', `${state ? 'Set:' : 'Unset:'} ${name}`);
|
|
1161
1191
|
} catch (error) {
|
|
1162
1192
|
if (this.logWarn) this.emit('warn', `Set schedule error: ${error}`);
|
|
@@ -1377,7 +1407,6 @@ class DeviceAtw extends EventEmitter {
|
|
|
1377
1407
|
this.deviceData = deviceData;
|
|
1378
1408
|
|
|
1379
1409
|
//keys
|
|
1380
|
-
const presetsKey = this.accountType === 'melcloud' ? 'Presets' : 'Schedule';
|
|
1381
1410
|
const presetsIdKey = this.accountType === 'melcloud' ? 'ID' : 'Id';
|
|
1382
1411
|
const tempStepKey = this.accountType === 'melcloud' ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
|
|
1383
1412
|
const errorKey = this.accountType === 'melcloud' ? 'HasError' : 'IsInError';
|
|
@@ -1386,6 +1415,8 @@ class DeviceAtw extends EventEmitter {
|
|
|
1386
1415
|
const scheduleEnabled = deviceData.ScheduleEnabled;
|
|
1387
1416
|
const schedulesOnServer = deviceData.Schedule ?? [];
|
|
1388
1417
|
const presetsOnServer = deviceData.Presets ?? [];
|
|
1418
|
+
const holidayModeEnabled = deviceData.HolidayMode?.Enabled;
|
|
1419
|
+
const holidayModeActive = deviceData.HolidayMode?.Active;
|
|
1389
1420
|
|
|
1390
1421
|
//device info
|
|
1391
1422
|
const hasHeatPump = ![1, 2, 3, 4, 5, 6, 7, 15].includes(this.hideZone);
|
|
@@ -1489,6 +1520,9 @@ class DeviceAtw extends EventEmitter {
|
|
|
1489
1520
|
temperatureUnit: TemperatureDisplayUnits[this.useFahrenheit],
|
|
1490
1521
|
isInError: isInError,
|
|
1491
1522
|
scheduleEnabled: scheduleEnabled,
|
|
1523
|
+
holidayModeEnabled: holidayModeEnabled,
|
|
1524
|
+
holidayModeActive: holidayModeActive,
|
|
1525
|
+
scheduleEnabled: scheduleEnabled,
|
|
1492
1526
|
zones: [],
|
|
1493
1527
|
zonesSensors: []
|
|
1494
1528
|
};
|
|
@@ -1792,7 +1826,6 @@ class DeviceAtw extends EventEmitter {
|
|
|
1792
1826
|
this.roomTemperatureSensorService?.updateCharacteristic(Characteristic.CurrentTemperature, outdoorTemperature);
|
|
1793
1827
|
this.flowTemperatureSensorService?.updateCharacteristic(Characteristic.CurrentTemperature, flowTemperatureHeatPump);
|
|
1794
1828
|
this.returnTemperatureSensorService?.updateCharacteristic(Characteristic.CurrentTemperature, returnTemperatureHeatPump);
|
|
1795
|
-
this.errorService?.updateCharacteristic(Characteristic.ContactSensorState, isInError);
|
|
1796
1829
|
break;
|
|
1797
1830
|
case caseZone1Sensor: //Zone 1
|
|
1798
1831
|
name = zone1Name;
|
|
@@ -1866,6 +1899,11 @@ class DeviceAtw extends EventEmitter {
|
|
|
1866
1899
|
};
|
|
1867
1900
|
this.accessory = obj;
|
|
1868
1901
|
|
|
1902
|
+
//update sensors state
|
|
1903
|
+
this.holidayModeSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayModeActive);
|
|
1904
|
+
this.scheduleSensorService?.updateCharacteristic(Characteristic.ContactSensorState, scheduleEnabled);
|
|
1905
|
+
this.errorService?.updateCharacteristic(Characteristic.ContactSensorState, isInError);
|
|
1906
|
+
|
|
1869
1907
|
//update presets state
|
|
1870
1908
|
if (this.presets.length > 0) {
|
|
1871
1909
|
this.presets.forEach((preset, i) => {
|
package/src/deviceerv.js
CHANGED
|
@@ -30,6 +30,8 @@ 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.holidayModeSensor = device.holidayModeSensor || false;
|
|
34
|
+
this.scheduleSensor = device.scheduleSensor || false;
|
|
33
35
|
this.errorSensor = device.errorSensor || false;
|
|
34
36
|
this.presets = this.accountType === 'melcloud' ? (device.presets || []).filter(preset => (preset.displayType ?? 0) > 0 && preset.id !== '0') : [];
|
|
35
37
|
this.schedules = this.accountType === 'melcloudhome' ? (device.schedules || []).filter(schedule => (schedule.displayType ?? 0) > 0 && schedule.id !== '0') : [];
|
|
@@ -666,6 +668,34 @@ class DeviceErv extends EventEmitter {
|
|
|
666
668
|
accessory.addService(this.airQualitySensorService);
|
|
667
669
|
}
|
|
668
670
|
|
|
671
|
+
//holiday mode sensor
|
|
672
|
+
if (this.holidayModeSensor && this.accessory.holidayModeEnabled !== null) {
|
|
673
|
+
if (this.logDebug) this.emit('debug', `Prepare holiday mode service`);
|
|
674
|
+
this.holidayModeSensorService = new Service.ContactSensor(`${serviceName} Holiday Mode`, `Holiday Mode Sensor ${deviceId}`);
|
|
675
|
+
this.holidayModeSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
676
|
+
this.holidayModeSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Holiday Mode`);
|
|
677
|
+
this.holidayModeSensorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
678
|
+
.onGet(async () => {
|
|
679
|
+
const state = this.accessory.holidayModeActive;
|
|
680
|
+
return state;
|
|
681
|
+
})
|
|
682
|
+
accessory.addService(this.holidayModeSensorService);
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
//schedule sensor
|
|
686
|
+
if (this.scheduleSensor && this.accessory.scheduleEnabled !== null) {
|
|
687
|
+
if (this.logDebug) this.emit('debug', `Prepare schedule service`);
|
|
688
|
+
this.scheduleSensorService = new Service.ContactSensor(`${serviceName} Schedule`, `Schedule Sensor ${deviceId}`);
|
|
689
|
+
this.scheduleSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
690
|
+
this.scheduleSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Schedule`);
|
|
691
|
+
this.scheduleSensorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
692
|
+
.onGet(async () => {
|
|
693
|
+
const state = this.accessory.scheduleEnabled;
|
|
694
|
+
return state;
|
|
695
|
+
})
|
|
696
|
+
accessory.addService(this.scheduleSensorService);
|
|
697
|
+
}
|
|
698
|
+
|
|
669
699
|
//error sensor
|
|
670
700
|
if (this.errorSensor && this.accessory.isInError !== null) {
|
|
671
701
|
if (this.logDebug) this.emit('debug', `Prepare error service`);
|
|
@@ -760,7 +790,7 @@ class DeviceErv extends EventEmitter {
|
|
|
760
790
|
.onSet(async (state) => {
|
|
761
791
|
try {
|
|
762
792
|
deviceData.ScheduleEnabled = state;
|
|
763
|
-
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, '
|
|
793
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'scheduleenabled');
|
|
764
794
|
if (this.logInfo) this.emit('info', `${state ? 'Set:' : 'Unset:'} ${name}`);
|
|
765
795
|
} catch (error) {
|
|
766
796
|
if (this.logWarn) this.emit('warn', `Set schedule error: ${error}`);
|
|
@@ -922,7 +952,6 @@ class DeviceErv extends EventEmitter {
|
|
|
922
952
|
this.deviceData = deviceData;
|
|
923
953
|
|
|
924
954
|
//keys
|
|
925
|
-
const presetsKey = this.accountType === 'melcloud' ? 'Presets' : 'Schedule';
|
|
926
955
|
const presetsIdKey = this.accountType === 'melcloud' ? 'ID' : 'Id';
|
|
927
956
|
const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
|
|
928
957
|
const tempStepKey = this.accountType === 'melcloud' ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
|
|
@@ -932,6 +961,8 @@ class DeviceErv extends EventEmitter {
|
|
|
932
961
|
const scheduleEnabled = deviceData.ScheduleEnabled;
|
|
933
962
|
const schedulesOnServer = deviceData.Schedule ?? [];
|
|
934
963
|
const presetsOnServer = deviceData.Presets ?? [];
|
|
964
|
+
const holidayModeEnabled = deviceData.HolidayMode?.Enabled;
|
|
965
|
+
const holidayModeActive = deviceData.HolidayMode?.Active;
|
|
935
966
|
|
|
936
967
|
//device control
|
|
937
968
|
const hideRoomTemperature = deviceData.HideRoomTemperature;
|
|
@@ -1022,6 +1053,9 @@ class DeviceErv extends EventEmitter {
|
|
|
1022
1053
|
useFahrenheit: this.useFahrenheit,
|
|
1023
1054
|
temperatureUnit: TemperatureDisplayUnits[this.useFahrenheit],
|
|
1024
1055
|
isInError: isInError,
|
|
1056
|
+
scheduleEnabled: scheduleEnabled,
|
|
1057
|
+
holidayModeEnabled: holidayModeEnabled,
|
|
1058
|
+
holidayModeActive: holidayModeActive,
|
|
1025
1059
|
scheduleEnabled: scheduleEnabled
|
|
1026
1060
|
};
|
|
1027
1061
|
|
|
@@ -1160,6 +1194,8 @@ class DeviceErv extends EventEmitter {
|
|
|
1160
1194
|
.updateCharacteristic(Characteristic.PM2_5Density, pM25Level);
|
|
1161
1195
|
|
|
1162
1196
|
//error sensor
|
|
1197
|
+
this.holidayModeSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayModeActive);
|
|
1198
|
+
this.scheduleSensorService?.updateCharacteristic(Characteristic.ContactSensorState, scheduleEnabled);
|
|
1163
1199
|
this.errorService?.updateCharacteristic(Characteristic.ContactSensorState, isInError);
|
|
1164
1200
|
|
|
1165
1201
|
//update presets state
|
package/src/melcloudata.js
CHANGED
|
@@ -203,19 +203,33 @@ class MelCloudAta extends EventEmitter {
|
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
206
|
+
let settings = {};
|
|
207
|
+
let path = '';
|
|
208
|
+
switch (effectiveFlags) {
|
|
209
|
+
case 'scheduleenabled':
|
|
210
|
+
settings = {
|
|
211
|
+
data: {
|
|
212
|
+
enabled: deviceData.ScheduleEnabled
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
path = ApiUrlsHome.PutScheduleEnable.replace('deviceid', deviceData.DeviceID);
|
|
216
|
+
break;
|
|
217
|
+
default:
|
|
218
|
+
settings = {
|
|
219
|
+
data: {
|
|
220
|
+
Power: deviceData.Device.Power,
|
|
221
|
+
SetTemperature: deviceData.Device.SetTemperature,
|
|
222
|
+
SetFanSpeed: String(deviceData.Device.SetFanSpeed),
|
|
223
|
+
OperationMode: AirConditioner.OperationModeMapEnumToString[deviceData.Device.OperationMode],
|
|
224
|
+
VaneHorizontalDirection: AirConditioner.VaneHorizontalDirectionMapEnumToString[deviceData.Device.VaneHorizontalDirection],
|
|
225
|
+
VaneVerticalDirection: AirConditioner.VaneVerticalDirectionMapEnumToString[deviceData.Device.VaneVerticalDirection],
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
path = ApiUrlsHome.SetAta.replace('deviceid', deviceData.DeviceID);
|
|
229
|
+
break
|
|
230
|
+
}
|
|
217
231
|
|
|
218
|
-
|
|
232
|
+
if (this.logDebug) this.emit('debug', `Send Data: ${JSON.stringify(settings.data, null, 2)}`);
|
|
219
233
|
await axiosInstancePut(path, settings);
|
|
220
234
|
this.updateData(deviceData);
|
|
221
235
|
return true;
|
package/src/melcloudatw.js
CHANGED
|
@@ -195,26 +195,40 @@ class MelCloudAtw extends EventEmitter {
|
|
|
195
195
|
withCredentials: true
|
|
196
196
|
});
|
|
197
197
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
198
|
+
let settings = {};
|
|
199
|
+
let path = '';
|
|
200
|
+
switch (effectiveFlags) {
|
|
201
|
+
case 'scheduleenabled':
|
|
202
|
+
settings = {
|
|
203
|
+
data: {
|
|
204
|
+
enabled: deviceData.ScheduleEnabled
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
path = ApiUrlsHome.PutScheduleEnable.replace('deviceid', deviceData.DeviceID);
|
|
208
|
+
break;
|
|
209
|
+
default:
|
|
210
|
+
settings = {
|
|
211
|
+
data: {
|
|
212
|
+
Power: deviceData.Device.Power,
|
|
213
|
+
SetTemperatureZone1: deviceData.Device.SetTemperatureZone1,
|
|
214
|
+
SetTemperatureZone2: deviceData.Device.SetTemperatureZone2,
|
|
215
|
+
OperationMode: HeatPump.OperationModeMapEnumToString[deviceData.Device.OperationMode],
|
|
216
|
+
OperationModeZone1: HeatPump.OperationModeMapEnumToString[deviceData.Device.OperationModeZone1],
|
|
217
|
+
OperationModeZone2: HeatPump.OperationModeMapEnumToString[deviceData.Device.OperationModeZone2],
|
|
218
|
+
SetHeatFlowTemperatureZone1: deviceData.Device.SetHeatFlowTemperatureZone1,
|
|
219
|
+
SetHeatFlowTemperatureZone2: deviceData.Device.SetHeatFlowTemperatureZone2,
|
|
220
|
+
SetCoolFlowTemperatureZone1: deviceData.Device.SetCoolFlowTemperatureZone1,
|
|
221
|
+
SetCoolFlowTemperatureZone2: deviceData.Device.SetCoolFlowTemperatureZone2,
|
|
222
|
+
SetTankWaterTemperature: deviceData.Device.SetTankWaterTemperature,
|
|
223
|
+
ForcedHotWaterMode: deviceData.Device.ForcedHotWaterMode,
|
|
224
|
+
EcoHotWater: deviceData.Device.EcoHotWater,
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
path = ApiUrlsHome.SetAtw.replace('deviceid', deviceData.DeviceID);
|
|
228
|
+
break
|
|
229
|
+
}
|
|
216
230
|
|
|
217
|
-
|
|
231
|
+
if (this.logDebug) this.emit('debug', `Send Data: ${JSON.stringify(settings.data, null, 2)}`);
|
|
218
232
|
await axiosInstancePut(path, settings);
|
|
219
233
|
this.updateData(deviceData);
|
|
220
234
|
return true;
|
|
@@ -226,7 +240,7 @@ class MelCloudAtw extends EventEmitter {
|
|
|
226
240
|
if (error?.response?.status === 500) {
|
|
227
241
|
return true;
|
|
228
242
|
}
|
|
229
|
-
|
|
243
|
+
|
|
230
244
|
throw new Error(`Send data error: ${error.message}`);
|
|
231
245
|
}
|
|
232
246
|
}
|
package/src/melclouderv.js
CHANGED
|
@@ -211,18 +211,32 @@ class MelCloudErv extends EventEmitter {
|
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
214
|
+
let settings = {};
|
|
215
|
+
let path = '';
|
|
216
|
+
switch (effectiveFlags) {
|
|
217
|
+
case 'scheduleenabled':
|
|
218
|
+
settings = {
|
|
219
|
+
data: {
|
|
220
|
+
enabled: deviceData.ScheduleEnabled
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
path = ApiUrlsHome.PutScheduleEnable.replace('deviceid', deviceData.DeviceID);
|
|
224
|
+
break;
|
|
225
|
+
default:
|
|
226
|
+
settings = {
|
|
227
|
+
data: {
|
|
228
|
+
Power: deviceData.Device.Power,
|
|
229
|
+
SetTemperature: deviceData.Device.SetTemperature,
|
|
230
|
+
SetFanSpeed: String(deviceData.Device.SetFanSpeed),
|
|
231
|
+
OperationMode: Ventilation.OperationModeMapEnumToString[deviceData.Device.OperationMode],
|
|
232
|
+
VentilationMode: Ventilation.VentilationModeMapEnumToString[deviceData.Device.VentilationMode],
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
path = ApiUrlsHome.SetErv.replace('deviceid', deviceData.DeviceID);
|
|
236
|
+
break
|
|
237
|
+
}
|
|
224
238
|
|
|
225
|
-
|
|
239
|
+
if (this.logDebug) this.emit('debug', `Send Data: ${JSON.stringify(settings.data, null, 2)}`);
|
|
226
240
|
await axiosInstancePut(path, settings);
|
|
227
241
|
this.updateData(deviceData);
|
|
228
242
|
return true;
|