homebridge-melcloud-control 3.1.3-beta.1 → 3.1.3-beta.2

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.
@@ -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",
@@ -210,8 +210,8 @@
210
210
  buttonsSensors: []
211
211
  };
212
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 = [];
213
+ const ataDevicesExist = pluginConfig[0].accounts[this.deviceIndex].ataDevices ?? [];
214
+ const ataDevices = ataDevicesExist.length > 0 ? pluginConfig[0].accounts[this.deviceIndex].ataDevices : pluginConfig[0].accounts[this.deviceIndex].ataDevices = [];
215
215
 
216
216
  const ataDeviceIdExist = ataDevices.some(device => device.id === deviceId);
217
217
  const pushTypeAta = ataDeviceIdExist ? false : ataDevices.push(deviceAta);
@@ -229,8 +229,8 @@
229
229
  preset.displayType == 0;
230
230
  preset.namePrefix = false;
231
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 = [];
232
+ const ataPresetsExist = pluginConfig[0].accounts[this.deviceIndex].ataDevices[index].presets ?? [];
233
+ const ataPresets = ataPresetsExist.length > 0 ? pluginConfig[0].accounts[this.deviceIndex].ataDevices[index].presets : pluginConfig[0].accounts[this.deviceIndex].ataDevices[index].presets = [];
234
234
  const ataPresetIdExist = ataPresets.some(preset => preset.id === presetId);
235
235
  const pushPresetAta = ataPresetIdExist ? false : ataPresets.push(preset);
236
236
  const pushNewPreset = ataPresetIdExist ? false : newDevices.ataPresets.push(preset);
@@ -241,7 +241,7 @@
241
241
  //compare presets
242
242
  const presetsOnMelCloud = devicePresets;
243
243
  const presetsAtaInConfig = pluginConfig[0].accounts[this.deviceIndex].ataDevices[index].presets;
244
- presetsAtaInConfig = syncArrays(presetsOnMelCloud, presetsAtaInConfig);
244
+ pluginConfig[0].accounts[this.deviceIndex].ataDevices[index].presets = syncArrays(presetsOnMelCloud, presetsAtaInConfig);
245
245
  });
246
246
 
247
247
  //get device info fom devices atw
@@ -273,8 +273,8 @@
273
273
  presets: [],
274
274
  buttonsSensors: []
275
275
  };
276
- const atwDevicesExist = pluginConfig[0].accounts[this.deviceIndex].atwDevices ?? false;
277
- const atwDevices = atwDevicesExist ? pluginConfig[0].accounts[this.deviceIndex].atwDevices : pluginConfig[0].accounts[this.deviceIndex].atwDevices = [];
276
+ const atwDevicesExist = pluginConfig[0].accounts[this.deviceIndex].atwDevices ?? [];
277
+ const atwDevices = atwDevicesExist.length > 0 ? pluginConfig[0].accounts[this.deviceIndex].atwDevices : pluginConfig[0].accounts[this.deviceIndex].atwDevices = [];
278
278
  const atwDeviceIdExist = atwDevices.some(device => device.id === deviceId);
279
279
  const pushTypeAtw = atwDeviceIdExist ? false : atwDevices.push(deviceAtw);
280
280
  const pushNewDevice = atwDeviceIdExist ? false : newDevices.atw.push(device);
@@ -291,8 +291,8 @@
291
291
  preset.displayType == 0;
292
292
  preset.namePrefix = false;
293
293
 
294
- const atwPresetsExist = pluginConfig[0].accounts[this.deviceIndex].atwDevices[index].presets ?? false;
295
- const atwPresets = atwPresetsExist ? pluginConfig[0].accounts[this.deviceIndex].atwDevices[index].presets : pluginConfig[0].accounts[this.deviceIndex].atwDevices[index].presets = [];
294
+ const atwPresetsExist = pluginConfig[0].accounts[this.deviceIndex].atwDevices[index].presets ?? [];
295
+ const atwPresets = atwPresetsExist.length > 0 ? pluginConfig[0].accounts[this.deviceIndex].atwDevices[index].presets : pluginConfig[0].accounts[this.deviceIndex].atwDevices[index].presets = [];
296
296
  const atwPresetIdExist = atwPresets.some(preset => preset.id === presetId);
297
297
  const pushPresetAtw = atwPresetIdExist ? false : atwPresets.push(preset);
298
298
  const pushNewPreset = atwPresetIdExist ? false : newDevices.atwPresets.push(preset);
@@ -302,7 +302,7 @@
302
302
 
303
303
  const presetsOnMelCloud = devicePresets;
304
304
  const presetsAtwInConfig = pluginConfig[0].accounts[this.deviceIndex].atwDevices[index].presets;
