mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Add @cheerlights colour handling to LEDBorg node for Pi...
(just because)
This commit is contained in:
parent
914885dd6b
commit
0e955ea120
@ -45,7 +45,19 @@ function LedBorgNode(n) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
node.warn("Invalid LedBorg colour code");
|
// 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",
|
||||||
|
"warmwhite":"221","purple":"101","magenta":"202","yellow":"220","orange":"210","black":"000"}
|
||||||
|
if (msg.payload.toLowerCase() in colors) {
|
||||||
|
var c = colors[msg.payload.toLowerCase()];
|
||||||
|
fs.writeFile('/dev/ledborg', c, function (err) {
|
||||||
|
if (err) node.warn(msg.payload+" : No LedBorg found");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
node.warn("Invalid LedBorg colour code");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user