homebridge-melcloud-control 4.10.20-beta.1 → 4.10.20-beta.2

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.10.20-beta.1",
4
+ "version": "4.10.20-beta.2",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -208,7 +208,8 @@ class MelCloudAta extends EventEmitter {
208
208
  path = ApiUrls.Post.UpdateApplicationOptions;
209
209
  break;
210
210
  default: {
211
- const changes = this.functions.filterChanges(payload, deviceData.Device);
211
+ //compare against the API wrapper's own live-polled state, not the caller's closure-captured (possibly stale) deviceData
212
+ const changes = this.functions.filterChanges(payload, this.deviceData.Device);
212
213
  if (Object.keys(changes).length === 0) {
213
214
  if (this.logDebug) this.emit('debug', `Ignore send, no changes: ${JSON.stringify(payload)}`);
214
215
  return true;
@@ -308,7 +309,8 @@ class MelCloudAta extends EventEmitter {
308
309
  payload = {};
309
310
  break;
310
311
  default: {
311
- const changes = this.functions.filterChanges(payload, deviceData.Device);
312
+ //compare against the API wrapper's own live-polled state, not the caller's closure-captured (possibly stale) deviceData
313
+ const changes = this.functions.filterChanges(payload, this.deviceData.Device);
312
314
  if (Object.keys(changes).length === 0) {
313
315
  if (this.logDebug) this.emit('debug', `Ignore send, no changes: ${JSON.stringify(payload)}`);
314
316
  return true;
@@ -340,7 +342,7 @@ class MelCloudAta extends EventEmitter {
340
342
  }
341
343
 
342
344
  //send payload
343
- if (this.logDebug) this.emit('debug', `Send data: ${JSON.stringify(payload, null, 2)}`);
345
+ if (!this.logDebug) this.emit('debug', `Send data: ${JSON.stringify(payload, null, 2)}`);
344
346
  await this.client(path, { method: method, data: payload });
345
347
  return true;
346
348
  default:
@@ -187,7 +187,8 @@ class MelCloudAtw extends EventEmitter {
187
187
  path = ApiUrls.Post.UpdateApplicationOptions;
188
188
  break;
189
189
  default:
190
- if (!this.functions.hasChanges(payload, deviceData.Device)) {
190
+ //compare against the API wrapper's own live-polled state, not the caller's closure-captured (possibly stale) deviceData
191
+ if (!this.functions.hasChanges(payload, this.deviceData.Device)) {
191
192
  if (this.logDebug) this.emit('debug', `Ignore send, no changes: ${JSON.stringify(payload)}`);
192
193
  return true;
193
194
  }
@@ -257,7 +258,8 @@ class MelCloudAtw extends EventEmitter {
257
258
  payload = {};
258
259
  break;
259
260
  default:
260
- if (!this.functions.hasChanges(payload, deviceData.Device)) {
261
+ //compare against the API wrapper's own live-polled state, not the caller's closure-captured (possibly stale) deviceData
262
+ if (!this.functions.hasChanges(payload, this.deviceData.Device)) {
261
263
  if (this.logDebug) this.emit('debug', `Ignore send, no changes: ${JSON.stringify(payload)}`);
262
264
  return true;
263
265
  }
@@ -183,7 +183,8 @@ class MelCloudErv extends EventEmitter {
183
183
  path = ApiUrls.Post.UpdateApplicationOptions;
184
184
  break;
185
185
  default: {
186
- const changes = this.functions.filterChanges(payload, deviceData.Device);
186
+ //compare against the API wrapper's own live-polled state, not the caller's closure-captured (possibly stale) deviceData
187
+ const changes = this.functions.filterChanges(payload, this.deviceData.Device);
187
188
  if (Object.keys(changes).length === 0) {
188
189
  if (this.logDebug) this.emit('debug', `Ignore send, no changes: ${JSON.stringify(payload)}`);
189
190
  return true;
@@ -273,7 +274,8 @@ class MelCloudErv extends EventEmitter {
273
274
  payload = {};
274
275
  break;
275
276
  default: {
276
- const changes = this.functions.filterChanges(payload, deviceData.Device);
277
+ //compare against the API wrapper's own live-polled state, not the caller's closure-captured (possibly stale) deviceData
278
+ const changes = this.functions.filterChanges(payload, this.deviceData.Device);
277
279
  if (Object.keys(changes).length === 0) {
278
280
  if (this.logDebug) this.emit('debug', `Ignore send, no changes: ${JSON.stringify(payload)}`);
279
281
  return true;