Skip to content

Commit

Permalink
Bug correction and new functionnalities
Browse files Browse the repository at this point in the history
Bug correction for Brightness control : Jopyth#76
New functionnalities : 
 - add a Notification to others modules names "USER_PRESENCE" to true or false when MONITORON or MONITOROFF are requested
 - possibility to send this Notification "USER_PRESENCE" to true or false by other module request (for example, I use MMM-Navigation to send USER_PRESENCE to true to allow my module update on request)
This notification "USER_PRESENCE" can also be send by the module MMM-PIR-Sensor.
  • Loading branch information
AgP42 authored Jul 23, 2018
1 parent 3ad5127 commit 7242923
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions node_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -593,13 +593,30 @@ module.exports = NodeHelper.create({
});
return true;
}
if (query.action === "USER_PRESENCE")
{
//Add AgP
this.sendSocketNotification("USER_PRESENCE", query.value);
// console.log("User presence true");

return true;
}
if (query.action === "MONITORON")
{
{
//Add AgP
this.sendSocketNotification("USER_PRESENCE", true);
// console.log("User presence true");

exec("tvservice --preferred && sudo chvt 6 && sudo chvt 7", opts, function(error, stdout, stderr){ self.checkForExecError(error, stdout, stderr, res); });
return true;
}
if (query.action === "MONITOROFF")
{

//Add AgP
this.sendSocketNotification("USER_PRESENCE", false);
// console.log("User presence false");

exec("tvservice -o", opts, function(error, stdout, stderr){ self.checkForExecError(error, stdout, stderr, res); });
return true;
}
Expand All @@ -615,8 +632,12 @@ module.exports = NodeHelper.create({
}
if (query.action === "BRIGHTNESS")
{
res.send({"status": "success"});
//Modif AgP
//res.send({"status": "success"});
if (res) {res.send({"status": "success"}); }

self.sendSocketNotification(query.action, query.value);

return true;
}
if (query.action === "SAVE")
Expand Down

0 comments on commit 7242923

Please sign in to comment.