homebridge-melcloud-control 4.3.2-beta.11 → 4.3.2-beta.13
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/functions.js +5 -6
- package/src/melcloudata.js +4 -8
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.2-beta.
|
|
4
|
+
"version": "4.3.2-beta.13",
|
|
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/functions.js
CHANGED
|
@@ -160,13 +160,12 @@ class Functions extends EventEmitter {
|
|
|
160
160
|
return v !== undefined && v !== null && !(typeof v === 'number' && Number.isNaN(v));
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
convertValue(
|
|
164
|
-
let parsedValue =
|
|
165
|
-
if (
|
|
166
|
-
else if (
|
|
167
|
-
else if (!isNaN(
|
|
163
|
+
convertValue(v) {
|
|
164
|
+
let parsedValue = v;
|
|
165
|
+
if (v === "True") parsedValue = true;
|
|
166
|
+
else if (v === "False") parsedValue = false;
|
|
167
|
+
else if (!isNaN(v) && v !== "") parsedValue = Number(v);
|
|
168
168
|
return parsedValue;
|
|
169
169
|
}
|
|
170
|
-
|
|
171
170
|
}
|
|
172
171
|
export default Functions
|
package/src/melcloudata.js
CHANGED
|
@@ -126,6 +126,10 @@ class MelCloudAta extends EventEmitter {
|
|
|
126
126
|
this.emit('mqtt', 'State', deviceData.Device);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
//check state changes
|
|
130
|
+
const deviceDataChanged = JSON.stringify(deviceData) === JSON.stringify(this.deviceData);
|
|
131
|
+
if (!deviceDataChanged) return;
|
|
132
|
+
|
|
129
133
|
//emit info
|
|
130
134
|
this.emit('deviceInfo', indoor.model, outdoor.model, serialNumber, firmwareAppVersion);
|
|
131
135
|
|
|
@@ -229,14 +233,6 @@ class MelCloudAta extends EventEmitter {
|
|
|
229
233
|
}
|
|
230
234
|
}
|
|
231
235
|
|
|
232
|
-
//check state changes
|
|
233
|
-
const deviceDataHasNotChanged = JSON.stringify(deviceData) === JSON.stringify(this.deviceData);
|
|
234
|
-
if (deviceDataHasNotChanged) return;
|
|
235
|
-
this.deviceData = deviceData;
|
|
236
|
-
|
|
237
|
-
//update state
|
|
238
|
-
await this.updateState(deviceData);
|
|
239
|
-
|
|
240
236
|
return true;
|
|
241
237
|
} catch (error) {
|
|
242
238
|
throw new Error(`Check state error: ${error.message}`);
|