homebridge-melcloud-control 4.3.0-beta.45 → 4.3.0-beta.46
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 +1 -1
- package/src/melcloudata.js +10 -9
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.
|
|
4
|
+
"version": "4.3.0-beta.46",
|
|
5
5
|
"description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|
package/src/melcloudata.js
CHANGED
|
@@ -91,6 +91,12 @@ class MelCloudAta extends EventEmitter {
|
|
|
91
91
|
|
|
92
92
|
this.headers = devicesData.Headers;
|
|
93
93
|
const deviceData = devicesData.Devices.find(device => device.DeviceID === this.deviceId);
|
|
94
|
+
|
|
95
|
+
//check state changes
|
|
96
|
+
const deviceDataHasNotChanged = JSON.stringify(deviceData) === JSON.stringify(this.deviceData);
|
|
97
|
+
if (deviceDataHasNotChanged) return;
|
|
98
|
+
this.deviceData = deviceData;
|
|
99
|
+
|
|
94
100
|
if (this.accountType === 'melcloudhome') {
|
|
95
101
|
deviceData.Scenes = devicesData.Scenes ?? [];
|
|
96
102
|
deviceData.Device.OperationMode = AirConditioner.OperationModeMapStringToEnum[deviceData.Device.OperationMode] ?? deviceData.Device.OperationMode;
|
|
@@ -137,7 +143,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
137
143
|
.on('message', (message) => {
|
|
138
144
|
const parsedMessage = JSON.parse(message);
|
|
139
145
|
const stringifyMessage = JSON.stringify(parsedMessage, null, 2);
|
|
140
|
-
if (this.logDebug) this.emit('
|
|
146
|
+
if (this.logDebug) this.emit('debug', `Incoming message: ${stringifyMessage}`);
|
|
141
147
|
if (parsedMessage.message === 'Forbidden') return;
|
|
142
148
|
|
|
143
149
|
const messageData = parsedMessage?.[0]?.Data;
|
|
@@ -159,9 +165,8 @@ class MelCloudAta extends EventEmitter {
|
|
|
159
165
|
|
|
160
166
|
this.emit('deviceState', deviceData);
|
|
161
167
|
break;
|
|
162
|
-
case '
|
|
163
|
-
|
|
164
|
-
Object.assign(deviceData.Device, state);
|
|
168
|
+
case 'unitWifiSignalChanged':
|
|
169
|
+
Object.assign(deviceData, messageData.rssi);
|
|
165
170
|
|
|
166
171
|
this.emit('deviceState', deviceData);
|
|
167
172
|
break;
|
|
@@ -222,11 +227,6 @@ class MelCloudAta extends EventEmitter {
|
|
|
222
227
|
this.emit('mqtt', 'State', deviceData.Device);
|
|
223
228
|
}
|
|
224
229
|
|
|
225
|
-
//check state changes
|
|
226
|
-
const deviceDataHasNotChanged = JSON.stringify(deviceData) === JSON.stringify(this.deviceData);
|
|
227
|
-
if (deviceDataHasNotChanged) return;
|
|
228
|
-
this.deviceData = deviceData;
|
|
229
|
-
|
|
230
230
|
//emit info
|
|
231
231
|
this.emit('deviceInfo', indoor.model, outdoor.model, serialNumber, firmwareAppVersion);
|
|
232
232
|
|
|
@@ -367,6 +367,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
367
367
|
break;
|
|
368
368
|
}
|
|
369
369
|
|
|
370
|
+
//sens payload
|
|
370
371
|
this.headers['Content-Type'] = 'application/json; charset=utf-8';
|
|
371
372
|
this.headers.Origin = ApiUrlsHome.Origin;
|
|
372
373
|
if (this.logDebug) this.emit('debug', `Send Data: ${JSON.stringify(payload, null, 2)}`);
|