1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

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

@ -74,7 +74,7 @@ module.exports = function(RED) {
else {
// you can add fancy colours by name here if you want...
// these are the @cheerlight ones.
var colors = {"red":"200","green":"020","blue":"002","cyan":"022","white":"222","pink":"201",
var colors = {"red":"200","green":"020","blue":"002","cyan":"022","white":"222","pink":"201","oldlace":"221",
"warmwhite":"221","purple":"101","magenta":"202","yellow":"220","amber":"220","orange":"210","black":"000"}
if (msg.payload.toLowerCase() in colors) {
rgb = colors[msg.payload.toLowerCase()];

View File

@ -1,6 +1,6 @@
{
"name" : "node-red-node-ledborg",
"version" : "0.0.3",
"version" : "0.0.4",
"description" : "A Node-RED node to control a PiBorg LedBorg board for a Raspberry Pi.",
"dependencies" : {
},

View File

@ -28,7 +28,7 @@
<script type="text/x-red" data-help-name="blink1">
<p>ThingM Blink1 output node.</p>
<p>Expects a msg.payload with either a three part csv string of r,g,b or a hex colour #rrggbb</p>
<p>Also accepts cheerlight colour names.</p>
<p>Also accepts <a hred="http://www.cheerlights.com/control-cheerlights" target="_new"></a>cheerlight</a> colour names.</p>
</script>
<script type="text/javascript">

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") {

View File

@ -3,6 +3,13 @@ node-red-node-blink1
A <a href="http://nodered.org" target="_new">Node-RED</a> node to control a <a href="http://thingm.com/products/blink-1/" target="_new">Thingm Blink(1)</a> LED.
Pre-requisites
--------------
As the blink1 is a USB HID device you may need some extra hardware libraries as
documented <a href="https://www.npmjs.com/package/node-blink1" target="_new">here</a>
and <a href="https://github.com/todbot/blink1/blob/master/linux/51-blink1.rules" target="_new">here</a>.
Install
-------

View File

@ -1,9 +1,9 @@
{
"name" : "node-red-node-blink1",
"version" : "0.0.3",
"version" : "0.0.5",
"description" : "A Node-RED node to control a Thingm Blink(1)",
"dependencies" : {
"node-blink1" : "0.1.2"
"node-blink1" : "0.1.5"
},
"repository" : {
"type":"git",