homebridge-melcloud-control 4.3.11-beta.28 → 4.3.11-beta.29
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 +4 -2
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.11-beta.
|
|
4
|
+
"version": "4.3.11-beta.29",
|
|
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
|
@@ -21,6 +21,7 @@ class MelCloudHome extends EventEmitter {
|
|
|
21
21
|
this.logWarn = account.log?.warn;
|
|
22
22
|
this.logError = account.log?.error;
|
|
23
23
|
this.logDebug = account.log?.debug;
|
|
24
|
+
|
|
24
25
|
this.accountFile = accountFile;
|
|
25
26
|
this.buildingsFile = buildingsFile;
|
|
26
27
|
|
|
@@ -290,7 +291,7 @@ class MelCloudHome extends EventEmitter {
|
|
|
290
291
|
await client.send('Network.enable')
|
|
291
292
|
client.on('Network.webSocketCreated', ({ url }) => {
|
|
292
293
|
try {
|
|
293
|
-
if (url.startsWith(
|
|
294
|
+
if (url.startsWith(`${ApiUrlsHome.WebSocketURL}`)) {
|
|
294
295
|
const params = new URL(url).searchParams;
|
|
295
296
|
const hash = params.get('hash');
|
|
296
297
|
if (this.logDebug) this.emit('debug', `MelCloudHome WS hash detected: ${hash}`);
|
|
@@ -305,7 +306,7 @@ class MelCloudHome extends EventEmitter {
|
|
|
305
306
|
'Pragma': 'no-cache',
|
|
306
307
|
'Cache-Control': 'no-cache'
|
|
307
308
|
};
|
|
308
|
-
|
|
309
|
+
const webSocket = new WebSocket(`${ApiUrlsHome.WebSocketURL}${hash}`, { headers: headers })
|
|
309
310
|
.on('error', (error) => {
|
|
310
311
|
if (this.logError) this.emit('error', `Socket error: ${error}`);
|
|
311
312
|
this.webSocket.close();
|
|
@@ -315,6 +316,7 @@ class MelCloudHome extends EventEmitter {
|
|
|
315
316
|
this.cleanupSocket();
|
|
316
317
|
})
|
|
317
318
|
.on('open', () => {
|
|
319
|
+
this.webSocket = webSocket;
|
|
318
320
|
this.socketConnected = true;
|
|
319
321
|
this.connecting = false;
|
|
320
322
|
if (this.logSuccess) this.emit('success', `Socket Connect Success`);
|