homebridge-melcloud-control 3.5.1 → 3.5.3-beta.0
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/README.md +6 -3
- package/config.schema.json +28 -9
- package/index.js +57 -45
- package/package.json +2 -2
- package/src/deviceata.js +1232 -1231
- package/src/deviceatw.js +1674 -1673
- package/src/deviceerv.js +1002 -1001
- package/src/impulsegenerator.js +14 -13
- package/src/melcloud.js +3 -3
- package/src/melcloudata.js +2 -2
- package/src/melcloudatw.js +2 -2
- package/src/melclouderv.js +2 -2
package/src/impulsegenerator.js
CHANGED
|
@@ -8,11 +8,14 @@ class ImpulseGenerator extends EventEmitter {
|
|
|
8
8
|
|
|
9
9
|
async start(timers) {
|
|
10
10
|
if (this.timersState) {
|
|
11
|
-
|
|
11
|
+
this.state(true);
|
|
12
|
+
return true;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
this.timers = [];
|
|
15
16
|
for (const timer of timers) {
|
|
17
|
+
this.emit(timer.name);
|
|
18
|
+
|
|
16
19
|
const newTimer = setInterval(() => {
|
|
17
20
|
this.emit(timer.name);
|
|
18
21
|
}, timer.sampling);
|
|
@@ -20,28 +23,26 @@ class ImpulseGenerator extends EventEmitter {
|
|
|
20
23
|
};
|
|
21
24
|
|
|
22
25
|
//update state
|
|
23
|
-
this.
|
|
24
|
-
this.state();
|
|
25
|
-
|
|
26
|
+
this.state(true);
|
|
26
27
|
return true;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
async stop() {
|
|
30
|
-
if (this.timersState) {
|
|
31
|
-
this.
|
|
31
|
+
if (!this.timersState) {
|
|
32
|
+
this.state(false);
|
|
33
|
+
return true;
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
//update state
|
|
37
|
+
this.timers.forEach(timer => clearInterval(timer));
|
|
35
38
|
this.timers = [];
|
|
36
|
-
this.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return true;
|
|
39
|
+
this.state(false);
|
|
40
|
+
return true
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
state() {
|
|
43
|
-
this.
|
|
44
|
-
|
|
43
|
+
state(state) {
|
|
44
|
+
this.timersState = state;
|
|
45
|
+
this.emit('state', state);
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
export default ImpulseGenerator;
|
package/src/melcloud.js
CHANGED
|
@@ -79,7 +79,7 @@ class MelCloud extends EventEmitter {
|
|
|
79
79
|
|
|
80
80
|
if (contextKey === undefined || contextKey === null) {
|
|
81
81
|
this.emit('warn', `Context key: ${contextKey}, missing.`)
|
|
82
|
-
return;
|
|
82
|
+
return false;
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
//create axios instance post
|
|
@@ -144,7 +144,7 @@ class MelCloud extends EventEmitter {
|
|
|
144
144
|
|
|
145
145
|
if (!buildingsList) {
|
|
146
146
|
this.emit('warn', `No building found.`);
|
|
147
|
-
return;
|
|
147
|
+
return false;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
//save buildings to the file
|
|
@@ -170,7 +170,7 @@ class MelCloud extends EventEmitter {
|
|
|
170
170
|
const devicesCount = devices.length;
|
|
171
171
|
if (devicesCount === 0) {
|
|
172
172
|
this.emit('warn', `No devices found.`);
|
|
173
|
-
return;
|
|
173
|
+
return false;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
//save buildings to the file
|
package/src/melcloudata.js
CHANGED
|
@@ -10,7 +10,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
10
10
|
super();
|
|
11
11
|
this.devicesFile = config.devicesFile;
|
|
12
12
|
this.deviceId = config.deviceId;
|
|
13
|
-
this.
|
|
13
|
+
this.enableDebugMode = config.enableDebugMode;
|
|
14
14
|
|
|
15
15
|
//set default values
|
|
16
16
|
this.deviceState = {};
|
|
@@ -52,7 +52,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
|
|
55
|
-
const debug = this.
|
|
55
|
+
const debug = this.enableDebugMode ? this.emit('debug', `Device Data: ${JSON.stringify(deviceData, null, 2)}`) : false;
|
|
56
56
|
|
|
57
57
|
//device info
|
|
58
58
|
const deviceId = deviceData.DeviceID;
|
package/src/melcloudatw.js
CHANGED
|
@@ -10,7 +10,7 @@ class MelCloudAtw extends EventEmitter {
|
|
|
10
10
|
super();
|
|
11
11
|
this.devicesFile = config.devicesFile;
|
|
12
12
|
this.deviceId = config.deviceId;
|
|
13
|
-
this.
|
|
13
|
+
this.enableDebugMode = config.enableDebugMode;
|
|
14
14
|
|
|
15
15
|
//set default values
|
|
16
16
|
this.deviceState = {};
|
|
@@ -52,7 +52,7 @@ class MelCloudAtw extends EventEmitter {
|
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
|
|
55
|
-
const debug = this.
|
|
55
|
+
const debug = this.enableDebugMode ? this.emit('debug', `Device Data: ${JSON.stringify(deviceData, null, 2)}`) : false;
|
|
56
56
|
|
|
57
57
|
//device info
|
|
58
58
|
const deviceId = deviceData.DeviceID;
|
package/src/melclouderv.js
CHANGED
|
@@ -10,7 +10,7 @@ class MelCloudErv extends EventEmitter {
|
|
|
10
10
|
super();
|
|
11
11
|
this.devicesFile = config.devicesFile;
|
|
12
12
|
this.deviceId = config.deviceId;
|
|
13
|
-
this.
|
|
13
|
+
this.enableDebugMode = config.enableDebugMode;
|
|
14
14
|
|
|
15
15
|
//set default values
|
|
16
16
|
this.deviceState = {};
|
|
@@ -52,7 +52,7 @@ class MelCloudErv extends EventEmitter {
|
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
|
|
55
|
-
const debug = this.
|
|
55
|
+
const debug = this.enableDebugMode ? this.emit('debug', `Device Data: ${JSON.stringify(deviceData, null, 2)}`) : false;
|
|
56
56
|
|
|
57
57
|
//deviceData
|
|
58
58
|
const deviceId = deviceData.DeviceID;
|