homebridge-melcloud-control 3.3.21-beta.4 → 3.3.21-beta.5
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 +1 -1
- package/src/melcloudata.js +15 -6
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "3.3.21-beta.
|
|
4
|
+
"version": "3.3.21-beta.5",
|
|
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/melcloudata.js
CHANGED
|
@@ -334,18 +334,20 @@ class MelCloudAta extends EventEmitter {
|
|
|
334
334
|
}
|
|
335
335
|
|
|
336
336
|
//check state changes
|
|
337
|
-
const
|
|
338
|
-
|
|
339
|
-
|
|
337
|
+
const deviceDataHasNotChanged = JSON.stringify(deviceState) === JSON.stringify(this.deviceState);
|
|
338
|
+
if (deviceDataHasNotChanged) {
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
this.deviceState = deviceState;
|
|
340
342
|
|
|
341
343
|
//external integrations
|
|
342
|
-
this.emit('externalIntegrations',
|
|
344
|
+
this.emit('externalIntegrations', deviceData);
|
|
343
345
|
|
|
344
346
|
//emit info
|
|
345
347
|
this.emit('deviceInfo', manufacturer, modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion);
|
|
346
348
|
|
|
347
349
|
//emit state
|
|
348
|
-
this.emit('deviceState',
|
|
350
|
+
this.emit('deviceState', deviceData);
|
|
349
351
|
|
|
350
352
|
return true;
|
|
351
353
|
} catch (error) {
|
|
@@ -423,11 +425,18 @@ class MelCloudAta extends EventEmitter {
|
|
|
423
425
|
}
|
|
424
426
|
|
|
425
427
|
await this.axiosInstancePost(CONSTANTS.ApiUrls.SetAta, payload);
|
|
426
|
-
this.deviceData
|
|
428
|
+
this.updateData(deviceData);
|
|
427
429
|
return true;
|
|
428
430
|
} catch (error) {
|
|
429
431
|
throw new Error(`Send data error: ${error.message || error}`);
|
|
430
432
|
};
|
|
431
433
|
};
|
|
434
|
+
|
|
435
|
+
updateData(deviceData) {
|
|
436
|
+
setTimeout(() => {
|
|
437
|
+
this.emit('externalIntegrations', deviceData);
|
|
438
|
+
this.emit('deviceState', deviceData);
|
|
439
|
+
}, 500);
|
|
440
|
+
}
|
|
432
441
|
};
|
|
433
442
|
module.exports = MelCloudAta;
|