homebridge-melcloud-control 2.5.0-beta.50 → 2.5.0-beta.51

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.
@@ -214,16 +214,19 @@
214
214
  "name": {
215
215
  "title": "Name",
216
216
  "type": "string",
217
+ "readOnly": true,
217
218
  "required": false
218
219
  },
219
220
  "id": {
220
221
  "title": "ID",
221
222
  "type": "integer",
223
+ "readOnly": true,
222
224
  "required": false
223
225
  },
224
226
  "type": {
225
227
  "title": "Type",
226
228
  "type": "integer",
229
+ "readOnly": true,
227
230
  "required": false
228
231
  },
229
232
  "displayMode": {
@@ -267,16 +270,19 @@
267
270
  "name": {
268
271
  "title": "Name",
269
272
  "type": "string",
273
+ "readOnly": true,
270
274
  "required": false
271
275
  },
272
276
  "id": {
273
277
  "title": "Mode",
274
278
  "type": "integer",
279
+ "readOnly": true,
275
280
  "required": false
276
281
  },
277
282
  "type": {
278
283
  "title": "Type",
279
284
  "type": "integer",
285
+ "readOnly": true,
280
286
  "required": false
281
287
  },
282
288
  "displayMode": {
@@ -320,16 +326,19 @@
320
326
  "name": {
321
327
  "title": "Name",
322
328
  "type": "string",
329
+ "readOnly": true,
323
330
  "required": false
324
331
  },
325
332
  "id": {
326
333
  "title": "Mode",
327
334
  "type": "integer",
335
+ "readOnly": true,
328
336
  "required": false
329
337
  },
330
338
  "type": {
331
339
  "title": "Type",
332
340
  "type": "integer",
341
+ "readOnly": true,
333
342
  "required": false
334
343
  },
335
344
  "displayMode": {
@@ -156,25 +156,32 @@
156
156
  const deviceType = deviceInfo.Type;
157
157
  const deviceId = deviceInfo.DeviceID;
158
158
  const deviceName = deviceInfo.DeviceName;
159
+ const device = { name: deviceName, id: deviceId, type: deviceType, displayMode: 0 };
159
160
 
161
+ //config account keys
160
162
  const accountKeys = Object.keys(pluginConfig[0].accounts[this.deviceIndex]);
161
- const ataDevices = accountKeys.includes('ataDevices') ? pluginConfig[0].accounts[this.deviceIndex].ataDevices : pluginConfig[0].accounts[this.deviceIndex].ataDevices = [];
162
- const atwDevices = accountKeys.includes('atwDevices') ? pluginConfig[0].accounts[this.deviceIndex].atwDevices : pluginConfig[0].accounts[this.deviceIndex].atwDevices = [];
163
- const ervDevices = accountKeys.includes('ervDevices') ? pluginConfig[0].accounts[this.deviceIndex].ervDevices : pluginConfig[0].accounts[this.deviceIndex].ervDevices = [];
164
163
 
164
+ //devices ata
165
+ const ataDevices = accountKeys.includes('ataDevices') ? pluginConfig[0].accounts[this.deviceIndex].ataDevices : pluginConfig[0].accounts[this.deviceIndex].ataDevices = [];
165
166
  const ataDeviceIdExist = ataDevices.some(device => device.id === deviceId)
166
- const atwDeviceIdExist = atwDevices.some(device => device.id === deviceId)
167
- const ervDeviceIdExist = ervDevices.some(device => device.id === deviceId)
168
- const pushNewDevice = ataDeviceIdExist || atwDeviceIdExist || ervDeviceIdExist ? false : newDevices.push(deviceId);
169
-
170
- const device = { name: deviceName, id: deviceId, type: deviceType, displayMode: 0 };
171
167
  const pushTypeAta = deviceType === 0 && !ataDeviceIdExist ? ataDevices.push(device) : false;
168
+
169
+ //devices atw
170
+ const atwDevices = accountKeys.includes('atwDevices') ? pluginConfig[0].accounts[this.deviceIndex].atwDevices : pluginConfig[0].accounts[this.deviceIndex].atwDevices = [];
171
+ const atwDeviceIdExist = atwDevices.some(device => device.id === deviceId)
172
172
  const pushTypeAtw = deviceType === 1 && !atwDeviceIdExist ? atwDevices.push(device) : false;
173
+
174
+ //devices erv
175
+ const ervDevices = accountKeys.includes('ervDevices') ? pluginConfig[0].accounts[this.deviceIndex].ervDevices : pluginConfig[0].accounts[this.deviceIndex].ervDevices = [];
176
+ const ervDeviceIdExist = ervDevices.some(device => device.id === deviceId)
173
177
  const pushTypeErv = deviceType === 3 && !ervDeviceIdExist ? ervDevices.push(device) : false;
178
+
179
+ //push new devices to array
180
+ const pushNewDevice = ataDeviceIdExist || atwDeviceIdExist || ervDeviceIdExist ? false : newDevices.push(deviceId);
174
181
  });
175
182
 
176
183
  const devicesCount = newDevices.length;
177
- document.getElementById('info').innerHTML = `Success, found ${devicesCount} ${devicesCount !== 1 ? 'new devices' : 'new device'}. ${devicesCount === 0 ? '' : 'Now You can start to configure it'}.`;
184
+ document.getElementById('info').innerHTML = `Check devices complete, found ${devicesCount} ${devicesCount !== 1 ? 'new devices' : 'new device'}. ${devicesCount === 0 ? '' : 'Now You can start to configure it'}.`;
178
185
  document.getElementById('info').style.color = 'green';
179
186
 
180
187
  await homebridge.updatePluginConfig(pluginConfig);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "2.5.0-beta.50",
4
+ "version": "2.5.0-beta.51",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",