homebridge-melcloud-control 3.0.7-beta.2 → 3.0.7-beta.21

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,22 +1437,13 @@
1437
1437
  "type": "tabarray",
1438
1438
  "title": "{{ value.name || 'account' }}",
1439
1439
  "items": [
1440
+ "accounts[].name",
1441
+ "accounts[].user",
1440
1442
  {
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
- ]
1443
+ "key": "accounts[].passwd",
1444
+ "type": "password"
1455
1445
  },
1446
+ "accounts[].language",
1456
1447
  {
1457
1448
  "key": "accounts[]",
1458
1449
  "type": "tabarray",
@@ -1660,50 +1651,72 @@
1660
1651
  ]
1661
1652
  }
1662
1653
  ]
1663
- },
1664
- {
1665
- "key": "accounts[]",
1666
- "title": "System",
1667
- "items": [
1668
- "accounts[].enableDebugMode",
1669
- "accounts[].disableLogInfo",
1670
- "accounts[].disableLogDeviceInfo",
1671
- "accounts[].refreshInterval",
1672
- "accounts[].deviceRefreshInterval"
1673
- ]
1674
- },
1654
+ }
1655
+ ]
1656
+ },
1657
+ {
1658
+ "key": "accounts[]",
1659
+ "type": "section",
1660
+ "title": "Advanced Settings",
1661
+ "expandable": true,
1662
+ "expanded": false,
1663
+ "items": [
1675
1664
  {
1676
1665
  "key": "accounts[]",
1677
- "title": "External Integrations",
1666
+ "type": "tabarray",
1667
+ "title": "{{ value.name }}",
1678
1668
  "items": [
1679
1669
  {
1680
1670
  "key": "accounts[]",
1681
- "type": "tabarray",
1682
- "title": "{{ value.title }}",
1671
+ "title": "Data Refresh",
1672
+ "items": [
1673
+ "accounts[].refreshInterval",
1674
+ "accounts[].deviceRefreshInterval"
1675
+ ]
1676
+ },
1677
+ {
1678
+ "key": "accounts[]",
1679
+ "title": "Log",
1680
+ "items": [
1681
+ "accounts[].enableDebugMode",
1682
+ "accounts[].disableLogInfo",
1683
+ "accounts[].disableLogDeviceInfo"
1684
+ ]
1685
+ },
1686
+ {
1687
+ "key": "accounts[]",
1688
+ "title": "External Integrations",
1683
1689
  "items": [
1684
1690
  {
1685
- "key": "accounts[].restFul",
1686
- "title": "RESTFul",
1687
- "items": [
1688
- "accounts[].restFul.enable",
1689
- "accounts[].restFul.debug"
1690
- ]
1691
- },
1692
- {
1693
- "key": "accounts[].mqtt",
1694
- "title": "MQTT",
1691
+ "key": "accounts[]",
1692
+ "type": "tabarray",
1693
+ "title": "{{ value.title }}",
1695
1694
  "items": [
1696
- "accounts[].mqtt.enable",
1697
- "accounts[].mqtt.debug",
1698
- "accounts[].mqtt.host",
1699
- "accounts[].mqtt.port",
1700
- "accounts[].mqtt.clientId",
1701
- "accounts[].mqtt.prefix",
1702
- "accounts[].mqtt.auth",
1703
- "accounts[].mqtt.user",
1704
1695
  {
1705
- "key": "accounts[].mqtt.passwd",
1706
- "type": "password"
1696
+ "key": "accounts[].restFul",
1697
+ "title": "RESTFul",
1698
+ "items": [
1699
+ "accounts[].restFul.enable",
1700
+ "accounts[].restFul.debug"
1701
+ ]
1702
+ },
1703
+ {
1704
+ "key": "accounts[].mqtt",
1705
+ "title": "MQTT",
1706
+ "items": [
1707
+ "accounts[].mqtt.enable",
1708
+ "accounts[].mqtt.debug",
1709
+ "accounts[].mqtt.host",
1710
+ "accounts[].mqtt.port",
1711
+ "accounts[].mqtt.clientId",
1712
+ "accounts[].mqtt.prefix",
1713
+ "accounts[].mqtt.auth",
1714
+ "accounts[].mqtt.user",
1715
+ {
1716
+ "key": "accounts[].mqtt.passwd",
1717
+ "type": "password"
1718
+ }
1719
+ ]
1707
1720
  }
1708
1721
  ]
1709
1722
  }
@@ -1,13 +1,15 @@
1
- <div>
2
- <img src="homebridge-melcloud-control.png" style="text-align: center;" height="150" />
1
+ <div style="text-align: center;"></divstyle>
2
+ <img src="homebridge-melcloud-control.png" alt="Image" height="150" />
3
3
  </div>
4
+
4
5
  <div id="accounts">
5
6
  </div>
7
+
6
8
  <div id="melCloudAccount" style="display: none;" class="card card-body">
7
9
  <form id="configForm">
8
10
  <div class="text-center">
9
11
  <label id="accountName" style="font-size: 23px">Account</label><br>
10
- <label id="info" style="text-align: center; font-size: 17px;">MELCloud</label><br><br>
12
+ <label id="info" style="text-align: center; font-size: 17px;"></label><br>
11
13
  </div>
12
14
  <div class="form-group">
13
15
  <label for="name">Name</label>
@@ -44,7 +46,7 @@
44
46
  <option value="23">Hrvatski</option>
45
47
  <option value="24">Română</option>
46
48
  <option value="25">Slovenščina</option>
47
- </select>
49
+ </select><br>
48
50
  </div>
49
51
  <div class="text-center">
50
52
  <button id="logIn" type="button" class="btn btn-primary">Connect to MELCloud</button>
@@ -147,15 +149,23 @@
147
149
  const info = response.info ?? '';
148
150
  const status = response.status;
149
151
  const devices = response.data ?? [];
150
- const newDevices = [];
152
+ const newDevices = {
153
+ ata: [],
154
+ atw: [],
155
+ erv: []
156
+ };
157
+ let textAta = 'ATA: 0';
158
+ let textAtw = 'ATW: 0';
159
+ let textErv = 'ERV: 0';
151
160
 
152
161
  switch (status) {
153
162
  case 0:
154
163
  //get device info fom devices
155
- devices.forEach((deviceInfo, index) => {
156
- const deviceType = deviceInfo.Type;
157
- const deviceId = deviceInfo.DeviceID;
158
- const deviceName = deviceInfo.DeviceName;
164
+ devices.forEach((device, index) => {
165
+ const deviceType = device.Type;
166
+ const deviceId = device.DeviceID;
167
+ const deviceName = device.DeviceName;
168
+ const deviceTypeText = ["Air Conditioner", "Heat Pump", "Unknown", "Energy Recovery Ventilation"][device.Type];
159
169
 
160
170
  //config account keys
161
171
  const accountKeys = Object.keys(pluginConfig[0].accounts[this.deviceIndex]);
@@ -165,7 +175,7 @@
165
175
  const deviceAta = {
166
176
  name: deviceName,
167
177
  id: deviceId,
168
- type: deviceType,
178
+ type: deviceTypeText,
169
179
  displayMode: 0,
170
180
  heatDryFanMode: 0,
171
181
  coolDryFanMode: 0,
@@ -180,7 +190,9 @@
180
190
  const ataDevices = ataDevicesExist ? pluginConfig[0].accounts[this.deviceIndex].ataDevices : pluginConfig[0].accounts[this.deviceIndex].ataDevices = [];
181
191
  const ataDeviceIdExist = ataDevices.some(device => device.id === deviceId);
182
192
  const pushTypeAta = ataDeviceIdExist ? false : ataDevices.push(deviceAta);
183
- const pushNewDevice = ataDeviceIdExist ? false : newDevices.push(deviceId);
193
+ const pushNewDevice = ataDeviceIdExist ? false : newDevices.ata.push(device);
194
+ const devicesCount = newDevices.ata.length;
195
+ textAta = `ATA: ${devicesCount}`
184
196
  };
185
197
 
186
198
  //devices atw
@@ -188,7 +200,7 @@
188
200
  const deviceAtw = {
189
201
  name: deviceName,
190
202
  id: deviceId,
191
- type: deviceType,
203
+ type: deviceTypeText,
192
204
  displayMode: 0,
193
205
  temperatureSensor: false,
194
206
  temperatureSensorFlow: false,
@@ -208,7 +220,9 @@
208
220
  const atwDevices = atwDevicesExist ? pluginConfig[0].accounts[this.deviceIndex].atwDevices : pluginConfig[0].accounts[this.deviceIndex].atwDevices = [];
209
221
  const atwDeviceIdExist = atwDevices.some(device => device.id === deviceId);
210
222
  const pushTypeatw = atwDeviceIdExist ? false : atwDevices.push(deviceAtw);
211
- const pushNewDevice = atwDeviceIdExist ? false : newDevices.push(deviceId);
223
+ const pushNewDevice = atwDeviceIdExist ? false : newDevices.atw.push(device);
224
+ const devicesCount = newDevices.ata.length;
225
+ textAtw = `ATW: ${devicesCount}`
212
226
  };
213
227
 
214
228
  //devices erv
@@ -216,7 +230,7 @@
216
230
  const deviceErv = {
217
231
  name: deviceName,
218
232
  id: deviceId,
219
- type: deviceType,
233
+ type: deviceTypeText,
220
234
  displayMode: 0,
221
235
  temperatureSensor: false,
222
236
  temperatureSensorOutdoor: false,
@@ -230,12 +244,14 @@
230
244
  const ervDevices = ervDevicesExist ? pluginConfig[0].accounts[this.deviceIndex].ervDevices : pluginConfig[0].accounts[this.deviceIndex].ervDevices = [];
231
245
  const ervDeviceIdExist = ervDevices.some(device => device.id === deviceId);
232
246
  const pushTypeerv = ervDeviceIdExist ? false : ervDevices.push(deviceErv);
233
- const pushNewDevice = ervDeviceIdExist ? false : newDevices.push(deviceId);
247
+ const pushNewDevice = ervDeviceIdExist ? false : newDevices.erv.push(device);
248
+ const devicesCount = newDevices.ata.length;
249
+ textErv = `ERV: ${devicesCount}`
234
250
  };
235
251
  });
236
252
 
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.'}`;
253
+ const newDevicesCount = newDevices.ata.length + newDevices.atw.length + newDevices.erv.length;
254
+ document.getElementById('info').innerHTML = `Found in MELCloud, ${textAta}, ${textAtw}, ${textErv}. ${newDevicesCount === 0 ? '' : 'Now You can start to configure it.'}`;
239
255
  document.getElementById('info').style.color = 'green';
240
256
 
241
257
  await homebridge.updatePluginConfig(pluginConfig);
@@ -38,7 +38,8 @@ class PluginUiServer extends HomebridgePluginUiServer {
38
38
  } catch (error) {
39
39
  return data = {
40
40
  info: error,
41
- status: 1
41
+ status: 1,
42
+ data: data
42
43
  };
43
44
  };
44
45
  };
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.2",
4
+ "version": "3.0.7-beta.21",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",