homebridge-melcloud-control 4.1.2-beta.43 → 4.1.2-beta.44
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/homebridge-ui/public/index.html +40 -30
- package/package.json +1 -1
|
@@ -254,45 +254,55 @@
|
|
|
254
254
|
const removedErv = removeStaleDevices(account.ervDevices, devicesByType.erv);
|
|
255
255
|
|
|
256
256
|
const handleDevices = (devicesInMelCloud, devicesInConfig, typeString, newArr, newPresets) => {
|
|
257
|
-
|
|
258
|
-
const
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
257
|
+
try {
|
|
258
|
+
const configDevicesMap = new Map(devicesInConfig.map(dev => [String(dev.id), dev]));
|
|
259
|
+
|
|
260
|
+
devicesInMelCloud.forEach(device => {
|
|
261
|
+
const deviceId = String(device.DeviceID);
|
|
262
|
+
let deviceInConfig = configDevicesMap.get(deviceId);
|
|
263
|
+
|
|
264
|
+
if (!deviceInConfig) {
|
|
265
|
+
deviceInConfig = {
|
|
266
|
+
id: device.DeviceID,
|
|
267
|
+
type: device.Type,
|
|
268
|
+
typeString,
|
|
269
|
+
displayType: 0,
|
|
270
|
+
name: device.DeviceName,
|
|
271
|
+
presets: [],
|
|
272
|
+
schedules: [],
|
|
273
|
+
buttonsSensors: []
|
|
274
|
+
};
|
|
275
|
+
devicesInConfig.push(deviceInConfig);
|
|
276
|
+
newArr.push(deviceInConfig);
|
|
277
|
+
configDevicesMap.set(deviceId, deviceInConfig);
|
|
278
|
+
}
|
|
279
|
+
|
|
276
280
|
const idKey = account.type === 'melcloud' ? 'ID' : 'Id';
|
|
277
281
|
const typeKey = account.type === 'melcloud' ? 'Presets' : 'Schedule';
|
|
278
282
|
const typeKey1 = account.type === 'melcloud' ? 'presets' : 'schedules';
|
|
279
283
|
const presets = device[typeKey] || [];
|
|
280
|
-
presets.forEach((preset, index) => {
|
|
281
|
-
const presetObj = {
|
|
282
|
-
id: preset[idKey],
|
|
283
|
-
displayType: 0,
|
|
284
|
-
name: preset.NumberDescription || `Schedule ${index}`,
|
|
285
|
-
namePrefix: false
|
|
286
|
-
};
|
|
287
284
|
|
|
288
|
-
|
|
289
|
-
|
|
285
|
+
const presetsInConfig = deviceInConfig[typeKey1] || [];
|
|
286
|
+
const presetIds = new Set(presetsInConfig.map(p => String(p.id)));
|
|
287
|
+
|
|
288
|
+
presets.forEach((preset, index) => {
|
|
289
|
+
const presetId = String(preset[idKey]);
|
|
290
|
+
if (!presetIds.has(presetId)) {
|
|
291
|
+
const presetObj = {
|
|
292
|
+
id: presetId,
|
|
293
|
+
displayType: 0,
|
|
294
|
+
name: preset.NumberDescription || `Schedule ${index}`,
|
|
295
|
+
namePrefix: false
|
|
296
|
+
};
|
|
290
297
|
presetsInConfig.push(presetObj);
|
|
291
298
|
newPresets.push(presetObj);
|
|
299
|
+
presetIds.add(presetId);
|
|
292
300
|
}
|
|
293
301
|
});
|
|
294
|
-
}
|
|
295
|
-
})
|
|
302
|
+
});
|
|
303
|
+
} catch (error) {
|
|
304
|
+
updateInfo('info1', `Error while processing device: ${error.message || error}`, 'red');
|
|
305
|
+
}
|
|
296
306
|
};
|
|
297
307
|
|
|
298
308
|
handleDevices(devicesByType.ata, account.ataDevices, "Air Conditioner", newDevices.ata, newDevices.ataPresets);
|
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.2-beta.
|
|
4
|
+
"version": "4.1.2-beta.44",
|
|
5
5
|
"description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|