homebridge-melcloud-control 4.5.9-beta.2 → 4.5.9-beta.4

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.
@@ -210,7 +210,7 @@
210
210
  "description": "Here select the account type.",
211
211
  "anyOf": [
212
212
  {
213
- "title": "None / Disabled",
213
+ "title": "Disabled",
214
214
  "enum": [
215
215
  "disabled"
216
216
  ]
@@ -237,8 +237,7 @@
237
237
  "properties": {
238
238
  "id": {
239
239
  "title": "Id",
240
- "type": "string",
241
- "default": "0"
240
+ "type": "string"
242
241
  },
243
242
  "type": {
244
243
  "title": "Type",
@@ -248,7 +247,6 @@
248
247
  "displayType": {
249
248
  "title": "Display Type",
250
249
  "type": "integer",
251
- "minimum": 0,
252
250
  "maximum": 2,
253
251
  "description": "Select accessory control type displayed in HomeKit.",
254
252
  "anyOf": [
@@ -275,7 +273,6 @@
275
273
  "heatDryFanMode": {
276
274
  "title": "Heat",
277
275
  "type": "integer",
278
- "minimum": 0,
279
276
  "maximum": 3,
280
277
  "description": "Select the operating mode for Heat, work only if mode supported by device.",
281
278
  "anyOf": [
@@ -302,7 +299,6 @@
302
299
  "coolDryFanMode": {
303
300
  "title": "Cool",
304
301
  "type": "integer",
305
- "minimum": 0,
306
302
  "maximum": 3,
307
303
  "description": "Select the operating mode for Cool, work only if mode supported by device.",
308
304
  "anyOf": [
@@ -329,7 +325,6 @@
329
325
  "autoDryFanMode": {
330
326
  "title": "Auto",
331
327
  "type": "integer",
332
- "minimum": 0,
333
328
  "maximum": 3,
334
329
  "description": "Select the operating mode for Auto, work only if mode supported by device.",
335
330
  "anyOf": [
@@ -418,13 +413,11 @@
418
413
  "properties": {
419
414
  "id": {
420
415
  "title": "Id",
421
- "type": "string",
422
- "default": "0"
416
+ "type": "string"
423
417
  },
424
418
  "displayType": {
425
419
  "title": "Display Type",
426
420
  "type": "integer",
427
- "minimum": 0,
428
421
  "maximum": 7,
429
422
  "description": "Select the characteristic type to be displayed in HomeKit.",
430
423
  "anyOf": [
@@ -495,13 +488,11 @@
495
488
  "properties": {
496
489
  "id": {
497
490
  "title": "Id",
498
- "type": "string",
499
- "default": "0"
491
+ "type": "string"
500
492
  },
501
493
  "displayType": {
502
494
  "title": "Display Type",
503
495
  "type": "integer",
504
- "minimum": 0,
505
496
  "maximum": 7,
506
497
  "description": "Select the characteristic type to be displayed in HomeKit.",
507
498
  "anyOf": [
@@ -575,13 +566,11 @@
575
566
  "properties": {
576
567
  "id": {
577
568
  "title": "Id",
578
- "type": "string",
579
- "default": "0"
569
+ "type": "string"
580
570
  },
581
571
  "displayType": {
582
572
  "title": "Display Type",
583
573
  "type": "integer",
584
- "minimum": 0,
585
574
  "maximum": 7,
586
575
  "description": "Select the characteristic type to be displayed in HomeKit.",
587
576
  "anyOf": [
@@ -656,7 +645,6 @@
656
645
  "displayType": {
657
646
  "title": "Display Type",
658
647
  "type": "integer",
659
- "minimum": 0,
660
648
  "maximum": 7,
661
649
  "description": "Select the characteristic type to be displayed in HomeKit.",
662
650
  "anyOf": [
@@ -707,7 +695,6 @@
707
695
  "mode": {
708
696
  "title": "Mode",
709
697
  "type": "integer",
710
- "minimum": 0,
711
698
  "maximum": 40,
712
699
  "description": "Function, VH - Vane Horizontal, VV - Vane Vertical.",
713
700
  "anyOf": [
@@ -952,8 +939,7 @@
952
939
  "properties": {
953
940
  "id": {
954
941
  "title": "Id",
955
- "type": "string",
956
- "default": "0"
942
+ "type": "string"
957
943
  },
958
944
  "type": {
959
945
  "title": "Type",
@@ -969,7 +955,6 @@
969
955
  "displayType": {
970
956
  "title": "Display Type",
971
957
  "type": "integer",
972
- "minimum": 0,
973
958
  "maximum": 2,
974
959
  "description": "Select accessory control type displayed in HomeKit.",
975
960
  "anyOf": [
@@ -990,7 +975,6 @@
990
975
  "hideZone": {
991
976
  "title": "Hide zone",
992
977
  "type": "integer",
993
- "minimum": 0,
994
978
  "maximum": 15,
995
979
  "description": "Select zone to hidde in HomeKit, if present.",
996
980
  "anyOf": [
@@ -1184,13 +1168,11 @@
1184
1168
  "properties": {
1185
1169
  "id": {
1186
1170
  "title": "Id",
1187
- "type": "string",
1188
- "default": "0"
1171
+ "type": "string"
1189
1172
  },
1190
1173
  "displayType": {
1191
1174
  "title": "Display Type",
1192
1175
  "type": "integer",
1193
- "minimum": 0,
1194
1176
  "maximum": 7,
1195
1177
  "description": "Select the characteristic type to be displayed in HomeKit.",
1196
1178
  "anyOf": [
@@ -1261,13 +1243,11 @@
1261
1243
  "properties": {
1262
1244
  "id": {
1263
1245
  "title": "Id",
1264
- "type": "string",
1265
- "default": "0"
1246
+ "type": "string"
1266
1247
  },
1267
1248
  "displayType": {
1268
1249
  "title": "Display Type",
1269
1250
  "type": "integer",
1270
- "minimum": 0,
1271
1251
  "maximum": 7,
1272
1252
  "description": "Select the characteristic type to be displayed in HomeKit.",
1273
1253
  "anyOf": [
@@ -1338,13 +1318,11 @@
1338
1318
  "properties": {
1339
1319
  "id": {
1340
1320
  "title": "Id",
1341
- "type": "string",
1342
- "default": "0"
1321
+ "type": "string"
1343
1322
  },
1344
1323
  "displayType": {
1345
1324
  "title": "Display Type",
1346
1325
  "type": "integer",
1347
- "minimum": 0,
1348
1326
  "maximum": 7,
1349
1327
  "description": "Select the characteristic type to be displayed in HomeKit.",
1350
1328
  "anyOf": [
@@ -1416,7 +1394,6 @@
1416
1394
  "displayType": {
1417
1395
  "title": "Display Type",
1418
1396
  "type": "integer",
1419
- "minimum": 0,
1420
1397
  "maximum": 7,
1421
1398
  "description": "Select the characteristic type to be displayed in HomeKit.",
1422
1399
  "anyOf": [
@@ -1467,7 +1444,6 @@
1467
1444
  "mode": {
1468
1445
  "title": "Mode",
1469
1446
  "type": "integer",
1470
- "minimum": 0,
1471
1447
  "maximum": 70,
1472
1448
  "description": "Select the function.",
1473
1449
  "anyOf": [
@@ -1634,8 +1610,7 @@
1634
1610
  "properties": {
1635
1611
  "id": {
1636
1612
  "title": "Id",
1637
- "type": "string",
1638
- "default": "0"
1613
+ "type": "string"
1639
1614
  },
1640
1615
  "type": {
1641
1616
  "title": "Type",
@@ -1651,7 +1626,6 @@
1651
1626
  "displayType": {
1652
1627
  "title": "Display Type",
1653
1628
  "type": "integer",
1654
- "minimum": 0,
1655
1629
  "maximum": 2,
1656
1630
  "description": "Select accessory control type displayed in HomeKit.",
1657
1631
  "anyOf": [
@@ -1722,14 +1696,11 @@
1722
1696
  "properties": {
1723
1697
  "id": {
1724
1698
  "title": "Id",
1725
- "type": "string",
1726
- "default": "0",
1727
- "readonly": true
1699
+ "type": "string"
1728
1700
  },
1729
1701
  "displayType": {
1730
1702
  "title": "Display Type",
1731
1703
  "type": "integer",
1732
- "minimum": 0,
1733
1704
  "maximum": 7,
1734
1705
  "description": "Select the characteristic type to be displayed in HomeKit.",
1735
1706
  "anyOf": [
@@ -1803,13 +1774,11 @@
1803
1774
  "properties": {
1804
1775
  "id": {
1805
1776
  "title": "Id",
1806
- "type": "string",
1807
- "default": "0"
1777
+ "type": "string"
1808
1778
  },
1809
1779
  "displayType": {
1810
1780
  "title": "Display Type",
1811
1781
  "type": "integer",
1812
- "minimum": 0,
1813
1782
  "maximum": 7,
1814
1783
  "description": "Select the characteristic type to be displayed in HomeKit.",
1815
1784
  "anyOf": [
@@ -1880,13 +1849,11 @@
1880
1849
  "properties": {
1881
1850
  "id": {
1882
1851
  "title": "Id",
1883
- "type": "string",
1884
- "default": "0"
1852
+ "type": "string"
1885
1853
  },
1886
1854
  "displayType": {
1887
1855
  "title": "Display Type",
1888
1856
  "type": "integer",
1889
- "minimum": 0,
1890
1857
  "maximum": 7,
1891
1858
  "description": "Select the characteristic type to be displayed in HomeKit.",
1892
1859
  "anyOf": [
@@ -1958,7 +1925,6 @@
1958
1925
  "displayType": {
1959
1926
  "title": "Display Type",
1960
1927
  "type": "integer",
1961
- "minimum": 0,
1962
1928
  "maximum": 7,
1963
1929
  "description": "Select the characteristic type to be displayed in HomeKit.",
1964
1930
  "anyOf": [
@@ -2009,7 +1975,6 @@
2009
1975
  "mode": {
2010
1976
  "title": "Mode",
2011
1977
  "type": "integer",
2012
- "minimum": 0,
2013
1978
  "maximum": 18,
2014
1979
  "description": "Select the function.",
2015
1980
  "anyOf": [
@@ -77,7 +77,7 @@
77
77
  <div class="mb-2">
78
78
  <label for="accountType" class="form-label">Account Type</label>
79
79
  <select id="accountType" name="accountType" class="form-control">
80
- <option value="disabled">None/Disabled</option>
80
+ <option value="disabled">Disabled</option>
81
81
  <option value="melcloud">MELCloud</option>
82
82
  <option value="melcloudhome">MELCloud Home</option>
83
83
  </select>
@@ -322,9 +322,7 @@
322
322
  if (!presetIds.has(presetId)) {
323
323
  const presetObj = {
324
324
  id: presetId,
325
- displayType: 0,
326
- name: preset.NumberDescription || `Preset ${index}`,
327
- namePrefix: false
325
+ name: preset.NumberDescription || `Preset ${index}`
328
326
  };
329
327
  deviceInConfig.presets.push(presetObj);
330
328
  newPresets.push(presetObj);
@@ -344,9 +342,7 @@
344
342
  if (!scheduleIds.has(scheduleId)) {
345
343
  const scheduleObj = {
346
344
  id: scheduleId,
347
- displayType: 0,
348
- name: `Schedule ${index}`,
349
- namePrefix: false
345
+ name: `Schedule ${index}`
350
346
  };
351
347
  deviceInConfig.schedules.push(scheduleObj);
352
348
  newSchedules.push(scheduleObj);
@@ -363,9 +359,7 @@
363
359
  if (!sceneIds.has(sceneId)) {
364
360
  const sceneObj = {
365
361
  id: sceneId,
366
- displayType: 0,
367
- name: scene.Name || `Scene ${index}`,
368
- namePrefix: false
362
+ name: scene.Name || `Scene ${index}`
369
363
  };
370
364
  deviceInConfig.scenes.push(sceneObj);
371
365
  newScenes.push(sceneObj);
package/index.js CHANGED
@@ -115,13 +115,15 @@ class MelCloudPlatform {
115
115
  //start account impulse generator
116
116
  await melcloud.impulseGenerator.state(true, timmers, false);
117
117
 
118
- //configured devices
119
- const ataDevices = (account.ataDevices || []).filter(device => device.id != null && String(device.id) !== '0');
120
- const atwDevices = (account.atwDevices || []).filter(device => device.id != null && String(device.id) !== '0');
121
- const ervDevices = (account.ervDevices || []).filter(device => device.id != null && String(device.id) !== '0');
118
+ //filter configured devices
119
+ const devicesIds = (melcloudDevicesList.Devices ?? []).map(d => String(d.DeviceID));
120
+ const ataDevices = (account.ataDevices || []).filter(d => (d.displayType ?? 0) > 0 && devicesIds.includes(p.id));
121
+ const atwDevices = (account.atwDevices || []).filter(d => (d.displayType ?? 0) > 0 && devicesIds.includes(p.id));
122
+ const ervDevices = (account.ervDevices || []).filter(d => (d.displayType ?? 0) > 0 && devicesIds.includes(p.id));
122
123
  const devices = [...ataDevices, ...atwDevices, ...ervDevices];
123
124
  if (logLevel.debug) log.info(`${name}, found configured devices ATA: ${ataDevices.length}, ATW: ${atwDevices.length}, ERV: ${ervDevices.length}.`);
124
125
 
126
+ //loop through devices
125
127
  for (const [index, device] of devices.entries()) {
126
128
  device.id = String(device.id);
127
129
  const deviceName = device.name;
@@ -129,31 +131,20 @@ class MelCloudPlatform {
129
131
  const deviceTypeString = DeviceType[device.type];
130
132
  const defaultTempsFile = `${prefDir}/${name}_${device.id}_Temps`;
131
133
 
132
- //chack device is not disabled in config
133
- const displayType = device.displayType;
134
- if (!displayType) {
135
- if (logLevel.warn) log.warn(`${name}, ${deviceTypeString}, ${deviceName}, disabled in configuration, will not be published in the Home app.`);
136
- continue;
137
- }
138
-
139
- //chack device from config exist on melcloud
134
+ //device in melcloud
140
135
  const deviceInMelCloud = melcloudDevicesList.Devices.find(d => d.DeviceID === device.id);
141
- if (!deviceInMelCloud) {
142
- if (logLevel.warn) log.warn(`${name}, ${deviceTypeString}, ${deviceName}, not exist on server, please login to MELCLoud from plugin UI to fix this issue.`);
143
- continue;
144
- }
145
136
 
146
137
  //presets
147
138
  const presetIds = (deviceInMelCloud.Presets ?? []).map(p => String(p.ID));
148
- const presets = account.type === 'melcloud' ? (device.presets || []).filter(p => (p.displayType ?? 0) > 0 && p.id !== '0' && presetIds.includes(p.id)) : [];
139
+ const presets = account.type === 'melcloud' ? (device.presets || []).filter(p => (p.displayType ?? 0) > 0 && presetIds.includes(p.id)) : [];
149
140
 
150
141
  //schedules
151
142
  const schedulesIds = (deviceInMelCloud.Schedule ?? []).map(s => String(s.Id));
152
- const schedules = account.type === 'melcloudhome' ? (device.schedules || []).filter(s => (s.displayType ?? 0) > 0 && s.id !== '0' && schedulesIds.includes(s.id)) : [];
143
+ const schedules = account.type === 'melcloudhome' ? (device.schedules || []).filter(s => (s.displayType ?? 0) > 0 && schedulesIds.includes(s.id)) : [];
153
144
 
154
145
  //scenes
155
146
  const scenesIds = (melcloudDevicesList.Scenes ?? []).map(s => String(s.Id));
156
- const scenes = account.type === 'melcloudhome' ? (device.scenes || []).filter(s => (s.displayType ?? 0) > 0 && s.id !== '0' && scenesIds.includes(s.id)) : [];
147
+ const scenes = account.type === 'melcloudhome' ? (device.scenes || []).filter(s => (s.displayType ?? 0) > 0 && scenesIds.includes(s.id)) : [];
157
148
 
158
149
  //buttons
159
150
  const buttons = (device.buttonsSensors || []).filter(b => (b.displayType ?? 0) > 0);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.5.9-beta.2",
4
+ "version": "4.5.9-beta.4",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",