homebridge-melcloud-control 4.3.0-beta.43 → 4.3.0-beta.44

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/melcloudata.js +7 -21
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.43",
4
+ "version": "4.3.0-beta.44",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -163,8 +163,14 @@ class MelCloudAta extends EventEmitter {
163
163
 
164
164
  this.emit('deviceState', deviceData);
165
165
  break;
166
+ default:
167
+ if (this.logWarn) this.emit('warn', `Incoming unknown message type: ${messageType}`);
168
+ return;
166
169
  }
167
170
  break;
171
+ default:
172
+ if (this.logWarn) this.emit('warn', `Incoming unknown unit id: ${unitId}`);
173
+ return;
168
174
  }
169
175
  });
170
176
  } catch (error) {
@@ -330,8 +336,6 @@ class MelCloudAta extends EventEmitter {
330
336
  this.headers.Referer = ApiUrlsHome.Referers.GetPutScenes;
331
337
  break;
332
338
  default:
333
- if (!this.socket || this.socket.readyState !== WebSocket.OPEN) return;
334
-
335
339
  if (displayType === 1 && deviceData.Device.OperationMode === 8) {
336
340
  deviceData.Device.SetTemperature = (deviceData.Device.DefaultCoolingSetTemperature + deviceData.Device.DefaultHeatingSetTemperature) / 2;
337
341
 
@@ -358,25 +362,7 @@ class MelCloudAta extends EventEmitter {
358
362
  path = ApiUrlsHome.PutAta.replace('deviceid', deviceData.DeviceID);
359
363
  this.headers.Referer = ApiUrlsHome.Referers.PutDeviceSettings;
360
364
  updateState = false;
361
-
362
- const settings = [
363
- { "name": "Power", "value": deviceData.Device.Power },
364
- { "name": "SetTemperature", "value": deviceData.Device.SetTemperature },
365
- { "name": "SetFanSpeed", "value": deviceData.Device.SetFanSpeed },
366
- { "name": "OperationMode", "value": deviceData.Device.OperationMode },
367
- { "name": "VaneHorizontalDirection", "value": deviceData.Device.VaneHorizontalDirection },
368
- { "name": "VaneVerticalDirection", "value": deviceData.Device.VaneVerticalDirection }
369
- ]
370
- const payload1 = [
371
- {
372
- Data: {
373
- id: deviceData.DeviceID, // Twój ID jednostki
374
- settings: settings // czyli tablica: [{ name, value }, ...]
375
- }
376
- }
377
- ];
378
- this.socket.send(JSON.stringify(payload1));
379
- return;
365
+ break;
380
366
  }
381
367
 
382
368
  this.headers['Content-Type'] = 'application/json; charset=utf-8';