homebridge-melcloud-control 3.0.7-beta.28 → 3.0.7-beta.3

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.
@@ -1437,213 +1437,231 @@
1437
1437
  "type": "tabarray",
1438
1438
  "title": "{{ value.name || 'account' }}",
1439
1439
  "items": [
1440
- "accounts[].name",
1441
- "accounts[].user",
1442
1440
  {
1443
- "key": "accounts[].passwd",
1444
- "type": "password"
1441
+ "key": "accounts[]",
1442
+ "type": "section",
1443
+ "title": "MELCloud Credentials",
1444
+ "expandable": true,
1445
+ "expanded": false,
1446
+ "items": [
1447
+ "accounts[].name",
1448
+ "accounts[].user",
1449
+ {
1450
+ "key": "accounts[].passwd",
1451
+ "type": "password"
1452
+ },
1453
+ "accounts[].language"
1454
+ ]
1445
1455
  },
1446
- "accounts[].language",
1447
1456
  {
1448
1457
  "key": "accounts[]",
1449
- "type": "tabarray",
1450
- "title": "{{ value.title }}",
1458
+ "type": "section",
1459
+ "title": "Devices",
1460
+ "expandable": true,
1461
+ "expanded": false,
1451
1462
  "items": [
1452
1463
  {
1453
1464
  "key": "accounts[]",
1454
- "title": "Air Conditioner",
1465
+ "type": "tabarray",
1466
+ "title": "{{ value.title }}",
1455
1467
  "items": [
1456
1468
  {
1457
- "key": "accounts[].ataDevices",
1458
- "type": "tabarray",
1459
- "title": "{{ value.name }}",
1469
+ "key": "accounts[]",
1470
+ "title": "Air Conditioner",
1460
1471
  "items": [
1461
1472
  {
1462
- "key": "accounts[].ataDevices[].id",
1463
- "readonly": true
1464
- },
1465
- {
1466
- "key": "accounts[].ataDevices[].type",
1467
- "readonly": true
1468
- },
1469
- {
1470
- "key": "accounts[].ataDevices[]",
1471
- "type": "section",
1472
- "title": "Configuration",
1473
- "expandable": true,
1474
- "expanded": false,
1475
- "items": [
1476
- "accounts[].ataDevices[].name",
1477
- "accounts[].ataDevices[].displayMode",
1478
- "accounts[].ataDevices[].heatDryFanMode",
1479
- "accounts[].ataDevices[].coolDryFanMode",
1480
- "accounts[].ataDevices[].autoDryFanMode",
1481
- "accounts[].ataDevices[].presets"
1482
- ]
1483
- },
1484
- {
1485
- "key": "accounts[].ataDevices[]",
1486
- "type": "section",
1487
- "title": "Temperature Sensors",
1488
- "expandable": true,
1489
- "expanded": false,
1490
- "items": [
1491
- "accounts[].ataDevices[].temperatureSensor",
1492
- "accounts[].ataDevices[].temperatureSensorOutdoor"
1493
- ]
1494
- },
1495
- {
1496
- "key": "accounts[].ataDevices[]",
1497
- "type": "section",
1498
- "title": "Buttons / Sensors",
1499
- "expandable": true,
1500
- "expanded": false,
1473
+ "key": "accounts[].ataDevices",
1474
+ "type": "tabarray",
1475
+ "title": "{{ value.name }}",
1501
1476
  "items": [
1502
1477
  {
1503
- "key": "accounts[].ataDevices[].buttonsSensors",
1504
- "type": "tabarray",
1505
- "title": "{{ value.name || 'button/sensor' }}",
1478
+ "key": "accounts[].ataDevices[].id",
1479
+ "readonly": true
1480
+ },
1481
+ {
1482
+ "key": "accounts[].ataDevices[].type",
1483
+ "readonly": true
1484
+ },
1485
+ {
1486
+ "key": "accounts[].ataDevices[]",
1487
+ "type": "section",
1488
+ "title": "Device Config",
1489
+ "expandable": true,
1490
+ "expanded": false,
1491
+ "items": [
1492
+ "accounts[].ataDevices[].name",
1493
+ "accounts[].ataDevices[].displayMode",
1494
+ "accounts[].ataDevices[].heatDryFanMode",
1495
+ "accounts[].ataDevices[].coolDryFanMode",
1496
+ "accounts[].ataDevices[].autoDryFanMode",
1497
+ "accounts[].ataDevices[].presets"
1498
+ ]
1499
+ },
1500
+ {
1501
+ "key": "accounts[].ataDevices[]",
1502
+ "type": "section",
1503
+ "title": "Temperature Sensors",
1504
+ "expandable": true,
1505
+ "expanded": false,
1506
1506
  "items": [
1507
- "accounts[].ataDevices[].buttonsSensors[].name",
1508
- "accounts[].ataDevices[].buttonsSensors[].mode",
1509
- "accounts[].ataDevices[].buttonsSensors[].displayType",
1510
- "accounts[].ataDevices[].buttonsSensors[].namePrefix"
1507
+ "accounts[].ataDevices[].temperatureSensor",
1508
+ "accounts[].ataDevices[].temperatureSensorOutdoor"
1509
+ ]
1510
+ },
1511
+ {
1512
+ "key": "accounts[].ataDevices[]",
1513
+ "type": "section",
1514
+ "title": "Buttons / Sensors",
1515
+ "expandable": true,
1516
+ "expanded": false,
1517
+ "items": [
1518
+ {
1519
+ "key": "accounts[].ataDevices[].buttonsSensors",
1520
+ "type": "tabarray",
1521
+ "title": "{{ value.name || 'button/sensor' }}",
1522
+ "items": [
1523
+ "accounts[].ataDevices[].buttonsSensors[].name",
1524
+ "accounts[].ataDevices[].buttonsSensors[].mode",
1525
+ "accounts[].ataDevices[].buttonsSensors[].displayType",
1526
+ "accounts[].ataDevices[].buttonsSensors[].namePrefix"
1527
+ ]
1528
+ }
1511
1529
  ]
1512
1530
  }
1513
1531
  ]
1514
1532
  }
1515
1533
  ]
1516
- }
1517
- ]
1518
- },
1519
- {
1520
- "key": "accounts[]",
1521
- "title": "Heat Pump",
1522
- "items": [
1534
+ },
1523
1535
  {
1524
- "key": "accounts[].atwDevices",
1525
- "type": "tabarray",
1526
- "title": "{{ value.name }}",
1536
+ "key": "accounts[]",
1537
+ "title": "Heat Pump",
1527
1538
  "items": [
1528
1539
  {
1529
- "key": "accounts[].atwDevices[].id",
1530
- "readonly": true
1531
- },
1532
- {
1533
- "key": "accounts[].atwDevices[].type",
1534
- "readonly": true
1535
- },
1536
- {
1537
- "key": "accounts[].atwDevices[]",
1538
- "type": "section",
1539
- "title": "Configuration",
1540
- "expandable": true,
1541
- "expanded": false,
1542
- "items": [
1543
- "accounts[].atwDevices[].name",
1544
- "accounts[].atwDevices[].displayMode",
1545
- "accounts[].atwDevices[].presets"
1546
- ]
1547
- },
1548
- {
1549
- "key": "accounts[].atwDevices[]",
1550
- "type": "section",
1551
- "title": "Temperature Sensors",
1552
- "expandable": true,
1553
- "expanded": false,
1554
- "items": [
1555
- "accounts[].atwDevices[].temperatureSensor",
1556
- "accounts[].atwDevices[].temperatureSensorFlow",
1557
- "accounts[].atwDevices[].temperatureSensorReturn",
1558
- "accounts[].atwDevices[].temperatureSensorFlowZone1",
1559
- "accounts[].atwDevices[].temperatureSensorReturnZone1",
1560
- "accounts[].atwDevices[].temperatureSensorFlowWaterTank",
1561
- "accounts[].atwDevices[].temperatureSensorReturnWaterTank",
1562
- "accounts[].atwDevices[].temperatureSensorFlowZone2",
1563
- "accounts[].atwDevices[].temperatureSensorReturnZone2"
1564
- ]
1565
- },
1566
- {
1567
- "key": "accounts[].atwDevices[]",
1568
- "type": "section",
1569
- "title": "Buttons / Sensors",
1570
- "expandable": true,
1571
- "expanded": false,
1540
+ "key": "accounts[].atwDevices",
1541
+ "type": "tabarray",
1542
+ "title": "{{ value.name }}",
1572
1543
  "items": [
1573
1544
  {
1574
- "key": "accounts[].atwDevices[].buttonsSensors",
1575
- "type": "tabarray",
1576
- "title": "{{ value.name || 'button/sensor' }}",
1545
+ "key": "accounts[].atwDevices[].id",
1546
+ "readonly": true
1547
+ },
1548
+ {
1549
+ "key": "accounts[].atwDevices[].type",
1550
+ "readonly": true
1551
+ },
1552
+ {
1553
+ "key": "accounts[].atwDevices[]",
1554
+ "type": "section",
1555
+ "title": "Device Config",
1556
+ "expandable": true,
1557
+ "expanded": false,
1558
+ "items": [
1559
+ "accounts[].atwDevices[].name",
1560
+ "accounts[].atwDevices[].displayMode",
1561
+ "accounts[].atwDevices[].presets"
1562
+ ]
1563
+ },
1564
+ {
1565
+ "key": "accounts[].atwDevices[]",
1566
+ "type": "section",
1567
+ "title": "Temperature Sensors",
1568
+ "expandable": true,
1569
+ "expanded": false,
1570
+ "items": [
1571
+ "accounts[].atwDevices[].temperatureSensor",
1572
+ "accounts[].atwDevices[].temperatureSensorFlow",
1573
+ "accounts[].atwDevices[].temperatureSensorReturn",
1574
+ "accounts[].atwDevices[].temperatureSensorFlowZone1",
1575
+ "accounts[].atwDevices[].temperatureSensorReturnZone1",
1576
+ "accounts[].atwDevices[].temperatureSensorFlowWaterTank",
1577
+ "accounts[].atwDevices[].temperatureSensorReturnWaterTank",
1578
+ "accounts[].atwDevices[].temperatureSensorFlowZone2",
1579
+ "accounts[].atwDevices[].temperatureSensorReturnZone2"
1580
+ ]
1581
+ },
1582
+ {
1583
+ "key": "accounts[].atwDevices[]",
1584
+ "type": "section",
1585
+ "title": "Buttons / Sensors",
1586
+ "expandable": true,
1587
+ "expanded": false,
1577
1588
  "items": [
1578
- "accounts[].atwDevices[].buttonsSensors[].name",
1579
- "accounts[].atwDevices[].buttonsSensors[].mode",
1580
- "accounts[].atwDevices[].buttonsSensors[].displayType",
1581
- "accounts[].atwDevices[].buttonsSensors[].namePrefix"
1589
+ {
1590
+ "key": "accounts[].atwDevices[].buttonsSensors",
1591
+ "type": "tabarray",
1592
+ "title": "{{ value.name || 'button/sensor' }}",
1593
+ "items": [
1594
+ "accounts[].atwDevices[].buttonsSensors[].name",
1595
+ "accounts[].atwDevices[].buttonsSensors[].mode",
1596
+ "accounts[].atwDevices[].buttonsSensors[].displayType",
1597
+ "accounts[].atwDevices[].buttonsSensors[].namePrefix"
1598
+ ]
1599
+ }
1582
1600
  ]
1583
1601
  }
1584
1602
  ]
1585
1603
  }
1586
1604
  ]
1587
- }
1588
- ]
1589
- },
1590
- {
1591
- "key": "accounts[]",
1592
- "title": "Energy Recovery Ventilation",
1593
- "items": [
1605
+ },
1594
1606
  {
1595
- "key": "accounts[].ervDevices",
1596
- "type": "tabarray",
1597
- "title": "{{ value.name }}",
1607
+ "key": "accounts[]",
1608
+ "title": "Energy Recovery Ventilation",
1598
1609
  "items": [
1599
1610
  {
1600
- "key": "accounts[].ervDevices[].id",
1601
- "readonly": true
1602
- },
1603
- {
1604
- "key": "accounts[].ervDevices[].type",
1605
- "readonly": true
1606
- },
1607
- {
1608
- "key": "accounts[].ervDevices[]",
1609
- "type": "section",
1610
- "title": "Configuration",
1611
- "expandable": true,
1612
- "expanded": false,
1613
- "items": [
1614
- "accounts[].ervDevices[].name",
1615
- "accounts[].ervDevices[].displayMode",
1616
- "accounts[].ervDevices[].presets"
1617
- ]
1618
- },
1619
- {
1620
- "key": "accounts[].ervDevices[]",
1621
- "type": "section",
1622
- "title": "Temperature Sensors",
1623
- "expandable": true,
1624
- "expanded": false,
1625
- "items": [
1626
- "accounts[].ervDevices[].temperatureSensor",
1627
- "accounts[].ervDevices[].temperatureSensorOutdoor",
1628
- "accounts[].ervDevices[].temperatureSensorSupply"
1629
- ]
1630
- },
1631
- {
1632
- "key": "accounts[].ervDevices[]",
1633
- "type": "section",
1634
- "title": "Buttons / Sensors",
1635
- "expandable": true,
1636
- "expanded": false,
1611
+ "key": "accounts[].ervDevices",
1612
+ "type": "tabarray",
1613
+ "title": "{{ value.name }}",
1637
1614
  "items": [
1638
1615
  {
1639
- "key": "accounts[].ervDevices[].buttonsSensors",
1640
- "type": "tabarray",
1641
- "title": "{{ value.name || 'button/sensor' }}",
1616
+ "key": "accounts[].ervDevices[].id",
1617
+ "readonly": true
1618
+ },
1619
+ {
1620
+ "key": "accounts[].ervDevices[].type",
1621
+ "readonly": true
1622
+ },
1623
+ {
1624
+ "key": "accounts[].ervDevices[]",
1625
+ "type": "section",
1626
+ "title": "Device Config",
1627
+ "expandable": true,
1628
+ "expanded": false,
1629
+ "items": [
1630
+ "accounts[].ervDevices[].name",
1631
+ "accounts[].ervDevices[].displayMode",
1632
+ "accounts[].ervDevices[].presets"
1633
+ ]
1634
+ },
1635
+ {
1636
+ "key": "accounts[].ervDevices[]",
1637
+ "type": "section",
1638
+ "title": "Temperature Sensors",
1639
+ "expandable": true,
1640
+ "expanded": false,
1641
+ "items": [
1642
+ "accounts[].ervDevices[].temperatureSensor",
1643
+ "accounts[].ervDevices[].temperatureSensorOutdoor",
1644
+ "accounts[].ervDevices[].temperatureSensorSupply"
1645
+ ]
1646
+ },
1647
+ {
1648
+ "key": "accounts[].ervDevices[]",
1649
+ "type": "section",
1650
+ "title": "Buttons / Sensors",
1651
+ "expandable": true,
1652
+ "expanded": false,
1642
1653
  "items": [
1643
- "accounts[].ervDevices[].buttonsSensors[].name",
1644
- "accounts[].ervDevices[].buttonsSensors[].mode",
1645
- "accounts[].ervDevices[].buttonsSensors[].displayType",
1646
- "accounts[].ervDevices[].buttonsSensors[].namePrefix"
1654
+ {
1655
+ "key": "accounts[].ervDevices[].buttonsSensors",
1656
+ "type": "tabarray",
1657
+ "title": "{{ value.name || 'button/sensor' }}",
1658
+ "items": [
1659
+ "accounts[].ervDevices[].buttonsSensors[].name",
1660
+ "accounts[].ervDevices[].buttonsSensors[].mode",
1661
+ "accounts[].ervDevices[].buttonsSensors[].displayType",
1662
+ "accounts[].ervDevices[].buttonsSensors[].namePrefix"
1663
+ ]
1664
+ }
1647
1665
  ]
1648
1666
  }
1649
1667
  ]
@@ -1651,20 +1669,13 @@
1651
1669
  ]
1652
1670
  }
1653
1671
  ]
1654
- }
1655
- ]
1656
- },
1657
- {
1658
- "key": "accounts[]",
1659
- "type": "section",
1660
- "title": "Advanced Settings",
1661
- "expandable": true,
1662
- "expanded": false,
1663
- "items": [
1672
+ },
1664
1673
  {
1665
1674
  "key": "accounts[]",
1666
- "type": "tabarray",
1667
- "title": "{{ value.name }}",
1675
+ "type": "section",
1676
+ "title": "System",
1677
+ "expandable": true,
1678
+ "expanded": false,
1668
1679
  "items": [
1669
1680
  {
1670
1681
  "key": "accounts[]",
@@ -1,13 +1,13 @@
1
- <div style="text-align: center;">
2
- </divstyle>
3
- <img src="homebridge-melcloud-control.png" alt="Image" height="120" />
4
- </div><br>
5
-
1
+ <div>
2
+ <img src="homebridge-melcloud-control.png" style="text-align: center;" height="150" />
3
+ </div>
4
+ <div id="accounts">
5
+ </div>
6
6
  <div id="melCloudAccount" style="display: none;" class="card card-body">
7
7
  <form id="configForm">
8
8
  <div class="text-center">
9
9
  <label id="accountName" style="font-size: 23px">Account</label><br>
10
- <label id="info" style="text-align: center; font-size: 17px;"></label><br>
10
+ <label id="info" style="text-align: center; font-size: 17px;">MELCloud</label><br><br>
11
11
  </div>
12
12
  <div class="form-group">
13
13
  <label for="name">Name</label>
@@ -44,14 +44,12 @@
44
44
  <option value="23">Hrvatski</option>
45
45
  <option value="24">Română</option>
46
46
  <option value="25">Slovenščina</option>
47
- </select><br>
47
+ </select>
48
48
  </div>
49
49
  <div class="text-center">
50
50
  <button id="logIn" type="button" class="btn btn-primary">Connect to MELCloud</button>
51
51
  <button id="configButton" type="button" class="btn btn-primary"><i class="fas fa-gear"></i></button>
52
52
  </div>
53
- <div id="accountButton">
54
- </div>
55
53
  </form>
56
54
  </div>
57
55
 
@@ -76,9 +74,8 @@
76
74
  button.setAttribute("type", "button");
77
75
  button.setAttribute("id", `button${i}`);
78
76
  button.setAttribute("class", "btn btn-primary");
79
- button.style.textTransform = 'none';
80
77
  button.innerText = pluginConfig[0].accounts[i].name;
81
- document.getElementById("accountButton").appendChild(button);
78
+ document.getElementById("accounts").appendChild(button);
82
79
 
83
80
  //get actuall value on account select
84
81
  document.getElementById(`button${i}`).addEventListener('click', async () => {
@@ -150,23 +147,15 @@
150
147
  const info = response.info ?? '';
151
148
  const status = response.status;
152
149
  const devices = response.data ?? [];
153
- const newDevices = {
154
- ata: [],
155
- atw: [],
156
- erv: []
157
- };
158
- let textAta = 'ATA: 0';
159
- let textAtw = 'ATW: 0';
160
- let textErv = 'ERV: 0';
150
+ const newDevices = [];
161
151
 
162
152
  switch (status) {
163
153
  case 0:
164
154
  //get device info fom devices
165
- devices.forEach((device, index) => {
166
- const deviceType = device.Type;
167
- const deviceId = device.DeviceID;
168
- const deviceName = device.DeviceName;
169
- const deviceTypeText = ["Air Conditioner", "Heat Pump", "Unknown", "Energy Recovery Ventilation"][device.Type];
155
+ devices.forEach((deviceInfo, index) => {
156
+ const deviceType = deviceInfo.Type;
157
+ const deviceId = deviceInfo.DeviceID;
158
+ const deviceName = deviceInfo.DeviceName;
170
159
 
171
160
  //config account keys
172
161
  const accountKeys = Object.keys(pluginConfig[0].accounts[this.deviceIndex]);
@@ -176,7 +165,7 @@
176
165
  const deviceAta = {
177
166
  name: deviceName,
178
167
  id: deviceId,
179
- type: deviceTypeText,
168
+ type: deviceType,
180
169
  displayMode: 0,
181
170
  heatDryFanMode: 0,
182
171
  coolDryFanMode: 0,
@@ -191,9 +180,7 @@
191
180
  const ataDevices = ataDevicesExist ? pluginConfig[0].accounts[this.deviceIndex].ataDevices : pluginConfig[0].accounts[this.deviceIndex].ataDevices = [];
192
181
  const ataDeviceIdExist = ataDevices.some(device => device.id === deviceId);
193
182
  const pushTypeAta = ataDeviceIdExist ? false : ataDevices.push(deviceAta);
194
- const pushNewDevice = ataDeviceIdExist ? false : newDevices.ata.push(device);
195
- const devicesCount = newDevices.ata.length;
196
- textAta = `ATA: ${devicesCount}`
183
+ const pushNewDevice = ataDeviceIdExist ? false : newDevices.push(deviceId);
197
184
  };
198
185
 
199
186
  //devices atw
@@ -201,7 +188,7 @@
201
188
  const deviceAtw = {
202
189
  name: deviceName,
203
190
  id: deviceId,
204
- type: deviceTypeText,
191
+ type: deviceType,
205
192
  displayMode: 0,
206
193
  temperatureSensor: false,
207
194
  temperatureSensorFlow: false,
@@ -221,9 +208,7 @@
221
208
  const atwDevices = atwDevicesExist ? pluginConfig[0].accounts[this.deviceIndex].atwDevices : pluginConfig[0].accounts[this.deviceIndex].atwDevices = [];
222
209
  const atwDeviceIdExist = atwDevices.some(device => device.id === deviceId);
223
210
  const pushTypeatw = atwDeviceIdExist ? false : atwDevices.push(deviceAtw);
224
- const pushNewDevice = atwDeviceIdExist ? false : newDevices.atw.push(device);
225
- const devicesCount = newDevices.ata.length;
226
- textAtw = `ATW: ${devicesCount}`
211
+ const pushNewDevice = atwDeviceIdExist ? false : newDevices.push(deviceId);
227
212
  };
228
213
 
229
214
  //devices erv
@@ -231,7 +216,7 @@
231
216
  const deviceErv = {
232
217
  name: deviceName,
233
218
  id: deviceId,
234
- type: deviceTypeText,
219
+ type: deviceType,
235
220
  displayMode: 0,
236
221
  temperatureSensor: false,
237
222
  temperatureSensorOutdoor: false,
@@ -245,14 +230,12 @@
245
230
  const ervDevices = ervDevicesExist ? pluginConfig[0].accounts[this.deviceIndex].ervDevices : pluginConfig[0].accounts[this.deviceIndex].ervDevices = [];
246
231
  const ervDeviceIdExist = ervDevices.some(device => device.id === deviceId);
247
232
  const pushTypeerv = ervDeviceIdExist ? false : ervDevices.push(deviceErv);
248
- const pushNewDevice = ervDeviceIdExist ? false : newDevices.erv.push(device);
249
- const devicesCount = newDevices.ata.length;
250
- textErv = `ERV: ${devicesCount}`
233
+ const pushNewDevice = ervDeviceIdExist ? false : newDevices.push(deviceId);
251
234
  };
252
235
  });
253
236
 
254
- const newDevicesCount = newDevices.ata.length + newDevices.atw.length + newDevices.erv.length;
255
- document.getElementById('info').innerHTML = `Found in MELCloud, ${textAta}, ${textAtw}, ${textErv}. ${newDevicesCount === 0 ? '' : 'Now You can start to configure it.'}`;
237
+ const devicesCount = newDevices.length;
238
+ document.getElementById('info').innerHTML = `Check devices complete, found ${devicesCount} ${devicesCount !== 1 ? 'new devices' : 'new device'}. ${devicesCount === 0 ? '' : 'Now You can start to configure it.'}`;
256
239
  document.getElementById('info').style.color = 'green';
257
240
 
258
241
  await homebridge.updatePluginConfig(pluginConfig);
@@ -38,8 +38,7 @@ class PluginUiServer extends HomebridgePluginUiServer {
38
38
  } catch (error) {
39
39
  return data = {
40
40
  info: error,
41
- status: 1,
42
- data: data
41
+ status: 1
43
42
  };
44
43
  };
45
44
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "3.0.7-beta.28",
4
+ "version": "3.0.7-beta.3",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",