305
- presetsAtwInConfig = syncArrays(presetsOnMelCloud, presetsAtwInConfig);
305
+ pluginConfig[0].accounts[this.deviceIndex].atwDevices[index].presets = syncArrays(presetsOnMelCloud, presetsAtwInConfig);
306
306
  });
307
307
 
308
308
  //get device info fom devices erv
@@ -328,8 +328,8 @@
328
328
  presets: [],
329
329
  buttonsSensors: []
330
330
  };
331
- const ervDevicesExist = pluginConfig[0].accounts[this.deviceIndex].ervDevices ?? false;
332
- const ervDevices = ervDevicesExist ? pluginConfig[0].accounts[this.deviceIndex].ervDevices : pluginConfig[0].accounts[this.deviceIndex].ervDevices = [];
331
+ const ervDevicesExist = pluginConfig[0].accounts[this.deviceIndex].ervDevices ?? [];
332
+ const ervDevices = ervDevicesExist.length > 0 ? pluginConfig[0].accounts[this.deviceIndex].ervDevices : pluginConfig[0].accounts[this.deviceIndex].ervDevices = [];
333
333
  const ervDeviceIdExist = ervDevices.some(device => device.id === deviceId);
334
334
  const pushTypeerv = ervDeviceIdExist ? false : ervDevices.push(deviceErv);
335
335
  const pushNewDevice = ervDeviceIdExist ? false : newDevices.erv.push(device);
@@ -346,8 +346,8 @@
346
346
  preset.displayType == 0;
347
347
  preset.namePrefix = false;
348
348
 
349
- const ervPresetsExist = pluginConfig[0].accounts[this.deviceIndex].ervDevices[index].presets ?? false;
350
- const ervPresets = ervPresetsExist ? pluginConfig[0].accounts[this.deviceIndex].ervDevices[index].presets : pluginConfig[0].accounts[this.deviceIndex].ervDevices[index].presets = [];
349
+ const ervPresetsExist = pluginConfig[0].accounts[this.deviceIndex].ervDevices[index].presets ?? [];
350
+ const ervPresets = ervPresetsExist.length > 0 ? pluginConfig[0].accounts[this.deviceIndex].ervDevices[index].presets : pluginConfig[0].accounts[this.deviceIndex].ervDevices[index].presets = [];
351
351
  const ervPresetIdExist = ervPresets.some(preset => preset.id === presetId);
352
352
  const pushPresetErv = ervPresetIdExist ? false : ervPresets.push(preset);
353
353
  const pushNewPreset = ervPresetIdExist ? false : newDevices.ervPresets.push(preset);
@@ -357,19 +357,19 @@
357
357
 
358
358
  const presetsOnMelCloud = devicePresets;
359
359
  const presetsErvInConfig = pluginConfig[0].accounts[this.deviceIndex].ervDevices[index].presets;
360
- presetsErvInConfig = await syncArrays(presetsOnMelCloud, presetsErvInConfig);
360
+ pluginConfig[0].accounts[this.deviceIndex].ervDevices[index].presets = await syncArrays(presetsOnMelCloud, presetsErvInConfig);
361
361
  });
362
362
 
363
363
  //compare arrays and update array in config
364
364
  const devicesOnMelCloud = devices;
365
365
  const devicesAtaInConfig = pluginConfig[0].accounts[this.deviceIndex].ataDevices;
366
- devicesAtaInConfig = await syncArrays(devicesOnMelCloud, devicesAtaInConfig);
366
+ pluginConfig[0].accounts[this.deviceIndex].ataDevices = await syncArrays(devicesOnMelCloud, devicesAtaInConfig);
367
367
 
368
368
  const devicesAtwInConfig = pluginConfig[0].accounts[this.deviceIndex].atwDevices;
369
- devicesAtwInConfig = await syncArrays(devicesOnMelCloud, devicesAtwInConfig);
369
+ pluginConfig[0].accounts[this.deviceIndex].atwDevices = await syncArrays(devicesOnMelCloud, devicesAtwInConfig);
370
370
 
371
371
  const devicesErvInConfig = pluginConfig[0].accounts[this.deviceIndex].ervDevices;
372
- devicesErvInConfig = await syncArrays(devicesOnMelCloud, devicesErvInConfig);
372
+ pluginConfig[0].accounts[this.deviceIndex].ervDevices = await syncArrays(devicesOnMelCloud, devicesErvInConfig);
373
373
 
374
374
  const newDevicesCount = newDevices.ata.length + newDevices.atw.length + newDevices.erv.length ?? 0;
375
375
  const newPresetsCount = newDevices.ataPresets.length + newDevices.atwPresets.length + newDevices.ervPresets.length ?? 0;
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.1",
4
+ "version": "3.1.3-beta.2",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",