homebridge-melcloud-control 4.1.2-beta.1 → 4.1.2-beta.10

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.
package/README.md CHANGED
@@ -229,7 +229,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
229
229
  | `ataDevices[].frostProtectionSensor` | This enable extra `Frost Protectio` sensor to use with automations in HomeKit app. |
230
230
  | `ataDevices[].overHeatProtectionSensor` | This enable extra `Overheat Protection` sensor to use with automations in HomeKit app. |
231
231
  | `ataDevices[].holidayModeSensor` | This enable extra `Holiday Mode` sensor to use with automations in HomeKit app. |
232
- | `ataDevices[].sheduleSensor` | This enable extra `Shedule` sensor to use with automations in HomeKit app. |
232
+ | `ataDevices[].scheduleSensor` | This enable extra `Shedule` sensor to use with automations in HomeKit app. |
233
233
  | `ataDevices[].errorSensor` | This enable `Error` sensor to use with automations in HomeKit app. |
234
234
  | `ataDevices[].refreshInterval` | Here set the background devices state refresh time in (sec), default `5s`. |
235
235
  | `ataDevices[].presets[]` | Array of ATA device Presets created automatically after login to MELCloud from plugin config UI. |
@@ -235,8 +235,7 @@
235
235
  "properties": {
236
236
  "id": {
237
237
  "title": "ID",
238
- "type": "string",
239
- "default": "0"
238
+ "type": "string"
240
239
  },
241
240
  "type": {
242
241
  "title": "Type",
@@ -279,7 +278,7 @@
279
278
  "name": {
280
279
  "title": "Name",
281
280
  "type": "string",
282
- "default": "Air Conditioner"
281
+ "placeholder": "Device name"
283
282
  },
284
283
  "heatDryFanMode": {
285
284
  "title": "Heat",
@@ -401,7 +400,7 @@
401
400
  "default": false,
402
401
  "description": "This enable extra frost protection sensor to use with automations in HomeKit app.",
403
402
  "condition": {
404
- "functionBody": "return model.accounts[arrayIndices[0]].type === melcloudhome;"
403
+ "functionBody": "return model.accounts[arrayIndices[0]].type === 'melcloudhome';"
405
404
  }
406
405
  },
407
406
  "overheatProtectionSensor": {
@@ -422,11 +421,11 @@
422
421
  "functionBody": "return model.accounts[arrayIndices[0]].type === 'melcloudhome';"
423
422
  }
424
423
  },
425
- "sheduleSensor": {
424
+ "scheduleSensor": {
426
425
  "title": "Shedule",
427
426
  "type": "boolean",
428
427
  "default": false,
429
- "description": "This enable extra shedule sensor to use with automations in HomeKit app.",
428
+ "description": "This enable extra schedule sensor to use with automations in HomeKit app.",
430
429
  "condition": {
431
430
  "functionBody": "return model.accounts[arrayIndices[0]].type === 'melcloudhome';"
432
431
  }
@@ -453,7 +452,7 @@
453
452
  "properties": {
454
453
  "id": {
455
454
  "title": "ID",
456
- "type": "integer"
455
+ "type": "string"
457
456
  },
458
457
  "displayType": {
459
458
  "title": "Display Type",
@@ -840,8 +839,7 @@
840
839
  "properties": {
841
840
  "id": {
842
841
  "title": "ID",
843
- "type": "string",
844
- "default": "0"
842
+ "type": "string"
845
843
  },
846
844
  "type": {
847
845
  "title": "Type",
@@ -856,7 +854,7 @@
856
854
  "name": {
857
855
  "title": "Name",
858
856
  "type": "string",
859
- "default": "Heat Pump"
857
+ "placeholder": "Device name"
860
858
  },
861
859
  "displayType": {
862
860
  "title": "Display Type",
@@ -1068,7 +1066,7 @@
1068
1066
  "properties": {
1069
1067
  "id": {
1070
1068
  "title": "ID",
1071
- "type": "integer"
1069
+ "type": "string"
1072
1070
  },
1073
1071
  "displayType": {
1074
1072
  "title": "Display Type",
@@ -1375,8 +1373,7 @@
1375
1373
  "properties": {
1376
1374
  "id": {
1377
1375
  "title": "ID",
1378
- "type": "string",
1379
- "default": "0"
1376
+ "type": "string"
1380
1377
  },
1381
1378
  "type": {
1382
1379
  "title": "Type",
@@ -1391,7 +1388,7 @@
1391
1388
  "name": {
1392
1389
  "title": "Name",
1393
1390
  "type": "string",
1394
- "default": "Ventilation"
1391
+ "placeholder": "Device name"
1395
1392
  },
1396
1393
  "displayType": {
1397
1394
  "title": "Display Type",
@@ -1461,7 +1458,7 @@
1461
1458
  "properties": {
1462
1459
  "id": {
1463
1460
  "title": "ID",
1464
- "type": "integer",
1461
+ "type": "string",
1465
1462
  "readonly": true
1466
1463
  },
1467
1464
  "displayType": {
@@ -1976,7 +1973,7 @@
1976
1973
  "accounts[].ataDevices[].frostProtectionSensor",
1977
1974
  "accounts[].ataDevices[].overheatProtectionSensor",
1978
1975
  "accounts[].ataDevices[].holidayModeSensor",
1979
- "accounts[].ataDevices[].sheduleSensor",
1976
+ "accounts[].ataDevices[].scheduleSensor",
1980
1977
  "accounts[].ataDevices[].errorSensor"
1981
1978
  ]
1982
1979
  },
@@ -2007,7 +2004,7 @@
2007
2004
  }
2008
2005
  ],
2009
2006
  "condition": {
2010
- "functionBody": "return model.accounts[arrayIndices[0]].ataDevices[arrayIndices[1]].id !== '0';"
2007
+ "functionBody": "return model.accounts[arrayIndices[0]].ataDevices[arrayIndices[1]].id !== null;"
2011
2008
  }
2012
2009
  }
2013
2010
  ]
@@ -2127,7 +2124,7 @@
2127
2124
  }
2128
2125
  ],
2129
2126
  "condition": {
2130
- "functionBody": "return model.accounts[arrayIndices[0]].atwDevices[arrayIndices[1]].id !== '0';"
2127
+ "functionBody": "return model.accounts[arrayIndices[0]].atwDevices[arrayIndices[1]].id !== null;"
2131
2128
  }
2132
2129
  }
2133
2130
  ]
@@ -2240,7 +2237,7 @@
2240
2237
  }
2241
2238
  ],
2242
2239
  "condition": {
2243
- "functionBody": "return model.accounts[arrayIndices[0]].ervDevices[arrayIndices[1]].id !== '0';"
2240
+ "functionBody": "return model.accounts[arrayIndices[0]].ervDevices[arrayIndices[1]].id !== null;"
2244
2241
  }
2245
2242
  }
2246
2243
  ]
@@ -224,8 +224,6 @@
224
224
 
225
225
  document.getElementById('logIn').addEventListener('click', async () => {
226
226
  document.getElementById(`logIn`).className = "btn btn-primary";
227
-
228
- updateInfo('info', 'Connecting...', 'yellow');
229
227
  homebridge.showSpinner();
230
228
 
231
229
  try {
@@ -272,17 +270,19 @@
272
270
  newArr.push(deviceObj);
273
271
  }
274
272
 
275
- const presets = device.Presets || [];
276
- presets.forEach(preset => {
273
+ const presetsKey = account.type === 'melcloud' ? 'Presets' : 'Schedule';
274
+ const presetsIdKey = account.type === 'melcloud' ? 'ID' : 'Id';
275
+ const presets = device[presetsKey] || [];
276
+ presets.forEach((preset, index) => {
277
277
  const presetObj = {
278
- id: preset.ID,
278
+ id: preset[presetsIdKey],
279
279
  displayType: 0,
280
- name: preset.NumberDescription,
280
+ name: preset.NumberDescription || `Preset ${index}`,
281
281
  namePrefix: false
282
282
  };
283
283
 
284
284
  const deviceInConfig = devicesInConfig.find(device => String(device.id) === deviceObj.id);
285
- if (deviceInConfig && !deviceInConfig.presets.some(preset => preset.id === presetObj.id)) {
285
+ if (deviceInConfig && !deviceInConfig.presets.some(preset => String(preset.id) === presetObj.id)) {
286
286
  deviceInConfig.presets.push(presetObj);
287
287
  newPresets.push(presetObj);
288
288
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.1.2-beta.1",
4
+ "version": "4.1.2-beta.10",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
package/src/deviceata.js CHANGED
@@ -32,7 +32,7 @@ class DeviceAta extends EventEmitter {
32
32
  this.frostProtectionSensor = device.frostProtectionSensor || false;
33
33
  this.overheatProtectionSensor = device.overheatProtectionSensor || false;
34
34
  this.holidayModeSensor = device.holidayModeSensor || false;
35
- this.sheduleSensor = device.sheduleSensor || false;
35
+ this.scheduleSensor = device.scheduleSensor || false;
36
36
  this.errorSensor = device.errorSensor || false;
37
37
  this.heatDryFanMode = device.heatDryFanMode || 1; //NONE, HEAT, DRY, FAN
38
38
  this.coolDryFanMode = device.coolDryFanMode || 1; //NONE, COOL, DRY, FAN
@@ -651,18 +651,18 @@ class DeviceAta extends EventEmitter {
651
651
  accessory.addService(this.holidayModeSensorService);
652
652
  }
653
653
 
654
- //shedule sensor
655
- if (this.sheduleSensor && this.accessory.sheduleEnabled !== null) {
656
- if (this.logDebug) this.emit('debug', `Prepare shedule service`);
657
- this.sheduleSensorService = new Service.ContactSensor(`${serviceName} Shedule`, `Shedule Sensor ${deviceId}`);
658
- this.sheduleSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
659
- this.sheduleSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Shedule`);
660
- this.sheduleSensorService.getCharacteristic(Characteristic.ContactSensorState)
654
+ //schedule sensor
655
+ if (this.scheduleSensor && this.accessory.scheduleEnabled !== null) {
656
+ if (this.logDebug) this.emit('debug', `Prepare schedule service`);
657
+ this.scheduleSensorService = new Service.ContactSensor(`${serviceName} Schedule`, `Schedule Sensor ${deviceId}`);
658
+ this.scheduleSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
659
+ this.scheduleSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Schedule`);
660
+ this.scheduleSensorService.getCharacteristic(Characteristic.ContactSensorState)
661
661
  .onGet(async () => {
662
- const state = this.accessory.sheduleEnabled;
662
+ const state = this.accessory.scheduleEnabled;
663
663
  return state;
664
664
  })
665
- accessory.addService(this.sheduleSensorService);
665
+ accessory.addService(this.scheduleSensorService);
666
666
  }
667
667
 
668
668
  //error sensor
@@ -683,8 +683,9 @@ class DeviceAta extends EventEmitter {
683
683
  if (this.presets.length > 0) {
684
684
  if (this.logDebug) this.emit('debug', `Prepare presets services`);
685
685
  this.presetsServices = [];
686
+ const presetsIdKey = this.accountType === 'melcloud' ? 'ID' : 'Id';
686
687
  this.presets.forEach((preset, i) => {
687
- const presetData = presetsOnServer.find(p => p.ID === preset.Id);
688
+ const presetData = presetsOnServer.find(p => p[presetsIdKey] === preset.id);
688
689
 
689
690
  //get preset name
690
691
  const name = preset.name;
@@ -705,6 +706,7 @@ class DeviceAta extends EventEmitter {
705
706
  })
706
707
  .onSet(async (state) => {
707
708
  try {
709
+ const setTempKey = this.accountType === 'melcloud' ? 'SetTemperature' : 'SetPoint';
708
710
  const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
709
711
  switch (state) {
710
712
  case true:
@@ -764,7 +766,7 @@ class DeviceAta extends EventEmitter {
764
766
  })
765
767
  .onSet(async (state) => {
766
768
  try {
767
- const key = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
769
+ const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
768
770
  let effectiveFlags = null;
769
771
  switch (mode) {
770
772
  case 0: //POWER ON,OFF
@@ -1015,6 +1017,9 @@ class DeviceAta extends EventEmitter {
1015
1017
  this.deviceData = deviceData;
1016
1018
 
1017
1019
  //keys
1020
+ const presetsKey = this.accountType === 'melcloud' ? 'Presets' : 'Schedule';
1021
+ const presetsIdKey = this.accountType === 'melcloud' ? 'ID' : 'Id';
1022
+ const setTempKey = this.accountType === 'melcloud' ? 'SetTemperature' : 'SetPoint';
1018
1023
  const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
1019
1024
  const tempStepKey = this.accountType === 'melcloud' ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
1020
1025
  const errorKey = this.accountType === 'melcloud' ? 'HasError' : 'IsInError';
@@ -1026,17 +1031,17 @@ class DeviceAta extends EventEmitter {
1026
1031
  const supportDryKey = this.accountType === 'melcloud' ? 'ModelSupportsDry' : 'HasDryOperationMode';
1027
1032
  const supportCoolKey = this.accountType === 'melcloud' ? 'ModelSupportsCool' : 'HasCoolOperationMode';
1028
1033
 
1029
- //presets
1030
- const presetsOnServer = deviceData.Presets ?? [];
1034
+ //presets schedule
1035
+ const presetsOnServer = deviceData[presetsKey] ?? [];
1031
1036
 
1032
1037
  //protection
1033
- const frostProtectionEnabled = deviceData.FrostProtection?.enabled;
1034
- const frostProtectionActive = deviceData.FrostProtection?.active;
1035
- const overheatProtectionEnabled = deviceData.OverheatProtection?.enabled;
1036
- const overheatProtectionActive = deviceData.OverheatProtection?.active;
1037
- const holidayModeEnabled = deviceData.HolidayMode?.enabled;
1038
- const holidayModeActive = deviceData.HolidayMode?.active;
1039
- const sheduleEnabled = deviceData.ScheduleEnabled;
1038
+ const frostProtectionEnabled = deviceData.FrostProtection?.Enabled;
1039
+ const frostProtectionActive = deviceData.FrostProtection?.Active;
1040
+ const overheatProtectionEnabled = deviceData.OverheatProtection?.Enabled;
1041
+ const overheatProtectionActive = deviceData.OverheatProtection?.Active;
1042
+ const holidayModeEnabled = deviceData.HolidayMode?.Enabled;
1043
+ const holidayModeActive = deviceData.HolidayMode?.Active;
1044
+ const scheduleEnabled = deviceData.ScheduleEnabled;
1040
1045
 
1041
1046
  //device control
1042
1047
  const hideVaneControls = deviceData.HideVaneControls ?? false;
@@ -1129,7 +1134,7 @@ class DeviceAta extends EventEmitter {
1129
1134
  overheatProtectionActive: overheatProtectionActive,
1130
1135
  holidayModeEnabled: holidayModeEnabled,
1131
1136
  holidayModeActive: holidayModeActive,
1132
- sheduleEnabled: sheduleEnabled
1137
+ scheduleEnabled: scheduleEnabled
1133
1138
  };
1134
1139
 
1135
1140
  //operating mode 0, HEAT, DRY, COOL, 4, 5, 6, FAN, AUTO, ISEE HEAT, ISEE DRY, ISEE COOL
@@ -1274,16 +1279,16 @@ class DeviceAta extends EventEmitter {
1274
1279
  this.frostProtectionSensorService?.updateCharacteristic(Characteristic.ContactSensorState, frostProtectionActive);
1275
1280
  this.overheatProtectionSensorService?.updateCharacteristic(Characteristic.ContactSensorState, overheatProtectionActive);
1276
1281
  this.holidayModeSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayModeActive);
1277
- this.sheduleSensorService?.updateCharacteristic(Characteristic.ContactSensorState, sheduleEnabled);
1282
+ this.scheduleSensorService?.updateCharacteristic(Characteristic.ContactSensorState, scheduleEnabled);
1278
1283
  this.errorService?.updateCharacteristic(Characteristic.ContactSensorState, isInError);
1279
1284
 
1280
1285
  //update presets state
1281
1286
  if (this.presets.length > 0) {
1282
1287
  this.presets.forEach((preset, i) => {
1283
- const presetData = presetsOnServer.find(p => p.ID === preset.Id);
1288
+ const presetData = presetsOnServer.find(p => p[presetsIdKey] === preset.id);
1284
1289
 
1285
1290
  preset.state = presetData ? (presetData.Power === power
1286
- && presetData.SetTemperature === setTemperature
1291
+ && presetData[setTempKey] === setTemperature
1287
1292
  && presetData.OperationMode === operationMode
1288
1293
  && presetData.VaneHorizontalDirection === vaneHorizontalDirection
1289
1294
  && presetData.VaneVerticalDirection === vaneVerticalDirection
package/src/deviceatw.js CHANGED
@@ -1055,8 +1055,9 @@ class DeviceAtw extends EventEmitter {
1055
1055
  if (this.presets.length > 0) {
1056
1056
  if (this.logDebug) this.emit('debug', `Prepare presets services`);
1057
1057
  this.presetsServices = [];
1058
+ const presetsIdKey = this.accountType === 'melcloud' ? 'ID' : 'Id';
1058
1059
  this.presets.forEach((preset, i) => {
1059
- const presetData = presetsOnServer.find(p => p.ID === preset.Id);
1060
+ const presetData = presetsOnServer.find(p => p[presetsIdKey] === preset.id);
1060
1061
 
1061
1062
  //get preset name
1062
1063
  const name = preset.name;
@@ -1330,11 +1331,13 @@ class DeviceAtw extends EventEmitter {
1330
1331
  this.deviceData = deviceData;
1331
1332
 
1332
1333
  //keys
1334
+ const presetsKey = this.accountType === 'melcloud' ? 'Presets' : 'Schedule';
1335
+ const presetsIdKey = accountType === 'melcloud' ? 'ID' : 'Id';
1333
1336
  const tempStepKey = this.accountType === 'melcloud' ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
1334
1337
  const errorKey = this.accountType === 'melcloud' ? 'HasError' : 'IsInError';
1335
1338
 
1336
1339
  //presets
1337
- const presetsOnServer = deviceData.Presets ?? [];
1340
+ const presetsOnServer = deviceData[presetsKey] ?? [];
1338
1341
 
1339
1342
  //device info
1340
1343
  const hasHeatPump = ![1, 2, 3, 4, 5, 6, 7, 15].includes(this.hideZone);
@@ -1816,7 +1819,7 @@ class DeviceAtw extends EventEmitter {
1816
1819
  //update presets state
1817
1820
  if (this.presets.length > 0) {
1818
1821
  this.presets.forEach((preset, i) => {
1819
- const presetData = presetsOnServer.find(p => p.ID === preset.Id);
1822
+ const presetData = presetsOnServer.find(p => p[presetsIdKey] === preset.id);
1820
1823
 
1821
1824
  preset.state = presetData ? (presetData.Power === power
1822
1825
  && presetData.EcoHotWater === ecoHotWater
package/src/deviceerv.js CHANGED
@@ -675,7 +675,7 @@ class DeviceErv extends EventEmitter {
675
675
  if (this.logDebug) this.emit('debug', `Prepare presets services`);
676
676
  this.presetsServices = [];
677
677
  this.presets.forEach((preset, i) => {
678
- const presetData = presetsOnServer.find(p => p.ID === preset.Id);
678
+ const presetData = presetsOnServer.find(p => p.ID === preset.id);
679
679
 
680
680
  //get preset name
681
681
  const name = preset.name;
@@ -876,12 +876,14 @@ class DeviceErv extends EventEmitter {
876
876
  this.deviceData = deviceData;
877
877
 
878
878
  //keys
879
+ const presetsKey = this.accountType === 'melcloud' ? 'Presets' : 'Schedule';
880
+ const presetsIdKey = accountType === 'melcloud' ? 'ID' : 'Id';
879
881
  const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
880
882
  const tempStepKey = this.accountType === 'melcloud' ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
881
883
  const errorKey = this.accountType === 'melcloud' ? 'HasError' : 'IsInError';
882
884
 
883
885
  //presets
884
- const presetsOnServer = deviceData.Presets ?? [];
886
+ const presetsOnServer = deviceData[presetsKey] ?? [];
885
887
 
886
888
  //device control
887
889
  const hideRoomTemperature = deviceData.HideRoomTemperature;
@@ -1113,7 +1115,7 @@ class DeviceErv extends EventEmitter {
1113
1115
  //update presets state
1114
1116
  if (this.presets.length > 0) {
1115
1117
  this.presets.forEach((preset, i) => {
1116
- const presetData = presetsOnServer.find(p => p.ID === preset.Id);
1118
+ const presetData = presetsOnServer.find(p => p[presetsIdKey] === preset.id);
1117
1119
 
1118
1120
  preset.state = presetData ? (presetData.Power === power
1119
1121
  && presetData.SetTemperature === setTemperature
package/src/melcloud.js CHANGED
@@ -235,18 +235,26 @@ class MelCloud extends EventEmitter {
235
235
  if (this.logDebug) this.emit('debug', `Buildings list saved`);
236
236
 
237
237
  const devices = buildingsList.flatMap(building => {
238
- // Funkcja kapitalizująca klucze obiektu
239
- const capitalizeKeys = obj =>
240
- Object.fromEntries(
241
- Object.entries(obj).map(([key, value]) => [
242
- key.charAt(0).toUpperCase() + key.slice(1),
243
- value
244
- ])
245
- );
238
+ // Rekurencyjna funkcja kapitalizująca klucze w całym obiekcie
239
+ const capitalizeKeysDeep = obj => {
240
+ if (Array.isArray(obj)) {
241
+ return obj.map(item => capitalizeKeysDeep(item));
242
+ } else if (obj && typeof obj === 'object' && obj.constructor === Object) {
243
+ return Object.fromEntries(
244
+ Object.entries(obj).map(([key, value]) => {
245
+ const safeKey =
246
+ typeof key === 'string'
247
+ ? key.charAt(0).toUpperCase() + key.slice(1)
248
+ : key;
249
+ return [safeKey, capitalizeKeysDeep(value)];
250
+ })
251
+ );
252
+ }
253
+ return obj;
254
+ };
246
255
 
247
256
  // Funkcja tworząca finalny obiekt Device
248
257
  const createDevice = (device, type) => {
249
- // Settings już kapitalizowane w nazwach
250
258
  const settingsArray = device.Settings || [];
251
259
 
252
260
  const settingsObject = Object.fromEntries(
@@ -258,21 +266,22 @@ class MelCloud extends EventEmitter {
258
266
 
259
267
  const key = name.charAt(0).toUpperCase() + name.slice(1);
260
268
  return [key, parsedValue];
261
- })
262
- );
269
+ }))
270
+
263
271
 
264
- // Scal Capabilities + Settings + DeviceType w Device
272
+ // Połącz Capabilities + Settings + DeviceType
265
273
  const deviceObject = {
266
- ...capitalizeKeys(device.Capabilities || {}),
274
+ ...capitalizeKeysDeep(device.Capabilities || {}),
267
275
  ...settingsObject,
268
276
  DeviceType: type
269
277
  };
270
278
 
271
- // Usuń stare pola Settings i Capabilities
279
+ // Usuń pola, które nie mają trafić do finalnego obiektu
272
280
  const { Settings, Capabilities, Id, GivenDisplayName, ...rest } = device;
273
281
 
282
+ // Zwróć gotowy obiekt urządzenia
274
283
  return {
275
- ...rest,
284
+ ...capitalizeKeysDeep(rest),
276
285
  Type: type,
277
286
  DeviceID: Id,
278
287
  DeviceName: GivenDisplayName,
@@ -281,10 +290,11 @@ class MelCloud extends EventEmitter {
281
290
  };
282
291
  };
283
292
 
293
+ // Mapowanie urządzeń w budynku
284
294
  return [
285
- ...(building.airToAirUnits || []).map(d => createDevice(capitalizeKeys(d), 0)),
286
- ...(building.airToWaterUnits || []).map(d => createDevice(capitalizeKeys(d), 1)),
287
- ...(building.airToVentilationUnits || []).map(d => createDevice(capitalizeKeys(d), 3))
295
+ ...(building.airToAirUnits || []).map(d => createDevice(capitalizeKeysDeep(d), 0)),
296
+ ...(building.airToWaterUnits || []).map(d => createDevice(capitalizeKeysDeep(d), 1)),
297
+ ...(building.airToVentilationUnits || []).map(d => createDevice(capitalizeKeysDeep(d), 3))
288
298
  ];
289
299
  });
290
300