mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Handle users of old Blinkstick npm a bit more nicely.
Don't barf (quite so badly) on new API calls if they don't exist yet.
This commit is contained in:
parent
74a470c22e
commit
317aaa1b64
@ -60,9 +60,7 @@
|
|||||||
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-tips">Expects a msg.payload with either hex "#rrggbb" or decimal "red,green,blue" string.</div>
|
<div class="form-tips">Expects a msg.payload with either hex "#rrggbb" or decimal "red,green,blue" string, or HTML color name.</div>
|
||||||
|
|
||||||
</script>
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/x-red" data-help-name="blinkstick">
|
<script type="text/x-red" data-help-name="blinkstick">
|
||||||
|
@ -165,7 +165,14 @@ module.exports = function(RED) {
|
|||||||
node.led.setColor(node.color, blinkstickAnimationComplete);
|
node.led.setColor(node.color, blinkstickAnimationComplete);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
node.warn("BlinkStick missing ? " + err);
|
if (err.toString().indexOf("setColor") !== -1) {
|
||||||
|
node.led.setColour(node.color, blinkstickAnimationComplete);
|
||||||
|
node.warn("Old version - please upgrade Blinkstick npm");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
node.warn("BlinkStick missing ? " + err);
|
||||||
|
}
|
||||||
|
console.log(err);
|
||||||
//Reset animation
|
//Reset animation
|
||||||
animationComplete = true;
|
animationComplete = true;
|
||||||
//Clear color
|
//Clear color
|
||||||
@ -233,7 +240,8 @@ module.exports = function(RED) {
|
|||||||
|
|
||||||
if (Object.size(node.led) !== 0) {
|
if (Object.size(node.led) !== 0) {
|
||||||
//Close device and stop animations
|
//Close device and stop animations
|
||||||
this.led.close();
|
if (typeof this.led.close === "function") { this.led.close(); }
|
||||||
|
else { node.warn("Please upgrade blinkstick npm"); }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-blinkstick",
|
"name" : "node-red-node-blinkstick",
|
||||||
"version" : "0.1.0",
|
"version" : "0.1.1",
|
||||||
"description" : "A Node-RED node to control a Blinkstick",
|
"description" : "A Node-RED node to control a Blinkstick",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
"blinkstick" : "1.1.*"
|
"blinkstick" : "1.1.*"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user