diff --git a/node_helper.js b/node_helper.js index 65b0b22..e2a7643 100755 --- a/node_helper.js +++ b/node_helper.js @@ -10,29 +10,29 @@ var NodeHelper = require("node_helper"); module.exports = NodeHelper.create({ start: function() { console.log("Starting module: " + this.name); + + var self = this; + 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); + }); }, socketNotificationReceived: function(notification, config) { if (notification === "CONFIG") { + console.log("started configuring the node helper of " + this.name); 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; } }, -}); \ No newline at end of file +});