homebridge-melcloud-control 3.5.0 → 3.5.2
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/index.js +5 -5
- package/package.json +2 -2
- package/src/deviceata.js +725 -724
- package/src/deviceatw.js +1670 -1669
- package/src/deviceerv.js +1002 -1001
- package/src/impulsegenerator.js +14 -13
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;
|