homebridge-melcloud-control 4.3.3-beta.17 → 4.3.3-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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.3.3-beta.17",
4
+ "version": "4.3.3-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/functions.js CHANGED
@@ -169,11 +169,14 @@ class Functions extends EventEmitter {
169
169
  }
170
170
 
171
171
  parseArrayNameValue(data) {
172
- Object.fromEntries(
172
+ if (!Array.isArray(data)) return {};
173
+
174
+ return Object.fromEntries(
173
175
  data.map(({ name, value }) => {
174
- let parsedValue = this.convertValue(value);
176
+ const parsedValue = this.convertValue(value);
175
177
  return [name, parsedValue];
176
- }));
178
+ })
179
+ );
177
180
  }
178
181
  }
179
182
  export default Functions
@@ -200,12 +200,12 @@ class MelCloudAta extends EventEmitter {
200
200
  switch (unitId) {
201
201
  case this.deviceId:
202
202
  const messageType = parsedMessage[0].messageType;
203
- const settings = messageData.settings ? this.functions.parseArrayNameValue(messageData.settings) : [];
203
+ const settings = this.functions.parseArrayNameValue(messageData.settings);
204
204
  switch (messageType) {
205
205
  case 'unitStateChanged':
206
206
 
207
207
  //update values
208
- for (const { key, value } of settings) {
208
+ for (const [key, value] of Object.entries(settings)) {
209
209
  if (!this.functions.isValidValue(value)) continue;
210
210
 
211
211
  if (key === 'HolidayMode') {