mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Catch blink1 missing device error
This commit is contained in:
parent
f550024bb2
commit
a5adbc2207
@ -30,6 +30,7 @@ module.exports = function(RED) {
|
|||||||
var p1 = /^\#[A-Fa-f0-9]{6}$/
|
var p1 = /^\#[A-Fa-f0-9]{6}$/
|
||||||
var p2 = /[0-9]+,[0-9]+,[0-9]+/
|
var p2 = /[0-9]+,[0-9]+,[0-9]+/
|
||||||
this.on("input", function(msg) {
|
this.on("input", function(msg) {
|
||||||
|
try {
|
||||||
blink1 = blink1 || new Blink1.Blink1();
|
blink1 = blink1 || new Blink1.Blink1();
|
||||||
if (blink1) {
|
if (blink1) {
|
||||||
var r,g,b;
|
var r,g,b;
|
||||||
@ -70,6 +71,7 @@ module.exports = function(RED) {
|
|||||||
else {
|
else {
|
||||||
node.warn("Blink1 : not found");
|
node.warn("Blink1 : not found");
|
||||||
}
|
}
|
||||||
|
} catch (e) { node.warn("Blink1 : device not found"); blink1 = null; }
|
||||||
});
|
});
|
||||||
this.on("close", function() {
|
this.on("close", function() {
|
||||||
if (blink1 && typeof blink1.close == "function") {
|
if (blink1 && typeof blink1.close == "function") {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-blink1",
|
"name" : "node-red-node-blink1",
|
||||||
"version" : "0.0.2",
|
"version" : "0.0.3",
|
||||||
"description" : "A Node-RED node to control a Thingm Blink(1)",
|
"description" : "A Node-RED node to control a Thingm Blink(1)",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
"node-blink1" : "0.1.2"
|
"node-blink1" : "0.1.2"
|
||||||
|
Loading…
Reference in New Issue
Block a user