homebridge-melcloud-control 3.9.2 → 3.9.4
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/deviceatw.js +1 -1
- package/src/impulsegenerator.js +13 -11
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "3.9.
|
|
4
|
+
"version": "3.9.4",
|
|
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/deviceatw.js
CHANGED
|
@@ -1995,7 +1995,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1995
1995
|
await this.melCloudAtw.checkState();
|
|
1996
1996
|
|
|
1997
1997
|
//prepare accessory
|
|
1998
|
-
const accessory = await this.prepareAccessory(
|
|
1998
|
+
const accessory = await this.prepareAccessory();
|
|
1999
1999
|
return accessory;
|
|
2000
2000
|
} catch (error) {
|
|
2001
2001
|
throw new Error(`Start error: ${error}`);
|
package/src/impulsegenerator.js
CHANGED
|
@@ -4,6 +4,7 @@ class ImpulseGenerator extends EventEmitter {
|
|
|
4
4
|
constructor() {
|
|
5
5
|
super();
|
|
6
6
|
this.timersState = false;
|
|
7
|
+
this.timers = [];
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
async start(timers) {
|
|
@@ -12,20 +13,19 @@ class ImpulseGenerator extends EventEmitter {
|
|
|
12
13
|
return true;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
//update state
|
|
16
|
-
const updateState = timers.length > 0 ? this.state(true) : false;
|
|
17
|
-
|
|
18
|
-
//add timers
|
|
19
16
|
this.timers = [];
|
|
17
|
+
|
|
20
18
|
for (const timer of timers) {
|
|
21
19
|
this.emit(timer.name);
|
|
22
20
|
|
|
23
|
-
const
|
|
21
|
+
const interval = setInterval(() => {
|
|
24
22
|
this.emit(timer.name);
|
|
25
23
|
}, timer.sampling);
|
|
26
|
-
this.timers.push(newTimer);
|
|
27
|
-
};
|
|
28
24
|
|
|
25
|
+
this.timers.push(interval);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
this.state(true);
|
|
29
29
|
return true;
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -35,12 +35,13 @@ class ImpulseGenerator extends EventEmitter {
|
|
|
35
35
|
return true;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
for (const timer of this.timers) {
|
|
39
|
+
clearInterval(timer);
|
|
40
|
+
}
|
|
41
41
|
|
|
42
|
+
this.timers = [];
|
|
42
43
|
this.state(false);
|
|
43
|
-
return true
|
|
44
|
+
return true;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
state(state) {
|
|
@@ -48,4 +49,5 @@ class ImpulseGenerator extends EventEmitter {
|
|
|
48
49
|
this.emit('state', state);
|
|
49
50
|
}
|
|
50
51
|
}
|
|
52
|
+
|
|
51
53
|
export default ImpulseGenerator;
|