homebridge-melcloud-control 3.0.7-beta.13 → 3.0.7-beta.15

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.
@@ -1466,13 +1466,6 @@
1466
1466
  "key": "accounts[].ataDevices[].type",
1467
1467
  "readonly": true
1468
1468
  },
1469
- {
1470
- "key": "accounts[].ataDevices[]",
1471
- "type": "text",
1472
- "title": "ID and Type",
1473
- "readonly": true,
1474
- "template": "{{ accounts[].ataDevices[].id }} - {{ accounts[].ataDevices[].type }}"
1475
- },
1476
1469
  {
1477
1470
  "key": "accounts[].ataDevices[]",
1478
1471
  "type": "section",
@@ -147,15 +147,23 @@
147
147
  const info = response.info ?? '';
148
148
  const status = response.status;
149
149
  const devices = response.data ?? [];
150
- const newDevices = [];
150
+ const newDevices = {
151
+ ata: [],
152
+ atw: [],
153
+ erv: []
154
+ };
155
+ let textAta = '';
156
+ let textAtw = '';
157
+ let textErv = '';
151
158
 
152
159
  switch (status) {
153
160
  case 0:
154
161
  //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;
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];
159
167
 
160
168
  //config account keys
161
169
  const accountKeys = Object.keys(pluginConfig[0].accounts[this.deviceIndex]);
@@ -165,7 +173,7 @@
165
173
  const deviceAta = {
166
174
  name: deviceName,
167
175
  id: deviceId,
168
- type: deviceType,
176
+ type: deviceTypeText,
169
177
  displayMode: 0,
170
178
  heatDryFanMode: 0,
171
179
  coolDryFanMode: 0,
@@ -180,7 +188,9 @@
180
188
  const ataDevices = ataDevicesExist ? pluginConfig[0].accounts[this.deviceIndex].ataDevices : pluginConfig[0].accounts[this.deviceIndex].ataDevices = [];
181
189
  const ataDeviceIdExist = ataDevices.some(device => device.id === deviceId);
182
190
  const pushTypeAta = ataDeviceIdExist ? false : ataDevices.push(deviceAta);
183
- const pushNewDevice = ataDeviceIdExist ? false : newDevices.push(deviceId);
191
+ const pushNewDevice = ataDeviceIdExist ? false : newDevices.ata.push(device);
192
+ const devicesCount = newDevices.ata.length;
193
+ textAta = `ATA: ${devicesCount}`
184
194
  };
185
195
 
186
196
  //devices atw
@@ -188,7 +198,7 @@
188
198
  const deviceAtw = {
189
199
  name: deviceName,
190
200
  id: deviceId,
191
- type: deviceType,
201
+ type: deviceTypeText,
192
202
  displayMode: 0,
193
203
  temperatureSensor: false,
194
204
  temperatureSensorFlow: false,
@@ -208,7 +218,9 @@
208
218
  const atwDevices = atwDevicesExist ? pluginConfig[0].accounts[this.deviceIndex].atwDevices : pluginConfig[0].accounts[this.deviceIndex].atwDevices = [];
209
219
  const atwDeviceIdExist = atwDevices.some(device => device.id === deviceId);
210
220
  const pushTypeatw = atwDeviceIdExist ? false : atwDevices.push(deviceAtw);
211
- const pushNewDevice = atwDeviceIdExist ? false : newDevices.push(deviceId);
221
+ const pushNewDevice = atwDeviceIdExist ? false : newDevices.atw.push(device);
222
+ const devicesCount = newDevices.ata.length;
223
+ textAtw = `ATW: ${devicesCount}`
212
224
  };
213
225
 
214
226
  //devices erv
@@ -216,7 +228,7 @@
216
228
  const deviceErv = {
217
229
  name: deviceName,
218
230
  id: deviceId,
219
- type: deviceType,
231
+ type: deviceTypeText,
220
232
  displayMode: 0,
221
233
  temperatureSensor: false,
222
234
  temperatureSensorOutdoor: false,
@@ -230,12 +242,14 @@
230
242
  const ervDevices = ervDevicesExist ? pluginConfig[0].accounts[this.deviceIndex].ervDevices : pluginConfig[0].accounts[this.deviceIndex].ervDevices = [];
231
243
  const ervDeviceIdExist = ervDevices.some(device => device.id === deviceId);
232
244
  const pushTypeerv = ervDeviceIdExist ? false : ervDevices.push(deviceErv);
233
- const pushNewDevice = ervDeviceIdExist ? false : newDevices.push(deviceId);
245
+ const pushNewDevice = ervDeviceIdExist ? false : newDevices.erv.push(device);
246
+ const devicesCount = newDevices.ata.length;
247
+ textErv = `ERV: ${devicesCount}`
234
248
  };
235
249
  });
236
250
 
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.'}`;
251
+ const newDevicesCount = newDevices.ata.length + newDevices.atw.length + newDevices.erv.length;
252
+ document.getElementById('info').innerHTML = `Found devices: ${textAta}, ${textAtw}, ${textErv}. ${newDevicesCount === 0 ? '' : 'Now You can start to configure it.'}`;
239
253
  document.getElementById('info').style.color = 'green';
240
254
 
241
255
  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.13",
4
+ "version": "3.0.7-beta.15",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",