diff --git a/alexa.html b/alexa.html index 42779c4..76a9ee2 100644 --- a/alexa.html +++ b/alexa.html @@ -70,8 +70,9 @@
+
@@ -98,6 +99,17 @@ "extraInfo": {}, "value": 50 } +

This is a full list of the currently valid commands:

+ \ No newline at end of file diff --git a/alexa.js b/alexa.js index e08c052..66ab51d 100644 --- a/alexa.js +++ b/alexa.js @@ -148,13 +148,28 @@ module.exports = function(RED) { }; RED.httpAdmin.post('/alexa-home/new-account',function(req,res){ - console.log(req.body); + //console.log(req.body); var username = req.body.user; var password = req.body.pass; var id = req.body.id; getDevices(username,password,id); }); + RED.httpAdmin.post('/alexa-home/refresh/:id',function(req,res){ + var id = req.params.id; + var conf = RED.nodes.getNode(id); + if (conf) { + var username = conf.username; + var password = conf.credentials.password; + getDevices(username,password,id); + res.status(200).send(); + } else { + //not deployed yet + console.log("Can't refresh until deployed"); + res.status(404).send(); + } + }); + RED.httpAdmin.get('/alexa-home/devices/:id',function(req,res){ if (devices[req.params.id]) { res.send(devices[req.params.id]);