Fix sensortag to still work with "old" tags ;-)

This commit is contained in:
dceejay 2015-07-02 13:29:13 +01:00
parent 91dc58d2b0
commit 6aa5500d34
3 changed files with 19 additions and 15 deletions

View File

@ -48,15 +48,15 @@
</script>
<script type="text/x-red" data-help-name="sensorTag">
<p>Input node for the Ti SensorTag</p>
<p>For this node to work correctly Node-Red needs to be run as <i>root</i>
, this due to how Bluetooth 4.0 support is currently implemented in
Linux</p>
<p>The UUID field is the mac address of the sensor tag, this is optional
can be used to bind to a specific SensorTag if you have more than one
active in range at the same time. (note you can only have one SensorTag
per node-red instance at the moment)</p>
<p>The topic setting is a prefix that will be pre-pended to name of the
<p>Node to read from the Ti SensorTag</p>
<p>For this node to work correctly on Linux, Node-Red needs to be run as
<i>root</i>, this due to how Bluetooth 4.0 support is currently implemented
in Linux.</p>
<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
active in range at the same time. <b>Note</b>: you can only have one SensorTag
per node-red instance at the moment.</p>
<p>The topic 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
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,

View File

@ -89,7 +89,7 @@ module.exports = function(RED) {
msg.payload = {'left': left, 'right': right};
node.send(msg);
});
sensorTag.enableLuxometer(function() {});
sensorTag.on('luxometerChange', function(lux) {
var msg = {'topic': node.topic + '/luxometer'};
msg.payload = {'lux': parseInt(lux)};
@ -142,10 +142,14 @@ module.exports = function(RED) {
} else {
node.stag.unnotifyGyroscope(function() {});
}
if (node.luxometer) {
node.stag.notifyLuxometer(function() {});
} else {
node.stag.unnotifyLuxometer(function() {});
if (node.stag.type === "cc2560") {
if (node.luxometer) {
node.stag.enableLuxometer(function() {});
node.stag.notifyLuxometer(function() {});
} else {
node.stag.unnotifyLuxometer(function() {});
node.stag.disableLuxometer(function() {});
}
}
if (node.keys) {
node.stag.notifySimpleKey(function() {});

View File

@ -1,7 +1,7 @@
{
"name": "node-red-node-sensortag",
"description": "A Node-RED node to read data from a TI SensorTag",
"version": "0.0.5",
"version": "0.0.6",
"keywords" : ["node-red","sensortag"],
"dependencies": {
"sensortag": "~1.0.1"