-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathnode_helper.js
More file actions
executable file
·38 lines (32 loc) · 1.04 KB
/
Copy pathnode_helper.js
File metadata and controls
executable file
·38 lines (32 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* Magic Mirror
* Node Helper: MotionEye
*
* By Cato Antonsen (https://github.com/CatoAntonsen)
* MIT Licensed.
*/
var NodeHelper = require("node_helper");
module.exports = NodeHelper.create({
start: function() {
console.log("Starting module: " + this.name);
},
socketNotificationReceived: function(notification, config) {
if (notification === "CONFIG") {
if (config.autoHide) {
var self = this;
console.log("Hiding camera: " + config.id);
this.sendSocketNotification("MotionEyeHide", config.id);
this.expressApp.get('/motioneye/hide/:id*?', function (req, res) {
console.log("Hide registered: " + req.params.id);
res.send('Hide registered: ' + req.params.id);
self.sendSocketNotification("MotionEyeHide", req.params.id);
});
this.expressApp.get('/motioneye/:id*?', function (req, res) {
console.log("Motion registered: " + req.params.id);
res.send('Motion registered: ' + req.params.id);
self.sendSocketNotification("MotionEyeShow", req.params.id);
});
}
return;
}
},
});