homebridge-melcloud-control 2.5.0-beta.28 → 2.5.0-beta.29

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.
@@ -205,6 +205,62 @@
205
205
  "description": "Here select the language used in MELCloud account.",
206
206
  "required": true
207
207
  },
208
+ "devices": {
209
+ "title": "Devices",
210
+ "type": "array",
211
+ "items": {
212
+ "type": "object",
213
+ "properties": {
214
+ "name": {
215
+ "title": "Name",
216
+ "type": "string",
217
+ "required": true
218
+ },
219
+ "id": {
220
+ "title": "Mode",
221
+ "type": "integer",
222
+ "description": "Device ID.",
223
+ "required": true
224
+ },
225
+ "type": {
226
+ "title": "Type",
227
+ "type": "integer",
228
+ "description": "Device Type.",
229
+ "required": true
230
+ },
231
+ "displayMode": {
232
+ "title": "Control",
233
+ "type": "integer",
234
+ "minimum": 0,
235
+ "maximum": 2,
236
+ "default": 0,
237
+ "oneOf": [
238
+ {
239
+ "title": "None/Disabled",
240
+ "enum": [
241
+ 0
242
+ ]
243
+ },
244
+ {
245
+ "title": "Heater/Cooler",
246
+ "enum": [
247
+ 0
248
+ ]
249
+ },
250
+ {
251
+ "title": "Thermostat",
252
+ "enum": [
253
+ 1
254
+ ]
255
+ }
256
+ ],
257
+ "description": "Select device control mode displayed in HomeKit app.",
258
+ "required": true
259
+ }
260
+ }
261
+ },
262
+ "required": false
263
+ },
208
264
  "ataDisplayMode": {
209
265
  "title": "Control",
210
266
  "type": "integer",
@@ -148,17 +148,21 @@
148
148
 
149
149
  switch (status) {
150
150
  case 0:
151
+ const devicesCount = devices.length;
152
+ document.getElementById('info').innerHTML = `Success, found ${devicesCount} ${devicesCount !== 1 ? 'devices' : 'device'}. Now You can start to configure it.`;
153
+ document.getElementById('info').style.color = 'green';
154
+
151
155
  //get device info fom devices
152
- for (const deviceInfo of devices) {
156
+ devices.forEach((deviceInfo, index) => {
153
157
  const deviceType = deviceInfo.Type;
154
158
  const deviceId = deviceInfo.DeviceID;
155
159
  const deviceName = deviceInfo.DeviceName;
156
- };
157
160
 
158
- const devicesCount = devices.length;
159
- document.getElementById('info').innerHTML = `Success, found ${devicesCount} ${devicesCount !== 1 ? 'devices' : 'device'}. Now You can start to configure it.`;
160
- document.getElementById('info').style.color = 'green';
161
- document.getElementById('configButton').removeAttribute('disabled');
161
+ const displayMode = pluginConfig[0].accounts[this.deviceIndex].devices[index].displayMode ?? 0;
162
+ const device = { name: deviceName, id: deviceId, type: deviceType, displayMode: displayMode };
163
+ const language = pluginConfig[0].accounts[this.deviceIndex].devices.push(device);
164
+ });
165
+
162
166
  await homebridge.updatePluginConfig(pluginConfig);
163
167
  await homebridge.savePluginConfig(pluginConfig);
164
168
  break;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "2.5.0-beta.28",
4
+ "version": "2.5.0-beta.29",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",