homebridge-melcloud-control 4.9.2-beta.4 → 4.9.2-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/melcloudhome.js +6 -6
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.9.2-beta.
|
|
4
|
+
"version": "4.9.2-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/melcloudhome.js
CHANGED
|
@@ -95,7 +95,7 @@ class MelCloudHome extends EventEmitter {
|
|
|
95
95
|
'Cache-Control': 'no-cache',
|
|
96
96
|
};
|
|
97
97
|
|
|
98
|
-
if (this.logDebug) this.emit('debug', `Connecting WebSocket: ${url.slice(0, 60)}...`);
|
|
98
|
+
if (!this.logDebug) this.emit('debug', `Connecting WebSocket: ${url.slice(0, 60)}...`);
|
|
99
99
|
|
|
100
100
|
try {
|
|
101
101
|
const ws = new WebSocket(url, { headers });
|
|
@@ -107,7 +107,7 @@ class MelCloudHome extends EventEmitter {
|
|
|
107
107
|
});
|
|
108
108
|
|
|
109
109
|
ws.on('close', () => {
|
|
110
|
-
if (this.logDebug) this.emit('debug', 'Web socket closed');
|
|
110
|
+
if (!this.logDebug) this.emit('debug', 'Web socket closed');
|
|
111
111
|
this.cleanupSocket();
|
|
112
112
|
this.scheduleReconnect();
|
|
113
113
|
});
|
|
@@ -120,7 +120,7 @@ class MelCloudHome extends EventEmitter {
|
|
|
120
120
|
clearTimeout(this.reconnectTimer);
|
|
121
121
|
this.reconnectTimer = null;
|
|
122
122
|
}
|
|
123
|
-
if (this.logDebug) this.emit('debug', 'Web Socket Connected');
|
|
123
|
+
if (!this.logDebug) this.emit('debug', 'Web Socket Connected');
|
|
124
124
|
|
|
125
125
|
// Heartbeat co 30s
|
|
126
126
|
this.heartbeat = setInterval(() => {
|
|
@@ -132,13 +132,13 @@ class MelCloudHome extends EventEmitter {
|
|
|
132
132
|
});
|
|
133
133
|
|
|
134
134
|
ws.on('pong', () => {
|
|
135
|
-
if (this.logDebug) this.emit('debug', 'Web socket received heartbeat');
|
|
135
|
+
if (!this.logDebug) this.emit('debug', 'Web socket received heartbeat');
|
|
136
136
|
});
|
|
137
137
|
|
|
138
138
|
ws.on('message', (message) => {
|
|
139
139
|
try {
|
|
140
140
|
const parsedMessage = JSON.parse(message);
|
|
141
|
-
if (this.logDebug) this.emit('debug', `Web socket incoming message: ${JSON.stringify(parsedMessage, null, 2)}`);
|
|
141
|
+
if (!this.logDebug) this.emit('debug', `Web socket incoming message: ${JSON.stringify(parsedMessage, null, 2)}`);
|
|
142
142
|
|
|
143
143
|
// Format: array, pierwszy element ma Data.id
|
|
144
144
|
const messageData = parsedMessage?.[0]?.Data;
|
|
@@ -433,7 +433,7 @@ class MelCloudHome extends EventEmitter {
|
|
|
433
433
|
}
|
|
434
434
|
|
|
435
435
|
connectInfo.State = exchangeRes;
|
|
436
|
-
connectInfo.Status = `Connect Success${this.socketConnected ?
|
|
436
|
+
connectInfo.Status = exchangeRes ? `Connect Success ${this.socketConnected ?', Web Socket Connected' : ''}` : 'Connect Failed';
|
|
437
437
|
|
|
438
438
|
return connectInfo;
|
|
439
439
|
}
|