homebridge-melcloud-control 4.3.0-beta.4 → 4.3.0-beta.5
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 +24 -24
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.5",
|
|
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
|
@@ -73,34 +73,34 @@ class MelCloudAta extends EventEmitter {
|
|
|
73
73
|
const temps = await this.functions.readData(this.defaultTempsFile, true);
|
|
74
74
|
deviceData.Device.DefaultHeatingSetTemperature = temps?.defaultHeatingSetTemperature ?? 20;
|
|
75
75
|
deviceData.Device.DefaultCoolingSetTemperature = temps?.defaultCoolingSetTemperature ?? 24;
|
|
76
|
-
}
|
|
77
|
-
if (this.logDebug) this.emit('debug', `Device Data: ${JSON.stringify(deviceData, null, 2)}`);
|
|
78
76
|
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
if (this.start) {
|
|
78
|
+
const hash = '2db32d6f-c19c-4b1f-a0dd-1915420a5152';
|
|
81
79
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
});
|
|
89
|
-
ws.on('open', () => {
|
|
90
|
-
if (!this.logDebug) this.emit('warn', `Connected to MelCloudHome WebSocket`);
|
|
91
|
-
this.start = false;
|
|
92
|
-
})
|
|
93
|
-
.on('message', (data) => {
|
|
94
|
-
if (!this.logDebug) this.emit('warn', `Incoming message:', ${data.toString()}`);
|
|
95
|
-
})
|
|
96
|
-
.on('close', () => {
|
|
97
|
-
if (!this.logDebug) this.emit('warn', `Connection closed`);
|
|
98
|
-
})
|
|
99
|
-
.on('error', (error) => {
|
|
100
|
-
if (!this.logDebug) this.emit('warn', `Connected error: ${error}`);
|
|
80
|
+
const ws = new WebSocket(`wss://ws.melcloudhome.com/?hash=${hash}`, {
|
|
81
|
+
headers: {
|
|
82
|
+
'Origin': 'https://melcloudhome.com',
|
|
83
|
+
'Pragma': 'no-cache',
|
|
84
|
+
'Cache-Control': 'no-cache'
|
|
85
|
+
}
|
|
101
86
|
});
|
|
102
|
-
|
|
87
|
+
ws.on('open', () => {
|
|
88
|
+
if (!this.logDebug) this.emit('warn', `Connected to MelCloudHome WebSocket`);
|
|
89
|
+
this.start = false;
|
|
90
|
+
})
|
|
91
|
+
.on('message', (data) => {
|
|
92
|
+
if (!this.logDebug) this.emit('warn', `Incoming message:', ${data.toString()}`);
|
|
93
|
+
})
|
|
94
|
+
.on('close', () => {
|
|
95
|
+
if (!this.logDebug) this.emit('warn', `Connection closed`);
|
|
96
|
+
})
|
|
97
|
+
.on('error', (error) => {
|
|
98
|
+
if (!this.logDebug) this.emit('warn', `Connected error: ${error}`);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
103
101
|
|
|
102
|
+
}
|
|
103
|
+
if (this.logDebug) this.emit('debug', `Device Data: ${JSON.stringify(deviceData, null, 2)}`);
|
|
104
104
|
|
|
105
105
|
//device
|
|
106
106
|
const serialNumber = deviceData.SerialNumber || '4.0.0';
|