homebridge-melcloud-control 4.3.5-beta.0 → 4.3.5-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.3.5-beta.0",
4
+ "version": "4.3.5-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",
@@ -1,5 +1,6 @@
1
1
  import fs from 'fs';
2
2
  import axios from 'axios';
3
+ import WebSocket from 'ws';
3
4
  import { exec } from 'child_process';
4
5
  import { promisify } from 'util';
5
6
  import EventEmitter from 'events';
@@ -224,7 +225,7 @@ class MelCloudHome extends EventEmitter {
224
225
 
225
226
  try {
226
227
  const url = `${ApiUrlsHome.WebSocketURL}${this.webSocketOptions.Hash}`;
227
- const socket = new WebSocket(url, { headers: this.webSocketOptions.Headers })
228
+ this.socket = new WebSocket(url, { headers: this.webSocketOptions.Headers })
228
229
  .on('error', (error) => {
229
230
  if (this.logError) this.emit('error', `Socket error: ${error}`);
230
231
  socket.close();
@@ -234,7 +235,6 @@ class MelCloudHome extends EventEmitter {
234
235
  this.cleanupSocket();
235
236
  })
236
237
  .on('open', () => {
237
- this.socket = socket;
238
238
  this.socketConnected = true;
239
239
  this.connecting = false;
240
240
  if (this.logSuccess) this.emit('success', `Socket Connect Success`);