Fix typo bugs.

This commit is contained in:
Mark Hindess 2014-07-18 10:28:57 +01:00
parent 46b2327478
commit c4a7ec7ae9
1 changed files with 5 additions and 5 deletions

View File

@ -40,16 +40,16 @@ module.exports = function(RED) {
function WemoIn(n) {
RED.nodes.createNode(this,n);
this.ipaddr = n.ipaddr;
this.wemoSwitch = new WeMo(n.ipaddr);
this.wemoSwitch = new Wemo(n.ipaddr);
this.wemoSwitch.state = 0;
var node = this;
var tick = setInterval(function() {
wemoSwitch.getBinaryState(function(err, result) {
node.wemoSwitch.getBinaryState(function(err, result) {
if (err) { node.warn(err); }
if (parseInt(result) != wemoSwitch.state) {
wemoSwitch.state = parseInt(result);
node.send({payload:wemoSwitch.state,topic:"wemo/"+node.ipaddr});
if (parseInt(result) != node.wemoSwitch.state) {
node.wemoSwitch.state = parseInt(result);
node.send({payload:node.wemoSwitch.state,topic:"wemo/"+node.ipaddr});
}
});
}, 2000);