homebridge-melcloud-control 3.1.3-beta.1 → 3.1.3-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 +20 -10
- package/homebridge-ui/public/index.html +153 -196
- package/package.json +1 -1
package/config.schema.json
CHANGED
|
@@ -213,17 +213,20 @@
|
|
|
213
213
|
"id": {
|
|
214
214
|
"title": "ID",
|
|
215
215
|
"type": "integer",
|
|
216
|
-
"required": true
|
|
216
|
+
"required": true,
|
|
217
|
+
"readonly": true
|
|
217
218
|
},
|
|
218
219
|
"type": {
|
|
219
220
|
"title": "Type",
|
|
220
221
|
"type": "integer",
|
|
221
|
-
"required": true
|
|
222
|
+
"required": true,
|
|
223
|
+
"readonly": true
|
|
222
224
|
},
|
|
223
225
|
"typeString": {
|
|
224
226
|
"title": "Type",
|
|
225
227
|
"type": "string",
|
|
226
|
-
"required": true
|
|
228
|
+
"required": true,
|
|
229
|
+
"readonly": true
|
|
227
230
|
},
|
|
228
231
|
"name": {
|
|
229
232
|
"title": "Name",
|
|
@@ -757,17 +760,20 @@
|
|
|
757
760
|
"id": {
|
|
758
761
|
"title": "Mode",
|
|
759
762
|
"type": "integer",
|
|
760
|
-
"required": true
|
|
763
|
+
"required": true,
|
|
764
|
+
"readonly": true
|
|
761
765
|
},
|
|
762
766
|
"type": {
|
|
763
767
|
"title": "Type",
|
|
764
768
|
"type": "integer",
|
|
765
|
-
"required": true
|
|
769
|
+
"required": true,
|
|
770
|
+
"readonly": true
|
|
766
771
|
},
|
|
767
772
|
"typeString": {
|
|
768
773
|
"title": "Type",
|
|
769
774
|
"type": "string",
|
|
770
|
-
"required": true
|
|
775
|
+
"required": true,
|
|
776
|
+
"readonly": true
|
|
771
777
|
},
|
|
772
778
|
"name": {
|
|
773
779
|
"title": "Name",
|
|
@@ -1168,17 +1174,20 @@
|
|
|
1168
1174
|
"id": {
|
|
1169
1175
|
"title": "Mode",
|
|
1170
1176
|
"type": "integer",
|
|
1171
|
-
"required": true
|
|
1177
|
+
"required": true,
|
|
1178
|
+
"readonly": true
|
|
1172
1179
|
},
|
|
1173
1180
|
"type": {
|
|
1174
1181
|
"title": "Type",
|
|
1175
1182
|
"type": "integer",
|
|
1176
|
-
"required": true
|
|
1183
|
+
"required": true,
|
|
1184
|
+
"readonly": true
|
|
1177
1185
|
},
|
|
1178
1186
|
"typeString": {
|
|
1179
1187
|
"title": "Type",
|
|
1180
1188
|
"type": "string",
|
|
1181
|
-
"required": true
|
|
1189
|
+
"required": true,
|
|
1190
|
+
"readonly": true
|
|
1182
1191
|
},
|
|
1183
1192
|
"name": {
|
|
1184
1193
|
"title": "Name",
|
|
@@ -1244,7 +1253,8 @@
|
|
|
1244
1253
|
"id": {
|
|
1245
1254
|
"title": "ID",
|
|
1246
1255
|
"type": "integer",
|
|
1247
|
-
"required": true
|
|
1256
|
+
"required": true,
|
|
1257
|
+
"readonly": true
|
|
1248
1258
|
},
|
|
1249
1259
|
"name": {
|
|
1250
1260
|
"title": "Name",
|
|
@@ -151,11 +151,6 @@
|
|
|
151
151
|
const info = response.info ?? '';
|
|
152
152
|
const status = response.status;
|
|
153
153
|
const devices = response.data ?? [];
|
|
154
|
-
const devicesByType = {
|
|
155
|
-
ata: [],
|
|
156
|
-
atw: [],
|
|
157
|
-
erv: []
|
|
158
|
-
};
|
|
159
154
|
|
|
160
155
|
//new found devices
|
|
161
156
|
const newDevices = {
|
|
@@ -178,199 +173,178 @@
|
|
|
178
173
|
//response status
|
|
179
174
|
switch (status) {
|
|
180
175
|
case 0:
|
|
181
|
-
//
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
};
|
|
176
|
+
//compare arrays and update array in config
|
|
177
|
+
const devicesOnMelCloud = devices;
|
|
178
|
+
const devicesOnMelCloudId = new Set(devicesOnMelCloud.map(device => device.DeviceID));
|
|
179
|
+
|
|
180
|
+
let devicesAtaInConfig = pluginConfig[0].accounts[this.deviceIndex].ataDevices ?? [];
|
|
181
|
+
devicesAtaInConfig = devicesAtaInConfig.filter(device => devicesOnMelCloudId.has(device.id));
|
|
188
182
|
|
|
189
|
-
|
|
190
|
-
|
|
183
|
+
let devicesAtwInConfig = pluginConfig[0].accounts[this.deviceIndex].atwDevices ?? [];
|
|
184
|
+
devicesAtwInConfig = devicesAtwInConfig.filter(device => devicesOnMelCloudId.has(device.id));
|
|
185
|
+
|
|
186
|
+
let devicesErvInConfig = pluginConfig[0].accounts[this.deviceIndex].ervDevices ?? [];
|
|
187
|
+
devicesErvInConfig = devicesErvInConfig.filter(device => devicesOnMelCloudId.has(device.id));
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
// Add objects from devicesOnMelCloud to devicesInConfig that do not exist in devicesInConfig
|
|
191
|
+
devicesOnMelCloud.forEach((device, index) => {
|
|
191
192
|
const deviceId = device.DeviceID;
|
|
192
193
|
const deviceType = device.Type;
|
|
193
|
-
const deviceTypeText = "Air Conditioner";
|
|
194
194
|
const deviceName = device.DeviceName;
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
195
|
+
const devicePresetsOnMelcloud = device.Presets ?? [];
|
|
196
|
+
|
|
197
|
+
if (deviceType === 0) {
|
|
198
|
+
if (!devicesAtaInConfig.some(item => item.id === device.id)) {
|
|
199
|
+
//device ata
|
|
200
|
+
const deviceAta = {
|
|
201
|
+
id: deviceId,
|
|
202
|
+
type: deviceType,
|
|
203
|
+
typeString: "Air Conditioner",
|
|
204
|
+
name: deviceName,
|
|
205
|
+
displayMode: 1,
|
|
206
|
+
heatDryFanMode: 1,
|
|
207
|
+
coolDryFanMode: 1,
|
|
208
|
+
autoDryFanMode: 1,
|
|
209
|
+
temperatureSensor: false,
|
|
210
|
+
temperatureSensorOutdoor: false,
|
|
211
|
+
presets: [],
|
|
212
|
+
buttonsSensors: []
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
//presets
|
|
216
|
+
const presetsOnMelCloudId = new Set(devicePresetsOnMelcloud.map(preset => preset.ID));
|
|
217
|
+
let presetsAtaInConfig = pluginConfig[0].accounts[this.deviceIndex].ataDevices[index].presets ?? [];
|
|
218
|
+
presetsAtaInConfig = presetsAtaInConfig.filter(preset => presetsOnMelCloudId.has(preset.id));
|
|
219
|
+
|
|
220
|
+
for (const preset of presetsAtaInConfig) {
|
|
221
|
+
const presetId = preset.ID;
|
|
222
|
+
const presetName = preset.NumberDescription;
|
|
223
|
+
|
|
224
|
+
preset.id = presetId;
|
|
225
|
+
preset.name = presetName;
|
|
226
|
+
preset.displayType == 0;
|
|
227
|
+
preset.namePrefix = false;
|
|
228
|
+
newDevices.ataPresets.push(preset);
|
|
229
|
+
};
|
|
230
|
+
textAtaPresets = `ATA Presets: ${newDevices.ataPresets.length}`
|
|
231
|
+
|
|
232
|
+
deviceAta.ataPresets = newDevices.ataPresets;
|
|
233
|
+
newDevices.ata.push(deviceAta);
|
|
234
|
+
};
|
|
235
|
+
pluginConfig[0].accounts[this.deviceIndex].ataDevices = newDevices.ata;
|
|
236
|
+
textAta = `ATA: ${newDevices.ata.length}`
|
|
211
237
|
};
|
|
212
|
-
|
|
213
|
-
const ataDevicesExist = pluginConfig[0].accounts[this.deviceIndex].ataDevices ?? false;
|
|
214
|
-
const ataDevices = ataDevicesExist ? pluginConfig[0].accounts[this.deviceIndex].ataDevices : pluginConfig[0].accounts[this.deviceIndex].ataDevices = [];
|
|
215
|
-
|
|
216
|
-
const ataDeviceIdExist = ataDevices.some(device => device.id === deviceId);
|
|
217
|
-
const pushTypeAta = ataDeviceIdExist ? false : ataDevices.push(deviceAta);
|
|
218
|
-
const pushNewDevice = ataDeviceIdExist ? false : newDevices.ata.push(device);
|
|
219
|
-
const devicesCount = newDevices.ata.length;
|
|
220
|
-
textAta = `ATA: ${devicesCount}`
|
|
221
|
-
|
|
222
|
-
//presets
|
|
223
|
-
for (const preset of devicePresets) {
|
|
224
|
-
const presetId = preset.ID;
|
|
225
|
-
const presetName = preset.NumberDescription;
|
|
226
|
-
|
|
227
|
-
preset.id = presetId;
|
|
228
|
-
preset.name = presetName;
|
|
229
|
-
preset.displayType == 0;
|
|
230
|
-
preset.namePrefix = false;
|
|
231
|
-
|
|
232
|
-
const ataPresetsExist = pluginConfig[0].accounts[this.deviceIndex].ataDevices[index].presets ?? false;
|
|
233
|
-
const ataPresets = ataPresetsExist ? pluginConfig[0].accounts[this.deviceIndex].ataDevices[index].presets : pluginConfig[0].accounts[this.deviceIndex].ataDevices[index].presets = [];
|
|
234
|
-
const ataPresetIdExist = ataPresets.some(preset => preset.id === presetId);
|
|
235
|
-
const pushPresetAta = ataPresetIdExist ? false : ataPresets.push(preset);
|
|
236
|
-
const pushNewPreset = ataPresetIdExist ? false : newDevices.ataPresets.push(preset);
|
|
237
|
-
const presetsCount = newDevices.ataPresets.length;
|
|
238
|
-
textAtaPresets = `ATA Presets: ${presetsCount}`
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
//compare presets
|
|
242
|
-
const presetsOnMelCloud = devicePresets;
|
|
243
|
-
const presetsAtaInConfig = pluginConfig[0].accounts[this.deviceIndex].ataDevices[index].presets;
|
|
244
|
-
presetsAtaInConfig = syncArrays(presetsOnMelCloud, presetsAtaInConfig);
|
|
245
238
|
});
|
|
246
239
|
|
|
247
|
-
|
|
248
|
-
devicesByType.atw.forEach(async (device, index) => {
|
|
240
|
+
devicesOnMelCloud.forEach((device, index) => {
|
|
249
241
|
const deviceId = device.DeviceID;
|
|
250
242
|
const deviceType = device.Type;
|
|
251
|
-
const deviceTypeText = "Heat Pump";
|
|
252
243
|
const deviceName = device.DeviceName;
|
|
253
|
-
const
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
244
|
+
const devicePresetsOnMelcloud = device.Presets ?? [];
|
|
245
|
+
|
|
246
|
+
if (deviceType === 0) {
|
|
247
|
+
if (!devicesAtwInConfig.some(item => item.id === device.id)) {
|
|
248
|
+
//device atw
|
|
249
|
+
if (deviceType === 1) {
|
|
250
|
+
const deviceAtw = {
|
|
251
|
+
id: deviceId,
|
|
252
|
+
type: deviceType,
|
|
253
|
+
typeString: "Heat Pump",
|
|
254
|
+
name: deviceName,
|
|
255
|
+
displayMode: 1,
|
|
256
|
+
temperatureSensor: false,
|
|
257
|
+
temperatureSensorFlow: false,
|
|
258
|
+
temperatureSensorReturn: false,
|
|
259
|
+
temperatureSensorFlowZone1: false,
|
|
260
|
+
temperatureSensorReturnZone1: false,
|
|
261
|
+
temperatureSensorFlowWaterTank: false,
|
|
262
|
+
temperatureSensorReturnWaterTank: false,
|
|
263
|
+
temperatureSensorFlowZone2: false,
|
|
264
|
+
temperatureSensorReturnZone2: false,
|
|
265
|
+
temperatureSensor: false,
|
|
266
|
+
temperatureSensorOutdoor: false,
|
|
267
|
+
presets: [],
|
|
268
|
+
buttonsSensors: []
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
//presets
|
|
272
|
+
const presetsOnMelCloudId = new Set(devicePresetsOnMelcloud.map(preset => preset.ID));
|
|
273
|
+
let presetsAtwInConfig = pluginConfig[0].accounts[this.deviceIndex].atwDevices[index].presets ?? [];
|
|
274
|
+
presetsAtwInConfig = presetsAtwInConfig.filter(preset => presetsOnMelCloudId.has(preset.id));
|
|
275
|
+
|
|
276
|
+
for (const preset of presetsAtwInConfig) {
|
|
277
|
+
const presetId = preset.ID;
|
|
278
|
+
const presetName = preset.NumberDescription;
|
|
279
|
+
|
|
280
|
+
preset.id = presetId;
|
|
281
|
+
preset.name = presetName;
|
|
282
|
+
preset.displayType == 0;
|
|
283
|
+
preset.namePrefix = false;
|
|
284
|
+
newDevices.atwPresets.push(preset);
|
|
285
|
+
};
|
|
286
|
+
textAtwPresets = `ATA Presets: ${newDevices.atwPresets.length}`
|
|
287
|
+
|
|
288
|
+
deviceAtw.atwPresets = deviceAtw.atwPresets;
|
|
289
|
+
newDevices.ata.push(deviceAtw);
|
|
290
|
+
};
|
|
291
|
+
pluginConfig[0].accounts[this.deviceIndex].atwDevices = newDevices.atw;
|
|
292
|
+
textAtw = `ATW: ${newDevices.atw.length}`
|
|
293
|
+
};
|
|
301
294
|
};
|
|
302
|
-
|
|
303
|
-
const presetsOnMelCloud = devicePresets;
|
|
304
|
-
const presetsAtwInConfig = pluginConfig[0].accounts[this.deviceIndex].atwDevices[index].presets;
|
|
305
|
-
presetsAtwInConfig = syncArrays(presetsOnMelCloud, presetsAtwInConfig);
|
|
306
295
|
});
|
|
307
296
|
|
|
308
|
-
|
|
309
|
-
devicesByType.erv.forEach(async (device, index) => {
|
|
297
|
+
devicesOnMelCloud.forEach((device, index) => {
|
|
310
298
|
const deviceId = device.DeviceID;
|
|
311
299
|
const deviceType = device.Type;
|
|
312
|
-
const deviceTypeText = "Energy Recovery Ventilation";
|
|
313
300
|
const deviceName = device.DeviceName;
|
|
314
|
-
const
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
301
|
+
const devicePresetsOnMelcloud = device.Presets ?? [];
|
|
302
|
+
|
|
303
|
+
if (deviceType === 0) {
|
|
304
|
+
if (!devicesAtwInConfig.some(item => item.id === device.id)) {
|
|
305
|
+
//device erv
|
|
306
|
+
if (deviceType === 3) {
|
|
307
|
+
const deviceErv = {
|
|
308
|
+
id: deviceId,
|
|
309
|
+
type: deviceType,
|
|
310
|
+
typeString: "Energy Recovery Ventilation",
|
|
311
|
+
name: deviceName,
|
|
312
|
+
displayMode: 1,
|
|
313
|
+
temperatureSensor: false,
|
|
314
|
+
temperatureSensorOutdoor: false,
|
|
315
|
+
temperatureSensorSupply: false,
|
|
316
|
+
temperatureSensor: false,
|
|
317
|
+
temperatureSensorOutdoor: false,
|
|
318
|
+
presets: [],
|
|
319
|
+
buttonsSensors: []
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
//presets
|
|
323
|
+
const presetsOnMelCloudId = new Set(devicePresetsOnMelcloud.map(preset => preset.ID));
|
|
324
|
+
let presetsErvInConfig = pluginConfig[0].accounts[this.deviceIndex].ervDevices[index].presets ?? [];
|
|
325
|
+
presetsErvInConfig = presetsErvInConfig.filter(preset => presetsOnMelCloudId.has(preset.id));
|
|
326
|
+
|
|
327
|
+
for (const preset of presetsErvInConfig) {
|
|
328
|
+
const presetId = preset.ID;
|
|
329
|
+
const presetName = preset.NumberDescription;
|
|
330
|
+
|
|
331
|
+
preset.id = presetId;
|
|
332
|
+
preset.name = presetName;
|
|
333
|
+
preset.displayType == 0;
|
|
334
|
+
preset.namePrefix = false;
|
|
335
|
+
newDevices.atwPresets.push(preset);
|
|
336
|
+
};
|
|
337
|
+
textErvPresets = `ATA Presets: ${newDevices.ErvPresets.length}`
|
|
338
|
+
|
|
339
|
+
deviceErv.atwPresets = deviceErv.ervPresets;
|
|
340
|
+
newDevices.erv.push(deviceErv);
|
|
341
|
+
};
|
|
342
|
+
pluginConfig[0].accounts[this.deviceIndex].ervDevices = newDevices.erv;
|
|
343
|
+
textErv = `ERV: ${newDevices.erv.length}`
|
|
344
|
+
};
|
|
356
345
|
};
|
|
357
|
-
|
|
358
|
-
const presetsOnMelCloud = devicePresets;
|
|
359
|
-
const presetsErvInConfig = pluginConfig[0].accounts[this.deviceIndex].ervDevices[index].presets;
|
|
360
|
-
presetsErvInConfig = await syncArrays(presetsOnMelCloud, presetsErvInConfig);
|
|
361
346
|
});
|
|
362
347
|
|
|
363
|
-
//compare arrays and update array in config
|
|
364
|
-
const devicesOnMelCloud = devices;
|
|
365
|
-
const devicesAtaInConfig = pluginConfig[0].accounts[this.deviceIndex].ataDevices;
|
|
366
|
-
devicesAtaInConfig = await syncArrays(devicesOnMelCloud, devicesAtaInConfig);
|
|
367
|
-
|
|
368
|
-
const devicesAtwInConfig = pluginConfig[0].accounts[this.deviceIndex].atwDevices;
|
|
369
|
-
devicesAtwInConfig = await syncArrays(devicesOnMelCloud, devicesAtwInConfig);
|
|
370
|
-
|
|
371
|
-
const devicesErvInConfig = pluginConfig[0].accounts[this.deviceIndex].ervDevices;
|
|
372
|
-
devicesErvInConfig = await syncArrays(devicesOnMelCloud, devicesErvInConfig);
|
|
373
|
-
|
|
374
348
|
const newDevicesCount = newDevices.ata.length + newDevices.atw.length + newDevices.erv.length ?? 0;
|
|
375
349
|
const newPresetsCount = newDevices.ataPresets.length + newDevices.atwPresets.length + newDevices.ervPresets.length ?? 0;
|
|
376
350
|
if (newDevicesCount === 0 && newPresetsCount === 0) {
|
|
@@ -414,23 +388,6 @@
|
|
|
414
388
|
break;
|
|
415
389
|
};
|
|
416
390
|
|
|
417
|
-
async function syncArrays(devicesOnMelCloud, devicesInConfig) {
|
|
418
|
-
// Create a Set of IDs from devicesOnMelCloud for quick lookup
|
|
419
|
-
const devicesOnMelCloudId = new Set(devicesOnMelCloud.map(device => device.DeviceID));
|
|
420
|
-
|
|
421
|
-
// Filter devicesInConfig to keep only objects that exist in devicesOnMelCloud
|
|
422
|
-
devicesInConfig = devicesInConfig.filter(device => devicesOnMelCloudId.has(device.DeviceID));
|
|
423
|
-
|
|
424
|
-
// Add objects from devicesOnMelCloud to devicesInConfig that do not exist in devicesInConfig
|
|
425
|
-
devicesOnMelCloud.forEach(device => {
|
|
426
|
-
if (!devicesInConfig.some(item => item.id === device.id)) {
|
|
427
|
-
devicesInConfig.push(device);
|
|
428
|
-
}
|
|
429
|
-
});
|
|
430
|
-
|
|
431
|
-
return devicesInConfig;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
391
|
homebridge.hideSpinner();
|
|
435
392
|
} catch (e) {
|
|
436
393
|
document.getElementById('info').innerHTML = 'Please try again.';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "3.1.3-beta.
|
|
4
|
+
"version": "3.1.3-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",
|