homebridge-melcloud-control 4.3.0-beta.40 → 4.3.0-beta.41

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.0-beta.40",
4
+ "version": "4.3.0-beta.41",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -153,7 +153,6 @@ class MelCloudAta extends EventEmitter {
153
153
  else if (!isNaN(value) && value !== "") parsedValue = Number(value);
154
154
  return [name, parsedValue];
155
155
  }));
156
-
157
156
  Object.assign(deviceData.Device, settings);
158
157
 
159
158
  this.emit('deviceState', deviceData);
@@ -357,7 +356,27 @@ class MelCloudAta extends EventEmitter {
357
356
  path = ApiUrlsHome.PutAta.replace('deviceid', deviceData.DeviceID);
358
357
  this.headers.Referer = ApiUrlsHome.Referers.PutDeviceSettings;
359
358
  updateState = false;
360
- break;
359
+
360
+ const settings = [
361
+ { "name": "Power", "value": deviceData.Device.Power },
362
+ { "name": "SetTemperature", "value": deviceData.Device.SetTemperature },
363
+ { "name": "SetFanSpeed", "value": deviceData.Device.SetFanSpeed },
364
+ { "name": "OperationMode", "value": deviceData.Device.OperationMode },
365
+ { "name": "VaneHorizontalDirection", "value": deviceData.Device.VaneHorizontalDirection },
366
+ { "name": "VaneVerticalDirection", "value": deviceData.Device.VaneVerticalDirection }
367
+ ]
368
+ const payload1 = [
369
+ {
370
+ messageType: "unitStateChanged",
371
+ Data: {
372
+ id: deviceData.DeviceID, // Twój ID jednostki
373
+ unitType: "ata", // tak jak incoming
374
+ settings: settings // czyli tablica: [{ name, value }, ...]
375
+ }
376
+ }
377
+ ];
378
+ this.socket.send(JSON.stringify(payload1));
379
+ return;
361
380
  }
362
381
 
363
382
  this.headers['Content-Type'] = 'application/json; charset=utf-8';
@@ -287,7 +287,7 @@ class MelCloudHome extends EventEmitter {
287
287
  if (url.startsWith('wss://ws.melcloudhome.com/?hash=')) {
288
288
  const params = new URL(url).searchParams;
289
289
  hash = params.get('hash');
290
- if (this.logDebug) this.emit('debug', `MelCloudHome WS hash detected: ${melcloudHash}`);
290
+ if (this.logDebug) this.emit('debug', `MelCloudHome WS hash detected: ${hash}`);
291
291
  }
292
292
  } catch (err) {
293
293
  this.emit('error', `CDP WebSocketCreated handler error: ${err.message}`);