homebridge-melcloud-control 4.3.3-beta.1 → 4.3.3-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/package.json +1 -1
- package/src/melcloudata.js +20 -3
- package/src/melcloudatw.js +3 -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.3-beta.
|
|
4
|
+
"version": "4.3.3-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",
|
package/src/melcloudata.js
CHANGED
|
@@ -145,7 +145,6 @@ class MelCloudAta extends EventEmitter {
|
|
|
145
145
|
|
|
146
146
|
async checkState() {
|
|
147
147
|
try {
|
|
148
|
-
|
|
149
148
|
//read device info from file
|
|
150
149
|
const devicesData = await this.functions.readData(this.devicesFile, true);
|
|
151
150
|
if (!devicesData) return;
|
|
@@ -189,7 +188,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
189
188
|
.on('message', async (message) => {
|
|
190
189
|
const parsedMessage = JSON.parse(message);
|
|
191
190
|
const stringifyMessage = JSON.stringify(parsedMessage, null, 2);
|
|
192
|
-
if (this.logDebug) this.emit('debug', `Incoming message: ${stringifyMessage}`);
|
|
191
|
+
if (!this.logDebug) this.emit('debug', `Incoming message: ${stringifyMessage}`);
|
|
193
192
|
if (parsedMessage.message === 'Forbidden') return;
|
|
194
193
|
|
|
195
194
|
const messageData = parsedMessage?.[0]?.Data;
|
|
@@ -369,7 +368,25 @@ class MelCloudAta extends EventEmitter {
|
|
|
369
368
|
path = ApiUrlsHome.PutAta.replace('deviceid', deviceData.DeviceID);
|
|
370
369
|
headers.Referer = ApiUrlsHome.Referers.PutDeviceSettings;
|
|
371
370
|
updateState = false;
|
|
372
|
-
|
|
371
|
+
this.socket.send(JSON.stringify([{
|
|
372
|
+
messageType: 'setUnitSettings',
|
|
373
|
+
Data: {
|
|
374
|
+
id: deviceData.DeviceID,
|
|
375
|
+
settings: {
|
|
376
|
+
"messageType": "unitStateChanged",
|
|
377
|
+
"Data": {
|
|
378
|
+
"id": deviceData.DeviceID,
|
|
379
|
+
"settings": [
|
|
380
|
+
{
|
|
381
|
+
"name": "Power",
|
|
382
|
+
"value": deviceData.Device.Power
|
|
383
|
+
}
|
|
384
|
+
]
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}]));
|
|
389
|
+
return;
|
|
373
390
|
}
|
|
374
391
|
|
|
375
392
|
//sens payload
|
package/src/melcloudatw.js
CHANGED
|
@@ -32,7 +32,7 @@ class MelCloudAtw extends EventEmitter {
|
|
|
32
32
|
this.socketConnected = false;
|
|
33
33
|
this.heartbeat = null;
|
|
34
34
|
|
|
35
|
-
//lock
|
|
35
|
+
//lock flag
|
|
36
36
|
this.locks = false;
|
|
37
37
|
this.impulseGenerator = new ImpulseGenerator()
|
|
38
38
|
.on('checkState', () => this.handleWithLock(async () => {
|
|
@@ -209,12 +209,12 @@ class MelCloudAtw extends EventEmitter {
|
|
|
209
209
|
updateState = true;
|
|
210
210
|
break;
|
|
211
211
|
default:
|
|
212
|
-
if (
|
|
212
|
+
if (this.logDebug) this.emit('debug', `Unit ${unitId}, received unknown message type: ${stringifyMessage}`);
|
|
213
213
|
return;
|
|
214
214
|
}
|
|
215
215
|
break;
|
|
216
216
|
default:
|
|
217
|
-
if (
|
|
217
|
+
if (this.logDebug) this.emit('debug', `Incoming unknown unit id: ${stringifyMessage}`);
|
|
218
218
|
return;
|
|
219
219
|
}
|
|
220
220
|
|