homebridge-melcloud-control 4.3.0-beta.31 → 4.3.0-beta.32

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 +15 -3
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.31",
4
+ "version": "4.3.0-beta.32",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -116,8 +116,8 @@ class MelCloudAta extends EventEmitter {
116
116
  const parsedMessage = JSON.parse(message);
117
117
  if (!this.logDebug) this.emit('warn', `Incoming message: ${JSON.stringify(parsedMessage, null, 2)}`);
118
118
 
119
- const messageData = parsedMessage[0].Data;
120
- const unitId = messageData.id;
119
+ const messageData = parsedMessage?.[0]?.Data;
120
+ const unitId = messageData?.id;
121
121
 
122
122
  switch (unitId) {
123
123
  case this.deviceId:
@@ -355,8 +355,20 @@ class MelCloudAta extends EventEmitter {
355
355
  path = ApiUrlsHome.PutAta.replace('deviceid', deviceData.DeviceID);
356
356
  this.headers.Referer = ApiUrlsHome.Referers.PutDeviceSettings;
357
357
 
358
+ const payload1 = {
359
+ Data: {
360
+ id: deviceData.DeviceID,
361
+ unitType: 'ata',
362
+ settings: [
363
+ {
364
+ name: 'Power',
365
+ value: deviceData.Device.Power
366
+ }
367
+ ]
368
+ }
369
+ };
358
370
  try {
359
- this.socket.send(JSON.stringify(payload));
371
+ this.socket.send(JSON.stringify(payload1));
360
372
  return true;
361
373
  } catch (err) {
362
374
  if (this.logDebug) this.emit('debug', `Socket send error: ${err}`);