homebridge-melcloud-control 4.4.1-beta.1 → 4.4.1-beta.3
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 +10 -10
- package/index.js +31 -31
- package/package.json +1 -1
- package/src/deviceerv.js +23 -24
- package/src/melcloudata.js +6 -2
- package/src/melcloudatw.js +6 -2
- package/src/melclouderv.js +13 -1
package/config.schema.json
CHANGED
|
@@ -419,7 +419,7 @@
|
|
|
419
419
|
"title": "Frost Protection Support",
|
|
420
420
|
"type": "boolean",
|
|
421
421
|
"default": false,
|
|
422
|
-
"description": "This enable
|
|
422
|
+
"description": "This enable frost protection control and sensors to use with automations in HomeKit app.",
|
|
423
423
|
"condition": {
|
|
424
424
|
"functionBody": "return model.accounts[arrayIndices[0]].type === 'melcloudhome';"
|
|
425
425
|
}
|
|
@@ -428,7 +428,7 @@
|
|
|
428
428
|
"title": "Overheat Protection Support",
|
|
429
429
|
"type": "boolean",
|
|
430
430
|
"default": false,
|
|
431
|
-
"description": "This enable
|
|
431
|
+
"description": "This enable overheat protection control and sensors to use with automations in HomeKit app.",
|
|
432
432
|
"condition": {
|
|
433
433
|
"functionBody": "return model.accounts[arrayIndices[0]].type === 'melcloudhome';"
|
|
434
434
|
}
|
|
@@ -437,7 +437,7 @@
|
|
|
437
437
|
"title": "Holiday Mode Support",
|
|
438
438
|
"type": "boolean",
|
|
439
439
|
"default": false,
|
|
440
|
-
"description": "This enable
|
|
440
|
+
"description": "This enable holiday mode control and sensors to use with automations in HomeKit app.",
|
|
441
441
|
"condition": {
|
|
442
442
|
"functionBody": "return model.accounts[arrayIndices[0]].type === 'melcloudhome';"
|
|
443
443
|
}
|
|
@@ -1272,20 +1272,20 @@
|
|
|
1272
1272
|
"default": false,
|
|
1273
1273
|
"description": "This enable error sensor to use with automations in HomeKit app."
|
|
1274
1274
|
},
|
|
1275
|
-
"
|
|
1276
|
-
"title": "
|
|
1275
|
+
"frostProtectionSupport": {
|
|
1276
|
+
"title": "Frost Protection Support",
|
|
1277
1277
|
"type": "boolean",
|
|
1278
1278
|
"default": false,
|
|
1279
|
-
"description": "This enable
|
|
1279
|
+
"description": "This enable frost protection control and sensors to use with automations in HomeKit app.",
|
|
1280
1280
|
"condition": {
|
|
1281
1281
|
"functionBody": "return model.accounts[arrayIndices[0]].type === 'melcloudhome';"
|
|
1282
1282
|
}
|
|
1283
1283
|
},
|
|
1284
|
-
"
|
|
1285
|
-
"title": "
|
|
1284
|
+
"holidayModeSupport": {
|
|
1285
|
+
"title": "Holiday Mode Support",
|
|
1286
1286
|
"type": "boolean",
|
|
1287
1287
|
"default": false,
|
|
1288
|
-
"description": "This enable
|
|
1288
|
+
"description": "This enable holiday mode control and sensors to use with automations in HomeKit app.",
|
|
1289
1289
|
"condition": {
|
|
1290
1290
|
"functionBody": "return model.accounts[arrayIndices[0]].type === 'melcloudhome';"
|
|
1291
1291
|
}
|
|
@@ -1902,7 +1902,7 @@
|
|
|
1902
1902
|
"title": "Holiday Mode Support",
|
|
1903
1903
|
"type": "boolean",
|
|
1904
1904
|
"default": false,
|
|
1905
|
-
"description": "This enable
|
|
1905
|
+
"description": "This enable holiday mode control and sensors to use with automations in HomeKit app.",
|
|
1906
1906
|
"condition": {
|
|
1907
1907
|
"functionBody": "return model.accounts[arrayIndices[0]].type === 'melcloudhome';"
|
|
1908
1908
|
}
|
package/index.js
CHANGED
|
@@ -31,12 +31,12 @@ class MelCloudPlatform {
|
|
|
31
31
|
api.on('didFinishLaunching', async () => {
|
|
32
32
|
//loop through accounts
|
|
33
33
|
for (const account of config.accounts) {
|
|
34
|
-
const {
|
|
35
|
-
if (!
|
|
36
|
-
log.warn(`Account ${!
|
|
34
|
+
const { name, user, passwd, language, displayType } = account;
|
|
35
|
+
if (!name || accountsName.includes(name) || !user || !passwd || !language || !displayType) {
|
|
36
|
+
log.warn(`Account ${!name ? 'name missing' : (accountsName.includes(name) ? 'name duplicated' : name)} ${user ? ', user missing' : ''}${passwd ? '' : ', password missing'},${language ? '' : ', language missing'}${!displayType ? ', type disabled' : ''} in config, will not be published in the Home app`);
|
|
37
37
|
continue;
|
|
38
38
|
}
|
|
39
|
-
accountsName.push(
|
|
39
|
+
accountsName.push(name);
|
|
40
40
|
const accountRefreshInterval = (account.refreshInterval ?? 120) * 1000
|
|
41
41
|
|
|
42
42
|
//log config
|
|
@@ -50,7 +50,7 @@ class MelCloudPlatform {
|
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
if (logLevel.debug) {
|
|
53
|
-
log.info(`${
|
|
53
|
+
log.info(`${name}, debug: did finish launching.`);
|
|
54
54
|
const safeConfig = {
|
|
55
55
|
...account,
|
|
56
56
|
passwd: 'removed',
|
|
@@ -61,12 +61,12 @@ class MelCloudPlatform {
|
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
};
|
|
64
|
-
log.info(`${
|
|
64
|
+
log.info(`${name}, Config: ${JSON.stringify(safeConfig, null, 2)}`);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
//define directory and file paths
|
|
68
|
-
const accountFile = `${prefDir}/${
|
|
69
|
-
const buildingsFile = `${prefDir}/${
|
|
68
|
+
const accountFile = `${prefDir}/${name}_Account`;
|
|
69
|
+
const buildingsFile = `${prefDir}/${name}_Buildings`;
|
|
70
70
|
|
|
71
71
|
try {
|
|
72
72
|
//create impulse generator
|
|
@@ -89,24 +89,24 @@ class MelCloudPlatform {
|
|
|
89
89
|
if (logLevel.warn) log.warn(`Unknown account type: ${account.type}.`);
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
|
-
melcloud.on('success', (msg) => log.success(`${
|
|
93
|
-
.on('info', (msg) => log.info(`${
|
|
94
|
-
.on('debug', (msg) => log.info(`${
|
|
95
|
-
.on('warn', (msg) => log.warn(`${
|
|
96
|
-
.on('error', (msg) => log.error(`${
|
|
92
|
+
melcloud.on('success', (msg) => log.success(`${name}, ${msg}`))
|
|
93
|
+
.on('info', (msg) => log.info(`${name}, ${msg}`))
|
|
94
|
+
.on('debug', (msg) => log.info(`${name}, debug: ${msg}`))
|
|
95
|
+
.on('warn', (msg) => log.warn(`${name}, ${msg}`))
|
|
96
|
+
.on('error', (msg) => log.error(`${name}, ${msg}`));
|
|
97
97
|
|
|
98
98
|
//connect
|
|
99
99
|
const accountInfo = await melcloud.connect();
|
|
100
100
|
if (!accountInfo?.State) {
|
|
101
|
-
if (logLevel.warn) log.warn(`${
|
|
101
|
+
if (logLevel.warn) log.warn(`${name}, ${accountInfo?.Info}`);
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
-
if (logLevel.success) log.success(`${
|
|
104
|
+
if (logLevel.success) log.success(`${name}, ${accountInfo.Info}`);
|
|
105
105
|
|
|
106
106
|
//check devices list
|
|
107
107
|
const melcloudDevicesList = await melcloud.checkDevicesList();
|
|
108
108
|
if (!melcloudDevicesList.State) {
|
|
109
|
-
if (logLevel.warn) log.warn(`${
|
|
109
|
+
if (logLevel.warn) log.warn(`${name}, ${melcloudDevicesList.Info}`);
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
112
|
if (logLevel.debug) log.info(melcloudDevicesList.Info);
|
|
@@ -120,26 +120,26 @@ class MelCloudPlatform {
|
|
|
120
120
|
const atwDevices = (account.atwDevices || []).filter(device => device.id != null && String(device.id) !== '0');
|
|
121
121
|
const ervDevices = (account.ervDevices || []).filter(device => device.id != null && String(device.id) !== '0');
|
|
122
122
|
const devices = [...ataDevices, ...atwDevices, ...ervDevices];
|
|
123
|
-
if (logLevel.debug) log.info(`${
|
|
123
|
+
if (logLevel.debug) log.info(`${name}, found configured devices ATA: ${ataDevices.length}, ATW: ${atwDevices.length}, ERV: ${ervDevices.length}.`);
|
|
124
124
|
|
|
125
125
|
for (const [index, device] of devices.entries()) {
|
|
126
126
|
device.id = String(device.id);
|
|
127
127
|
const deviceName = device.name;
|
|
128
128
|
const deviceType = device.type;
|
|
129
129
|
const deviceTypeString = device.typeString;
|
|
130
|
-
const defaultTempsFile = `${prefDir}/${
|
|
130
|
+
const defaultTempsFile = `${prefDir}/${name}_${device.id}_Temps`;
|
|
131
131
|
|
|
132
132
|
//chack device is not disabled in config
|
|
133
133
|
const displayType = device.displayType;
|
|
134
134
|
if (!displayType) {
|
|
135
|
-
if (logLevel.warn) log.warn(`${
|
|
135
|
+
if (logLevel.warn) log.warn(`${name}, ${deviceTypeString}, ${deviceName}, disabled in configuration, will not be published in the Home app.`);
|
|
136
136
|
continue;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
//chack device from config exist on melcloud
|
|
140
140
|
const deviceExistInMelCloud = melcloudDevicesList.Devices.some(dev => dev.DeviceID === device.id);
|
|
141
141
|
if (!deviceExistInMelCloud) {
|
|
142
|
-
if (logLevel.warn) log.warn(`${
|
|
142
|
+
if (logLevel.warn) log.warn(`${name}, ${deviceTypeString}, ${deviceName}, not exist on server, please login to MELCLoud from plugin UI to fix this issue.`);
|
|
143
143
|
continue;
|
|
144
144
|
}
|
|
145
145
|
|
|
@@ -160,7 +160,7 @@ class MelCloudPlatform {
|
|
|
160
160
|
if (logLevel.debug) log.debug(`Default temperature file created: ${defaultTempsFile}`);
|
|
161
161
|
}
|
|
162
162
|
} catch (error) {
|
|
163
|
-
if (logLevel.error) log.error(`${
|
|
163
|
+
if (logLevel.error) log.error(`${name}, ${deviceTypeString}, ${deviceName}, File init error: ${error.message}`);
|
|
164
164
|
continue;
|
|
165
165
|
}
|
|
166
166
|
}
|
|
@@ -179,37 +179,37 @@ class MelCloudPlatform {
|
|
|
179
179
|
configuredDevice = new DeviceErv(api, account, device, defaultTempsFile, accountInfo, accountFile, melcloud, melcloudDevicesList);
|
|
180
180
|
break;
|
|
181
181
|
default:
|
|
182
|
-
if (logLevel.warn) log.warn(`${
|
|
182
|
+
if (logLevel.warn) log.warn(`${name}, ${deviceTypeString}, ${deviceName}, unknown device: ${deviceType}.`);
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
configuredDevice.on('devInfo', (info) => logLevel.devInfo && log.info(info))
|
|
187
|
-
.on('success', (msg) => log.success(`${
|
|
188
|
-
.on('info', (msg) => log.info(`${
|
|
189
|
-
.on('debug', (msg) => log.info(`${
|
|
190
|
-
.on('warn', (msg) => log.warn(`${
|
|
191
|
-
.on('error', (msg) => log.error(`${
|
|
187
|
+
.on('success', (msg) => log.success(`${name}, ${deviceTypeString}, ${deviceName}, ${msg}`))
|
|
188
|
+
.on('info', (msg) => log.info(`${name}, ${deviceTypeString}, ${deviceName}, ${msg}`))
|
|
189
|
+
.on('debug', (msg) => log.info(`${name}, ${deviceTypeString}, ${deviceName}, debug: ${msg}`))
|
|
190
|
+
.on('warn', (msg) => log.warn(`${name}, ${deviceTypeString}, ${deviceName}, ${msg}`))
|
|
191
|
+
.on('error', (msg) => log.error(`${name}, ${deviceTypeString}, ${deviceName}, ${msg}`));
|
|
192
192
|
|
|
193
193
|
const accessory = await configuredDevice.start();
|
|
194
194
|
if (accessory) {
|
|
195
195
|
api.publishExternalAccessories(PluginName, [accessory]);
|
|
196
|
-
if (logLevel.success) log.success(`${
|
|
196
|
+
if (logLevel.success) log.success(`${name}, ${deviceTypeString}, ${deviceName}, Published as external accessory.`);
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
//stop start impulse generator
|
|
201
201
|
await impulseGenerator.state(false);
|
|
202
202
|
} catch (error) {
|
|
203
|
-
if (logLevel.error) log.error(`${
|
|
203
|
+
if (logLevel.error) log.error(`${name}, Start impulse generator error, ${error.message ?? error}, trying again.`);
|
|
204
204
|
}
|
|
205
205
|
}).on('state', (state) => {
|
|
206
|
-
if (logLevel.debug) log.info(`${
|
|
206
|
+
if (logLevel.debug) log.info(`${name}, Start impulse generator ${state ? 'started' : 'stopped'}.`);
|
|
207
207
|
});
|
|
208
208
|
|
|
209
209
|
//start impulse generator
|
|
210
210
|
await impulseGenerator.state(true, [{ name: 'start', sampling: 120000 }]);
|
|
211
211
|
} catch (error) {
|
|
212
|
-
if (logLevel.error) log.error(`${
|
|
212
|
+
if (logLevel.error) log.error(`${name}, Did finish launching error: ${error.message ?? error}.`);
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.4.1-beta.
|
|
4
|
+
"version": "4.4.1-beta.3",
|
|
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/deviceerv.js
CHANGED
|
@@ -404,8 +404,8 @@ class DeviceErv extends EventEmitter {
|
|
|
404
404
|
if (supportsAutoVentilationMode && supportsCoolOperationMode) {
|
|
405
405
|
melCloudService.getCharacteristic(Characteristic.CoolingThresholdTemperature)
|
|
406
406
|
.setProps({
|
|
407
|
-
minValue: this.accessory.
|
|
408
|
-
maxValue: this.accessory.
|
|
407
|
+
minValue: this.accessory.minTempCoolDryAuto,
|
|
408
|
+
maxValue: this.accessory.maxTempCoolDryAuto,
|
|
409
409
|
minStep: this.accessory.temperatureIncrement
|
|
410
410
|
})
|
|
411
411
|
.onGet(async () => {
|
|
@@ -713,7 +713,7 @@ class DeviceErv extends EventEmitter {
|
|
|
713
713
|
}
|
|
714
714
|
|
|
715
715
|
//holiday mode
|
|
716
|
-
if (this.holidayModeSupport && this.accessory.
|
|
716
|
+
if (this.holidayModeSupport && this.accessory.holidayMode.Enabled !== null) {
|
|
717
717
|
//control
|
|
718
718
|
if (this.logDebug) this.emit('debug', `Prepare holiday mode control service`);
|
|
719
719
|
this.holidayModeControlService = new Service.Switch(`${serviceName} Holiday Mode`, `holidayModeControlService${deviceId}`);
|
|
@@ -721,7 +721,7 @@ class DeviceErv extends EventEmitter {
|
|
|
721
721
|
this.holidayModeControlService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Holiday Mode`);
|
|
722
722
|
this.holidayModeControlService.getCharacteristic(Characteristic.On)
|
|
723
723
|
.onGet(async () => {
|
|
724
|
-
const state = this.accessory.
|
|
724
|
+
const state = this.accessory.holidayMode.Enabled;
|
|
725
725
|
return state;
|
|
726
726
|
})
|
|
727
727
|
.onSet(async (state) => {
|
|
@@ -741,7 +741,7 @@ class DeviceErv extends EventEmitter {
|
|
|
741
741
|
this.holidayModeControlSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Holiday Mode Control`);
|
|
742
742
|
this.holidayModeControlSensorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
743
743
|
.onGet(async () => {
|
|
744
|
-
const state = this.accessory.
|
|
744
|
+
const state = this.accessory.holidayMode.Enabled;
|
|
745
745
|
return state;
|
|
746
746
|
})
|
|
747
747
|
accessory.addService(this.holidayModeControlSensorService);
|
|
@@ -753,7 +753,7 @@ class DeviceErv extends EventEmitter {
|
|
|
753
753
|
this.holidayModeSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Holiday Mode State`);
|
|
754
754
|
this.holidayModeSensorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
755
755
|
.onGet(async () => {
|
|
756
|
-
const state = this.accessory.
|
|
756
|
+
const state = this.accessory.holidayMode.Active;
|
|
757
757
|
return state;
|
|
758
758
|
})
|
|
759
759
|
accessory.addService(this.holidayModeSensorService);
|
|
@@ -1150,11 +1150,12 @@ class DeviceErv extends EventEmitter {
|
|
|
1150
1150
|
|
|
1151
1151
|
//presets schedule
|
|
1152
1152
|
const presetsOnServer = deviceData.Presets ?? [];
|
|
1153
|
-
const scheduleEnabled = deviceData.ScheduleEnabled;
|
|
1154
1153
|
const schedulesOnServer = deviceData.Schedule ?? [];
|
|
1154
|
+
const scheduleEnabled = deviceData.ScheduleEnabled;
|
|
1155
1155
|
const scenesOnServer = deviceData.Scenes ?? [];
|
|
1156
|
-
|
|
1157
|
-
|
|
1156
|
+
|
|
1157
|
+
//protection
|
|
1158
|
+
const holidayMode = deviceData.HolidayMode ?? {};
|
|
1158
1159
|
|
|
1159
1160
|
//device control
|
|
1160
1161
|
const hideRoomTemperature = deviceData.HideRoomTemperature;
|
|
@@ -1187,8 +1188,8 @@ class DeviceErv extends EventEmitter {
|
|
|
1187
1188
|
const temperatureIncrement = deviceData.Device[tempStepKey] ?? 1;
|
|
1188
1189
|
const minTempHeat = 10;
|
|
1189
1190
|
const maxTempHeat = 31;
|
|
1190
|
-
const
|
|
1191
|
-
const
|
|
1191
|
+
const minTempCoolDryAuto = 16;
|
|
1192
|
+
const maxTempCoolDryAuto = 31;
|
|
1192
1193
|
|
|
1193
1194
|
//device state
|
|
1194
1195
|
const power = deviceData.Device.Power;
|
|
@@ -1210,7 +1211,9 @@ class DeviceErv extends EventEmitter {
|
|
|
1210
1211
|
const obj = {
|
|
1211
1212
|
presets: presetsOnServer,
|
|
1212
1213
|
schedules: schedulesOnServer,
|
|
1214
|
+
scheduleEnabled: scheduleEnabled,
|
|
1213
1215
|
scenes: scenesOnServer,
|
|
1216
|
+
holidayMode: holidayMode,
|
|
1214
1217
|
supportsRoomTemperature: supportsRoomTemperature,
|
|
1215
1218
|
supportsSupplyTemperature: supportsSupplyTemperature,
|
|
1216
1219
|
supportsOutdoorTemperature: supportsOutdoorTemperature,
|
|
@@ -1227,6 +1230,10 @@ class DeviceErv extends EventEmitter {
|
|
|
1227
1230
|
supportsBypassVentilationMode: supportsBypassVentilationMode,
|
|
1228
1231
|
supportsAutomaticFanSpeed: supportsAutomaticFanSpeed,
|
|
1229
1232
|
supportsStanbyMode: supportsStanbyMode,
|
|
1233
|
+
minTempHeat: minTempHeat,
|
|
1234
|
+
maxTempHeat: maxTempHeat,
|
|
1235
|
+
minTempCoolDryAuto: minTempCoolDryAuto,
|
|
1236
|
+
maxTempCoolDryAuto: maxTempCoolDryAuto,
|
|
1230
1237
|
coreMaintenanceRequired: coreMaintenanceRequired,
|
|
1231
1238
|
filterMaintenanceRequired: filterMaintenanceRequired,
|
|
1232
1239
|
actualVentilationMode: actualVentilationMode,
|
|
@@ -1246,18 +1253,10 @@ class DeviceErv extends EventEmitter {
|
|
|
1246
1253
|
defaultCoolingSetTemperature: defaultCoolingSetTemperature,
|
|
1247
1254
|
lockPhysicalControl: 0,
|
|
1248
1255
|
temperatureIncrement: temperatureIncrement,
|
|
1249
|
-
minTempHeat: minTempHeat,
|
|
1250
|
-
temperatureIncrement: maxTempHeat,
|
|
1251
|
-
minTempCoolDry: minTempCoolDry,
|
|
1252
|
-
maxTempCoolDry: maxTempCoolDry,
|
|
1253
1256
|
useFahrenheit: this.accountInfo.useFahrenheit ? 1 : 0,
|
|
1254
1257
|
temperatureUnit: TemperatureDisplayUnits[this.accountInfo.useFahrenheit ? 1 : 0],
|
|
1255
1258
|
isConnected: isConnected,
|
|
1256
|
-
isInError: isInError
|
|
1257
|
-
scheduleEnabled: scheduleEnabled,
|
|
1258
|
-
holidayModeEnabled: holidayModeEnabled,
|
|
1259
|
-
holidayModeActive: holidayModeActive,
|
|
1260
|
-
scheduleEnabled: scheduleEnabled
|
|
1259
|
+
isInError: isInError
|
|
1261
1260
|
};
|
|
1262
1261
|
|
|
1263
1262
|
//characteristics array
|
|
@@ -1414,10 +1413,10 @@ class DeviceErv extends EventEmitter {
|
|
|
1414
1413
|
this.errorService?.updateCharacteristic(Characteristic.ContactSensorState, isInError);
|
|
1415
1414
|
|
|
1416
1415
|
//holiday mode
|
|
1417
|
-
if (this.holidayModeSupport &&
|
|
1418
|
-
this.holidayModeControlService?.updateCharacteristic(Characteristic.On,
|
|
1419
|
-
this.holidayModeControlSensorService?.updateCharacteristic(Characteristic.ContactSensorState,
|
|
1420
|
-
this.holidayModeSensorService?.updateCharacteristic(Characteristic.ContactSensorState,
|
|
1416
|
+
if (this.holidayModeSupport && holidayMode.Enabled !== null) {
|
|
1417
|
+
this.holidayModeControlService?.updateCharacteristic(Characteristic.On, holidayMode.Enabled);
|
|
1418
|
+
this.holidayModeControlSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayMode.Enabled);
|
|
1419
|
+
this.holidayModeSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayMode.Active);
|
|
1421
1420
|
}
|
|
1422
1421
|
|
|
1423
1422
|
//presets
|
package/src/melcloudata.js
CHANGED
|
@@ -231,13 +231,18 @@ class MelCloudAta extends EventEmitter {
|
|
|
231
231
|
HasPendingCommand: true
|
|
232
232
|
};
|
|
233
233
|
path = ApiUrls.SetAta;
|
|
234
|
+
update = true;
|
|
234
235
|
break;
|
|
235
236
|
}
|
|
236
237
|
|
|
237
238
|
if (this.logDebug) this.emit('debug', `Send data: ${JSON.stringify(payload, null, 2)}`);
|
|
238
239
|
await this.client(path, { method: 'POST', data: payload });
|
|
239
240
|
|
|
240
|
-
|
|
241
|
+
if (update) {
|
|
242
|
+
setTimeout(() => {
|
|
243
|
+
this.emit('deviceState', deviceData);
|
|
244
|
+
}, 500);
|
|
245
|
+
}
|
|
241
246
|
return true;
|
|
242
247
|
case "melcloudhome":
|
|
243
248
|
switch (flag) {
|
|
@@ -320,7 +325,6 @@ class MelCloudAta extends EventEmitter {
|
|
|
320
325
|
this.emit('deviceState', deviceData);
|
|
321
326
|
}, 500);
|
|
322
327
|
}
|
|
323
|
-
|
|
324
328
|
return true;
|
|
325
329
|
default:
|
|
326
330
|
return;
|
package/src/melcloudatw.js
CHANGED
|
@@ -232,13 +232,18 @@ class MelCloudAtw extends EventEmitter {
|
|
|
232
232
|
HasPendingCommand: true
|
|
233
233
|
}
|
|
234
234
|
path = ApiUrls.SetAtw;
|
|
235
|
+
update = true;
|
|
235
236
|
break;
|
|
236
237
|
}
|
|
237
238
|
|
|
238
239
|
if (this.logDebug) this.emit('debug', `Send data: ${JSON.stringify(payload, null, 2)}`);
|
|
239
240
|
await this.client(path, { method: 'POST', data: payload });
|
|
240
241
|
|
|
241
|
-
|
|
242
|
+
if (update) {
|
|
243
|
+
setTimeout(() => {
|
|
244
|
+
this.emit('deviceState', deviceData);
|
|
245
|
+
}, 500);
|
|
246
|
+
}
|
|
242
247
|
return true;
|
|
243
248
|
case "melcloudhome":
|
|
244
249
|
switch (flag) {
|
|
@@ -302,7 +307,6 @@ class MelCloudAtw extends EventEmitter {
|
|
|
302
307
|
this.emit('deviceState', deviceData);
|
|
303
308
|
}, 500);
|
|
304
309
|
}
|
|
305
|
-
|
|
306
310
|
return true;
|
|
307
311
|
default:
|
|
308
312
|
return;
|
package/src/melclouderv.js
CHANGED
|
@@ -182,6 +182,7 @@ class MelCloudErv extends EventEmitter {
|
|
|
182
182
|
let method = null
|
|
183
183
|
let payload = {};
|
|
184
184
|
let path = '';
|
|
185
|
+
let update = false;
|
|
185
186
|
switch (accountType) {
|
|
186
187
|
case "melcloud":
|
|
187
188
|
switch (flag) {
|
|
@@ -231,13 +232,18 @@ class MelCloudErv extends EventEmitter {
|
|
|
231
232
|
HasPendingCommand: true
|
|
232
233
|
}
|
|
233
234
|
path = ApiUrls.SetErv;
|
|
235
|
+
update = true;
|
|
234
236
|
break;
|
|
235
237
|
}
|
|
236
238
|
|
|
237
239
|
if (this.logDebug) this.emit('debug', `Send data: ${JSON.stringify(payload, null, 2)}`);
|
|
238
240
|
await this.client(path, { method: 'POST', data: payload });
|
|
239
241
|
|
|
240
|
-
|
|
242
|
+
if (update) {
|
|
243
|
+
setTimeout(() => {
|
|
244
|
+
this.emit('deviceState', deviceData);
|
|
245
|
+
}, 500);
|
|
246
|
+
} this.emit('deviceState', deviceData);
|
|
241
247
|
return true;
|
|
242
248
|
case "melcloudhome":
|
|
243
249
|
switch (flag) {
|
|
@@ -255,6 +261,7 @@ class MelCloudErv extends EventEmitter {
|
|
|
255
261
|
payload = { enabled: deviceData.ScheduleEnabled };
|
|
256
262
|
method = 'PUT';
|
|
257
263
|
path = ApiUrlsHome.PutScheduleEnabled.replace('deviceid', deviceData.DeviceID);
|
|
264
|
+
update = true;
|
|
258
265
|
break;
|
|
259
266
|
case 'scene':
|
|
260
267
|
method = 'PUT';
|
|
@@ -288,6 +295,11 @@ class MelCloudErv extends EventEmitter {
|
|
|
288
295
|
if (this.logDebug) this.emit('debug', `Send data: ${JSON.stringify(payload, null, 2)}`);
|
|
289
296
|
await this.client(path, { method: method, data: payload });
|
|
290
297
|
|
|
298
|
+
if (update) {
|
|
299
|
+
setTimeout(() => {
|
|
300
|
+
this.emit('deviceState', deviceData);
|
|
301
|
+
}, 500);
|
|
302
|
+
}
|
|
291
303
|
return true;
|
|
292
304
|
default:
|
|
293
305
|
return;
|