mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
parent
68bd4cc036
commit
98d44004c9
@ -51,12 +51,11 @@
|
|||||||
<p>Node to read from the Ti SensorTag</p>
|
<p>Node to read from the Ti SensorTag</p>
|
||||||
<p>The UUID field is the bluetooth mac address of the sensor tag, this is optional
|
<p>The UUID field is the bluetooth mac address of the sensor tag, this is optional
|
||||||
and can be used to bind to a specific SensorTag if you have more than one
|
and can be used to bind to a specific SensorTag if you have more than one
|
||||||
active in range at the same time. <b>Note</b>:you can only have one SensorTag
|
active in range at the same time.
|
||||||
per Node-RED instance at the moment.</p>
|
|
||||||
<p>The <i>topic</i> setting is a prefix that will be pre-pended to the name of the
|
<p>The <i>topic</i> setting is a prefix that will be pre-pended to the name of the
|
||||||
sensor that creates the reading. e.g. <i>sensorTag/temperature</i>. If
|
sensor that creates the reading. e.g. <i>sensorTag/temperature</i>. If
|
||||||
blank it will be set to the UUID of the sensor tag.</p>
|
blank it will be set to the UUID of the sensor tag.</p>
|
||||||
<p><strong>NOTE:</strong> Only 1 sensorTag can be read from at a time,
|
<p><strong>Note:</strong> Currently the node can only read from 1 sensorTag at a time,
|
||||||
if you add more than one to the canvas then only the first to connect
|
if you add more than one to the canvas then only the first to connect
|
||||||
will work.</p>
|
will work.</p>
|
||||||
<p>Linux users should <a href="https://github.com/sandeepmistry/bleno#running-on-linux" target="_new">READ THIS</a>.</p>
|
<p>Linux users should <a href="https://github.com/sandeepmistry/bleno#running-on-linux" target="_new">READ THIS</a>.</p>
|
||||||
@ -67,7 +66,7 @@
|
|||||||
category:'advanced-function',
|
category:'advanced-function',
|
||||||
color:"GoldenRod",
|
color:"GoldenRod",
|
||||||
defaults:{
|
defaults:{
|
||||||
name:{value:"sensorTag"},
|
name:{value:""},
|
||||||
topic:{value:"sensorTag"},
|
topic:{value:"sensorTag"},
|
||||||
uuid:{value:undefined},
|
uuid:{value:undefined},
|
||||||
temperature:{value:true},
|
temperature:{value:true},
|
||||||
|
@ -33,10 +33,13 @@ module.exports = function(RED) {
|
|||||||
this.keys = n.keys;
|
this.keys = n.keys;
|
||||||
if (this.uuid === "") { this.uuid = undefined; }
|
if (this.uuid === "") { this.uuid = undefined; }
|
||||||
var node = this;
|
var node = this;
|
||||||
|
node.discovering = false;
|
||||||
|
|
||||||
if (typeof node.stag === "undefined") {
|
if (typeof node.stag === "undefined") {
|
||||||
|
node.loop = setInterval(function() {
|
||||||
|
if (!node.discovering) {
|
||||||
node.status({fill:"blue", shape:"dot", text:"discovering..."});
|
node.status({fill:"blue", shape:"dot", text:"discovering..."});
|
||||||
|
node.discovering = true;
|
||||||
SensorTag.discover(function(sensorTag) {
|
SensorTag.discover(function(sensorTag) {
|
||||||
node.status({fill:"blue", shape:"dot", text:"connecting"});
|
node.status({fill:"blue", shape:"dot", text:"connecting"});
|
||||||
node.stag = sensorTag;
|
node.stag = sensorTag;
|
||||||
@ -47,6 +50,7 @@ module.exports = function(RED) {
|
|||||||
node.status({fill:"green", shape:"dot", text:"connected"});
|
node.status({fill:"green", shape:"dot", text:"connected"});
|
||||||
|
|
||||||
sensorTag.on('disconnect', function() {
|
sensorTag.on('disconnect', function() {
|
||||||
|
node.discovering = false;
|
||||||
node.status({fill:"red", shape:"ring", text:"disconnected"});
|
node.status({fill:"red", shape:"ring", text:"disconnected"});
|
||||||
node.log("disconnected ",node.uuid);
|
node.log("disconnected ",node.uuid);
|
||||||
});
|
});
|
||||||
@ -108,15 +112,16 @@ module.exports = function(RED) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},node.uuid);
|
},node.uuid);
|
||||||
|
}
|
||||||
|
},15000);
|
||||||
} else {
|
} else {
|
||||||
console.log("reconfig",node.uuid);
|
console.log("reconfig",node.uuid);
|
||||||
enable(node);
|
enable(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.on("close", function() {
|
this.on("close", function() {
|
||||||
if (node.stag) {
|
if (node.loop) { clearInterval(node.loop); }
|
||||||
node.stag.disconnect(function() {});
|
if (node.stag) { node.stag.disconnect(function() {}); }
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "node-red-node-sensortag",
|
"name": "node-red-node-sensortag",
|
||||||
"description": "A Node-RED node to read data from a TI SensorTag",
|
"description": "A Node-RED node to read data from a TI SensorTag",
|
||||||
"version": "0.0.12",
|
"version": "0.0.13",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"node-red",
|
"node-red",
|
||||||
"sensortag",
|
"sensortag",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user