homebridge-melcloud-control 4.0.1-beta.5 → 4.0.1-beta.7
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 +11 -11
- package/homebridge-ui/server.js +1 -1
- package/package.json +1 -1
- package/src/melcloud.js +2 -2
|
@@ -257,32 +257,32 @@
|
|
|
257
257
|
|
|
258
258
|
const handleDevices = (devicesInMelCloud, devicesInConfig, typeString, newArr, newPresets) => {
|
|
259
259
|
devicesInMelCloud.forEach(device => {
|
|
260
|
-
const { DeviceID: id, Type: type, DeviceName: name, Presets: presets = [] } = device;
|
|
261
260
|
const deviceObj = {
|
|
262
|
-
id,
|
|
263
|
-
type,
|
|
261
|
+
id: device.DeviceID,
|
|
262
|
+
type: device.Type,
|
|
264
263
|
typeString,
|
|
265
|
-
name,
|
|
266
264
|
displayType: 0,
|
|
267
|
-
|
|
265
|
+
name: device.DeviceName,
|
|
266
|
+
presets: device.Presets ?? [],
|
|
268
267
|
buttonsSensors: []
|
|
269
268
|
};
|
|
270
269
|
|
|
271
|
-
if (!devicesInConfig.some(device => String(device.id) === id)) {
|
|
270
|
+
if (!devicesInConfig.some(device => String(device.id) === deviceObj.id)) {
|
|
272
271
|
devicesInConfig.push(deviceObj);
|
|
273
272
|
newArr.push(deviceObj);
|
|
274
273
|
}
|
|
275
274
|
|
|
275
|
+
const presets = device.Presets || [];
|
|
276
276
|
presets.forEach(preset => {
|
|
277
277
|
const presetObj = {
|
|
278
278
|
id: preset.ID,
|
|
279
|
-
name: preset.NumberDescription,
|
|
280
279
|
displayType: 0,
|
|
280
|
+
name: preset.NumberDescription,
|
|
281
281
|
namePrefix: false
|
|
282
282
|
};
|
|
283
283
|
|
|
284
|
-
const deviceInConfig = devicesInConfig.find(device => String(device.id) === id);
|
|
285
|
-
if (deviceInConfig && !deviceInConfig.presets.some(preset => preset.id ===
|
|
284
|
+
const deviceInConfig = devicesInConfig.find(device => String(device.id) === deviceObj.id);
|
|
285
|
+
if (deviceInConfig && !deviceInConfig.presets.some(preset => preset.id === presetObj.id)) {
|
|
286
286
|
deviceInConfig.presets.push(presetObj);
|
|
287
287
|
newPresets.push(presetObj);
|
|
288
288
|
}
|
|
@@ -314,8 +314,8 @@
|
|
|
314
314
|
document.getElementById('logIn').className = "btn btn-secondary";
|
|
315
315
|
|
|
316
316
|
} catch (error) {
|
|
317
|
-
updateInfo('info', '
|
|
318
|
-
updateInfo('info1',
|
|
317
|
+
updateInfo('info', 'Connect error.', 'yellow');
|
|
318
|
+
updateInfo('info1', `${JSON.stringify(error)}`, 'red');
|
|
319
319
|
document.getElementById('logIn').className = "btn btn-secondary";
|
|
320
320
|
} finally {
|
|
321
321
|
homebridge.hideSpinner();
|
package/homebridge-ui/server.js
CHANGED
|
@@ -26,7 +26,7 @@ class PluginUiServer extends HomebridgePluginUiServer {
|
|
|
26
26
|
const devicesList = await melCloud.checkDevicesList();
|
|
27
27
|
return devicesList;
|
|
28
28
|
} catch (error) {
|
|
29
|
-
throw new Error(
|
|
29
|
+
throw new Error(error);
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
32
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.0.1-beta.
|
|
4
|
+
"version": "4.0.1-beta.7",
|
|
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/melcloud.js
CHANGED
|
@@ -455,7 +455,7 @@ class MelCloud extends EventEmitter {
|
|
|
455
455
|
|
|
456
456
|
return devicesList;
|
|
457
457
|
} catch (error) {
|
|
458
|
-
throw new Error(
|
|
458
|
+
throw new Error(error);
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
461
|
|
|
@@ -479,7 +479,7 @@ class MelCloud extends EventEmitter {
|
|
|
479
479
|
|
|
480
480
|
return response;
|
|
481
481
|
} catch (error) {
|
|
482
|
-
throw new Error(
|
|
482
|
+
throw new Error(error);
|
|
483
483
|
}
|
|
484
484
|
}
|
|
485
485
|
|