homebridge-melcloud-control 4.1.2-beta.18 → 4.1.2-beta.19

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/melcloud.js +8 -22
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.18",
4
+ "version": "4.1.2-beta.19",
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/melcloud.js CHANGED
@@ -282,34 +282,20 @@ class MelCloud extends EventEmitter {
282
282
  DeviceType: type
283
283
  };
284
284
 
285
- // Usuń stare pola Settings i Capabilities
286
- const { Settings, Capabilities, Id, GivenDisplayName, ...rest } = device;
287
-
288
285
  // Kapitalizacja brakujących obiektów/tablic
289
- const capitalizedRest = { ...rest };
290
-
291
- if (capitalizedRest.frostProtection) {
292
- capitalizedRest.FrostProtection = { ...capitalizeKeys(device.frostProtection || {}) };
293
- delete capitalizedRest.frostProtection;
294
- }
286
+ if (device.FrostProtection) device.FrostProtection = { ...capitalizeKeys(device.FrostProtection || {}) };
287
+ if (device.OverheatProtection) device.OverheatProtection = { ...capitalizeKeys(device.OverheatProtection || {}) };
288
+ if (device.HolidayMode) device.HolidayMode = { ...capitalizeKeys(device.HolidayMode || {}) };
295
289
 
296
- if (capitalizedRest.overheatProtection) {
297
- capitalizedRest.OverheatProtection = { ...capitalizeKeys(device.overheatProtection || {}) };
298
- delete capitalizedRest.overheatProtection;
290
+ if (Array.isArray(device.Schedule)) {
291
+ device.Schedule = device.Schedule.map(capitalizeKeysDeep);
299
292
  }
300
293
 
301
- if (capitalizedRest.holidayMode) {
302
- capitalizedRest.HolidayMode = { ...capitalizeKeys(device.HolidayMode || {}) };
303
- delete capitalizedRest.holidayMode;
304
- }
305
-
306
- if (Array.isArray(capitalizedRest.schedule)) {
307
- capitalizedRest.Schedule = capitalizedRest.schedule.map(capitalizeKeysDeep);
308
- delete capitalizedRest.schedule;
309
- }
294
+ // Usuń stare pola Settings i Capabilities
295
+ const { Settings, Capabilities, Id, GivenDisplayName, FrostProtection, OverheatProtection, HolidayMode, Schedule, ...rest } = device;
310
296
 
311
297
  return {
312
- ...capitalizedRest,
298
+ ...rest,
313
299
  Type: type,
314
300
  DeviceID: Id,
315
301
  DeviceName: GivenDisplayName,