mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
added a no bridge check
This commit is contained in:
parent
b35ff010e2
commit
6474f5888d
@ -72,6 +72,8 @@ function HueNode(n) {
|
|||||||
var msg2 = {};
|
var msg2 = {};
|
||||||
msg2.topic = this.topic;
|
msg2.topic = this.topic;
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
|
//check for found bridges
|
||||||
|
if(result[0]!=null) {
|
||||||
//save the IP address of the 1st bridge found
|
//save the IP address of the 1st bridge found
|
||||||
this.gw_ipaddress = result[0].ipaddress;
|
this.gw_ipaddress = result[0].ipaddress;
|
||||||
|
|
||||||
@ -106,6 +108,13 @@ function HueNode(n) {
|
|||||||
|
|
||||||
msg2.payload = 'Light with ID: '+node.lamp_id+ ' was set to '+status;
|
msg2.payload = 'Light with ID: '+node.lamp_id+ ' was set to '+status;
|
||||||
node.send(msg2);
|
node.send(msg2);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//bridge not found:
|
||||||
|
var msg = {};
|
||||||
|
msg.payload = "Bridge not found!";
|
||||||
|
node.send(msg);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user