Make blink1 (and ledborg) consistent with both docs and cheerlight colours

Close #102
This commit is contained in:
dceejay
2015-03-12 11:12:44 +00:00
parent 7307891aee
commit 7135bb3067
6 changed files with 17 additions and 9 deletions

View File

@@ -52,8 +52,9 @@ module.exports = function(RED) {
else {
// you can add fancy colours by name here if you want...
// these are the @cheerlight ones.
var colors = {"red":"#FF0000","green":"#00FF00","blue":"#0000FF","cyan":"#00FFFF","white":"#FFFFFF","warmwhite":"#FDF5E6",
"purple":"#800080","magenta":"#FF00FF","yellow":"#FFFF00","amber":"#FFD200","orange":"#FFA500","black":"#000000"}
var colors = {"red":"#FF0000","green":"#00FF00","blue":"#0000FF","cyan":"#00FFFF",
"white":"#FFFFFF","warmwhite":"#FDF5E6","oldlace":"#FDF5E6","purple":"#800080","magenta":"#FF00FF",
"yellow":"#FFFF00","amber":"#FFD200","orange":"#FFA500","black":"#000000","pink","#FF69B4"}
if (msg.payload.toLowerCase() in colors) {
var c = colors[msg.payload.toLowerCase()];
r = parseInt(c.slice(1,3),16);
@@ -66,12 +67,12 @@ module.exports = function(RED) {
node.warn("Blink1 : invalid msg : "+msg.payload);
}
}
} catch (e) { node.warn("Blink1 : error"); blink1 = null; }
} catch (e) { node.error("Blink1 : error"); blink1 = null; }
}
else {
node.warn("Blink1 : not found");
}
} catch (e) { node.warn("Blink1 : device not found"); blink1 = null; }
} catch (e) { node.error("Blink1 : device not found"); blink1 = null; }
});
this.on("close", function() {
if (blink1 && typeof blink1.close == "function") {