homebridge-melcloud-control 3.0.7-beta.18 → 3.0.7-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.
@@ -1437,13 +1437,22 @@
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
1458
  "type": "tabarray",
@@ -1651,72 +1660,50 @@
1651
1660
  ]
1652
1661
  }
1653
1662
  ]
1654
- }
1655
- ]
1656
- },
1657
- {
1658
- "key": "accounts[]",
1659
- "type": "section",
1660
- "title": "Advanced Settings",
1661
- "expandable": true,
1662
- "expanded": false,
1663
- "items": [
1663
+ },
1664
1664
  {
1665
1665
  "key": "accounts[]",
1666
- "type": "tabarray",
1667
- "title": "{{ value.name }}",
1666
+ "title": "System",
1667
+ "items": [
1668
+ "accounts[].enableDebugMode",
1669
+ "accounts[].disableLogInfo",
1670
+ "accounts[].disableLogDeviceInfo",
1671
+ "accounts[].refreshInterval",
1672
+ "accounts[].deviceRefreshInterval"
1673
+ ]
1674
+ },
1675
+ {
1676
+ "key": "accounts[]",
1677
+ "title": "External Integrations",
1668
1678
  "items": [
1669
1679
  {
1670
1680
  "key": "accounts[]",
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",
1681
+ "type": "tabarray",
1682
+ "title": "{{ value.title }}",
1689
1683
  "items": [
1690
1684
  {
1691
- "key": "accounts[]",
1692
- "type": "tabarray",
1693
- "title": "{{ value.title }}",
1685
+ "key": "accounts[].restFul",
1686
+ "title": "RESTFul",
1694
1687
  "items": [
1688
+ "accounts[].restFul.enable",
1689
+ "accounts[].restFul.debug"
1690
+ ]
1691
+ },
1692
+ {
1693
+ "key": "accounts[].mqtt",
1694
+ "title": "MQTT",
1695
+ "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",
1695
1704
  {
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
- ]
1705
+ "key": "accounts[].mqtt.passwd",
1706
+ "type": "password"
1720
1707
  }
1721
1708
  ]
1722
1709
  }
@@ -1,5 +1,5 @@
1
- <div style="text-align: center;"></divstyle>
2
- <img src="homebridge-melcloud-control.png" alt="Image" height="150" />
1
+ <div>
2
+ <img src="homebridge-melcloud-control.png" style="text-align: center;" height="150" />
3
3
  </div>
4
4
  <div id="accounts">
5
5
  </div>
@@ -75,7 +75,7 @@
75
75
  button.setAttribute("id", `button${i}`);
76
76
  button.setAttribute("class", "btn btn-primary");
77
77
  button.innerText = pluginConfig[0].accounts[i].name;
78
- document.getElementById("melCloudAccount").appendChild(button);
78
+ document.getElementById("accounts").appendChild(button);
79
79
 
80
80
  //get actuall value on account select
81
81
  document.getElementById(`button${i}`).addEventListener('click', async () => {
@@ -147,23 +147,15 @@
147
147
  const info = response.info ?? '';
148
148
  const status = response.status;
149
149
  const devices = response.data ?? [];
150
- const newDevices = {
151
- ata: [],
152
- atw: [],
153
- erv: []
154
- };
155
- let textAta = 'ATA: 0';
156
- let textAtw = 'ATW: 0';
157
- let textErv = 'ERV: 0';
150
+ const newDevices = [];
158
151
 
159
152
  switch (status) {
160
153
  case 0:
161
154
  //get device info fom devices
162
- devices.forEach((device, index) => {
163
- const deviceType = device.Type;
164
- const deviceId = device.DeviceID;
165
- const deviceName = device.DeviceName;
166
- 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;
167
159
 
168
160
  //config account keys
169
161
  const accountKeys = Object.keys(pluginConfig[0].accounts[this.deviceIndex]);
@@ -173,7 +165,7 @@
173
165
  const deviceAta = {
174
166
  name: deviceName,
175
167
  id: deviceId,
176
- type: deviceTypeText,
168
+ type: deviceType,
177
169
  displayMode: 0,
178
170
  heatDryFanMode: 0,
179
171
  coolDryFanMode: 0,
@@ -188,9 +180,7 @@
188
180
  const ataDevices = ataDevicesExist ? pluginConfig[0].accounts[this.deviceIndex].ataDevices : pluginConfig[0].accounts[this.deviceIndex].ataDevices = [];
189
181
  const ataDeviceIdExist = ataDevices.some(device => device.id === deviceId);
190
182
  const pushTypeAta = ataDeviceIdExist ? false : ataDevices.push(deviceAta);
191
- const pushNewDevice = ataDeviceIdExist ? false : newDevices.ata.push(device);
192
- const devicesCount = newDevices.ata.length;
193
- textAta = `ATA: ${devicesCount}`
183
+ const pushNewDevice = ataDeviceIdExist ? false : newDevices.push(deviceId);
194
184
  };
195
185
 
196
186
  //devices atw
@@ -198,7 +188,7 @@
198
188
  const deviceAtw = {
199
189
  name: deviceName,
200
190
  id: deviceId,
201
- type: deviceTypeText,
191
+ type: deviceType,
202
192
  displayMode: 0,
203
193
  temperatureSensor: false,
204
194
  temperatureSensorFlow: false,
@@ -218,9 +208,7 @@
218
208
  const atwDevices = atwDevicesExist ? pluginConfig[0].accounts[this.deviceIndex].atwDevices : pluginConfig[0].accounts[this.deviceIndex].atwDevices = [];
219
209
  const atwDeviceIdExist = atwDevices.some(device => device.id === deviceId);
220
210
  const pushTypeatw = atwDeviceIdExist ? false : atwDevices.push(deviceAtw);
221
- const pushNewDevice = atwDeviceIdExist ? false : newDevices.atw.push(device);
222
- const devicesCount = newDevices.ata.length;
223
- textAtw = `ATW: ${devicesCount}`
211
+ const pushNewDevice = atwDeviceIdExist ? false : newDevices.push(deviceId);
224
212
  };
225
213
 
226
214
  //devices erv
@@ -228,7 +216,7 @@
228
216
  const deviceErv = {
229
217
  name: deviceName,
230
218
  id: deviceId,
231
- type: deviceTypeText,
219
+ type: deviceType,
232
220
  displayMode: 0,
233
221
  temperatureSensor: false,
234
222
  temperatureSensorOutdoor: false,
@@ -242,14 +230,12 @@
242
230
  const ervDevices = ervDevicesExist ? pluginConfig[0].accounts[this.deviceIndex].ervDevices : pluginConfig[0].accounts[this.deviceIndex].ervDevices = [];
243
231
  const ervDeviceIdExist = ervDevices.some(device => device.id === deviceId);
244
232
  const pushTypeerv = ervDeviceIdExist ? false : ervDevices.push(deviceErv);
245
- const pushNewDevice = ervDeviceIdExist ? false : newDevices.erv.push(device);
246
- const devicesCount = newDevices.ata.length;
247
- textErv = `ERV: ${devicesCount}`
233
+ const pushNewDevice = ervDeviceIdExist ? false : newDevices.push(deviceId);
248
234
  };
249
235
  });
250
236
 
251
- const newDevicesCount = newDevices.ata.length + newDevices.atw.length + newDevices.erv.length;
252
- 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.'}`;
253
239
  document.getElementById('info').style.color = 'green';
254
240
 
255
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.18",
4
+ "version": "3.0.7-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",