homebridge-melcloud-control 4.3.0-beta.34 → 4.3.0-beta.36
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 +7 -3
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.0-beta.
|
|
4
|
+
"version": "4.3.0-beta.36",
|
|
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
|
@@ -107,9 +107,9 @@ class MelCloudAta extends EventEmitter {
|
|
|
107
107
|
if (!this.connecting && !this.socketConnected) {
|
|
108
108
|
this.connecting = true;
|
|
109
109
|
|
|
110
|
-
const url = `${ApiUrlsHome.WebSocketURL}${devicesData.
|
|
110
|
+
const url = `${ApiUrlsHome.WebSocketURL}${devicesData.WsHeaders.hash}`;
|
|
111
111
|
try {
|
|
112
|
-
const socket = new WebSocket(url, { headers: devicesData.
|
|
112
|
+
const socket = new WebSocket(url, { headers: devicesData.WsHeaders.headers })
|
|
113
113
|
.on('error', (error) => {
|
|
114
114
|
if (this.logError) this.emit('error', `Socket error: ${error}`);
|
|
115
115
|
})
|
|
@@ -148,6 +148,8 @@ class MelCloudAta extends EventEmitter {
|
|
|
148
148
|
case 'unitStateChanged':
|
|
149
149
|
const settings = Object.fromEntries(messageData.settings.map(s => [s.name, s.value]));
|
|
150
150
|
Object.assign(deviceData.Device, settings);
|
|
151
|
+
|
|
152
|
+
if (!this.logDebug) this.emit('warn', `Updated state ${JSON.stringify(deviceData, null, 2)}`);
|
|
151
153
|
this.emit('deviceState', deviceData);
|
|
152
154
|
break;
|
|
153
155
|
case 'unitWiFiChanged':
|
|
@@ -228,6 +230,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
228
230
|
let method = null
|
|
229
231
|
let payload = {};
|
|
230
232
|
let path = '';
|
|
233
|
+
let updateState = true;
|
|
231
234
|
switch (accountType) {
|
|
232
235
|
case "melcloud":
|
|
233
236
|
switch (flag) {
|
|
@@ -350,6 +353,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
350
353
|
|
|
351
354
|
this.headers['Content-Type'] = 'application/json; charset=utf-8';
|
|
352
355
|
this.headers.Origin = ApiUrlsHome.Origin;
|
|
356
|
+
updateState = false;
|
|
353
357
|
if (this.logDebug) this.emit('debug', `Send Data: ${JSON.stringify(payload, null, 2)}`);
|
|
354
358
|
await axios(path, {
|
|
355
359
|
method: method,
|
|
@@ -359,7 +363,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
359
363
|
data: payload
|
|
360
364
|
});
|
|
361
365
|
|
|
362
|
-
this.updateData(deviceData);
|
|
366
|
+
if (updateState) this.updateData(deviceData);
|
|
363
367
|
return true;
|
|
364
368
|
default:
|
|
365
369
|
return;
|