Skip to content

Commit

Permalink
Broadcast user presence -- qistoph
Browse files Browse the repository at this point in the history
  • Loading branch information
bugsounet authored Jan 8, 2025
2 parents 0ee90c2 + ee13006 commit 84af6d5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ You can disable sound by using `0` in your configuration

* `MMM_PIR-SCREEN_POWERSTATUS` with payload `true` when your screen turn on.
* `MMM_PIR-SCREEN_POWERSTATUS` with payload `false` when your screen turn off.
* `MMM_PIR-USER_PRESENCE` with payload `true` when motion is detected.

* This module receive:

Expand Down
3 changes: 3 additions & 0 deletions src/MMM-Pir.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ Module.register("MMM-Pir", {
timer: 15000
});
break;
case "PIR_DETECTED":
this.sendNotification("MMM_PIR-USER_PRESENCE", true);
break;
case "PIR_ANIMATE":
this.screenDisplay.animateModule();
break;
Expand Down
1 change: 1 addition & 0 deletions src/components/motionLib.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class motionLib {
if (hasMotion) {
_logPIR(`[MOTION] Motion detected, score ${score}`);
this.wakeup();
this.sendNotification("MMM_PIR-USER_PRESENCE", true);
}
}
});
Expand Down
1 change: 1 addition & 0 deletions src/node_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ module.exports = NodeHelper.create({
log("[CALLBACK] Pir:", noti, params || "");
if (noti === "PIR_DETECTED") {
this.screen.wakeup();
this.sendSocketNotification("PIR_DETECTED");
if (this.config.Pir.animate) this.sendSocketNotification("PIR_ANIMATE");
} else {
this.sendSocketNotification(noti, params);
Expand Down

0 comments on commit 84af6d5

Please sign in to comment.