hoffmation-base 3.0.0-alpha.42 → 3.0.0-alpha.43
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.
|
@@ -22,19 +22,21 @@ class PresenceGroup extends base_group_1.BaseGroup {
|
|
|
22
22
|
initCallbacks() {
|
|
23
23
|
this.getMotionDetector().forEach((b) => {
|
|
24
24
|
b.addMovementCallback((action) => {
|
|
25
|
-
if (action.motionDetected) {
|
|
26
|
-
this.
|
|
25
|
+
if (!action.motionDetected && !this.anyPresent()) {
|
|
26
|
+
this.motionSensorOnLastLeft(action);
|
|
27
|
+
return;
|
|
27
28
|
}
|
|
28
|
-
if (action.motionDetected
|
|
29
|
-
// TODO: Possible Edge Case, if the other motion sensor doesn't fire motion end event this will never be called
|
|
29
|
+
if (!action.motionDetected && this.anyPresent()) {
|
|
30
30
|
this.resetLastLeftTimeout();
|
|
31
|
+
return;
|
|
31
32
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (
|
|
33
|
+
// At this Point we can be certain about motion being detected.
|
|
34
|
+
this.log(models_1.LogLevel.Debug, `New Motion detected, present Amount: ${this.presentAmount()}`, services_1.LogDebugType.NewMovementState);
|
|
35
|
+
this.motionSensorOnAnyMovement(action);
|
|
36
|
+
if (this.presentAmount() === 1 && this._lastLeftTimeout === null) {
|
|
36
37
|
this.fireFistEnterCBs(action);
|
|
37
38
|
}
|
|
39
|
+
this.resetLastLeftTimeout();
|
|
38
40
|
});
|
|
39
41
|
});
|
|
40
42
|
this.addLastLeftCallback((action) => {
|
|
@@ -110,9 +112,11 @@ class PresenceGroup extends base_group_1.BaseGroup {
|
|
|
110
112
|
* In case of an existing delayed last left callback timeout, this removes it.
|
|
111
113
|
*/
|
|
112
114
|
resetLastLeftTimeout() {
|
|
113
|
-
if (this._lastLeftTimeout
|
|
114
|
-
|
|
115
|
+
if (this._lastLeftTimeout === null) {
|
|
116
|
+
return;
|
|
115
117
|
}
|
|
118
|
+
clearTimeout(this._lastLeftTimeout);
|
|
119
|
+
this._lastLeftTimeout = null;
|
|
116
120
|
}
|
|
117
121
|
executeLastLeftCbs(action) {
|
|
118
122
|
for (const cb of this._lastLeftCbs) {
|