homebridge-melcloud-control 4.3.5-beta.1 → 4.3.5-beta.3

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/index.js CHANGED
@@ -179,7 +179,7 @@ class MelCloudPlatform {
179
179
  let configuredDevice;
180
180
  switch (deviceType) {
181
181
  case 0: //ATA
182
- configuredDevice = new DeviceAta(api, account, device, devicesFile, defaultTempsFile, accountInfo, accountFile), devicesList.WebSocket;
182
+ configuredDevice = new DeviceAta(api, account, device, devicesFile, defaultTempsFile, accountInfo, accountFile, devicesList.WebSocket);
183
183
  break;
184
184
  case 1: //ATW
185
185
  configuredDevice = new DeviceAtw(api, account, device, devicesFile, defaultTempsFile, accountInfo, accountFile, devicesList.WebSocket);
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.1",
4
+ "version": "4.3.5-beta.3",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -225,26 +225,25 @@ class MelCloudHome extends EventEmitter {
225
225
 
226
226
  try {
227
227
  const url = `${ApiUrlsHome.WebSocketURL}${this.webSocketOptions.Hash}`;
228
- const socket = new WebSocket(url, { headers: this.webSocketOptions.Headers })
228
+ this.socket = new WebSocket(url, { headers: this.webSocketOptions.Headers })
229
229
  .on('error', (error) => {
230
230
  if (this.logError) this.emit('error', `Socket error: ${error}`);
231
- socket.close();
231
+ this.socket.close();
232
232
  })
233
233
  .on('close', () => {
234
234
  if (this.logDebug) this.emit('debug', `Socket closed`);
235
235
  this.cleanupSocket();
236
236
  })
237
237
  .on('open', () => {
238
- this.socket = socket;
239
238
  this.socketConnected = true;
240
239
  this.connecting = false;
241
240
  if (this.logSuccess) this.emit('success', `Socket Connect Success`);
242
241
 
243
242
  // heartbeat
244
243
  this.heartbeat = setInterval(() => {
245
- if (socket.readyState === socket.OPEN) {
244
+ if (this.socket.readyState === this.socket.OPEN) {
246
245
  if (!this.logDebug) this.emit('debug', `Socket send heartbeat`);
247
- socket.ping();
246
+ this.socket.ping();
248
247
  }
249
248
  }, 30000);
250
249
  })