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

update SensorTag node to add Pi instructions

This commit is contained in:
Dave Conway-Jones 2016-03-02 21:58:24 +00:00
parent 7da9f46c65
commit ae670f0e69
3 changed files with 43 additions and 32 deletions

View File

@ -21,21 +21,21 @@
</div> </div>
<div class="form-row"> <div class="form-row">
<label for="node-input-name"><i class="fa fa-external-link"></i> Outputs</label> <label for="node-input-name"><i class="fa fa-external-link"></i> Outputs</label>
<input type="checkbox" id="node-input-humidity" style="display: inline-block; width: auto; vertical-align: top;"> Temperature and Humidity<br/> <input type="checkbox" id="node-input-humidity" style="display:inline-block; width:auto; vertical-align:top;"> Temperature and Humidity<br/>
<label>&nbsp;</label> <label>&nbsp;</label>
<input type="checkbox" id="node-input-temperature" style="display: inline-block; width: auto; vertical-align: top;"> IR Temperature<br/> <input type="checkbox" id="node-input-temperature" style="display:inline-block; width:auto; vertical-align:top;"> IR Temperature<br/>
<label>&nbsp;</label> <label>&nbsp;</label>
<input type="checkbox" id="node-input-pressure" style="display: inline-block; width: auto; vertical-align: top;"> Pressure<br/> <input type="checkbox" id="node-input-pressure" style="display:inline-block; width:auto; vertical-align:top;"> Pressure<br/>
<label>&nbsp;</label> <label>&nbsp;</label>
<input type="checkbox" id="node-input-magnetometer" style="display: inline-block; width: auto; vertical-align: top;"> Magnetometer<br/> <input type="checkbox" id="node-input-magnetometer" style="display:inline-block; width:auto; vertical-align:top;"> Magnetometer<br/>
<label>&nbsp;</label> <label>&nbsp;</label>
<input type="checkbox" id="node-input-accelerometer" style="display: inline-block; width: auto; vertical-align: top;"> Accelerometer<br/> <input type="checkbox" id="node-input-accelerometer" style="display:inline-block; width:auto; vertical-align:top;"> Accelerometer<br/>
<label>&nbsp;</label> <label>&nbsp;</label>
<input type="checkbox" id="node-input-gyroscope" style="display: inline-block; width: auto; vertical-align: top;"> Gyroscope<br/> <input type="checkbox" id="node-input-gyroscope" style="display:inline-block; width:auto; vertical-align:top;"> Gyroscope<br/>
<label>&nbsp;</label> <label>&nbsp;</label>
<input type="checkbox" id="node-input-luxometer" style="display: inline-block; width: auto; vertical-align: top;"> Luminosity (CC2650 only)<br/> <input type="checkbox" id="node-input-luxometer" style="display:inline-block; width:auto; vertical-align:top;"> Luminosity (CC2650 only)<br/>
<label>&nbsp;</label> <label>&nbsp;</label>
<input type="checkbox" id="node-input-keys" style="display: inline-block; width: auto; vertical-align: top;"> Button press<br/> <input type="checkbox" id="node-input-keys" style="display:inline-block; width:auto; vertical-align:top;"> Button press<br/>
</div> </div>
<div class="form-row"> <div class="form-row">
<label for="node-input-topic"><i class="fa fa-tasks"></i> Topic</label> <label for="node-input-topic"><i class="fa fa-tasks"></i> Topic</label>
@ -54,7 +54,7 @@
in Linux.</p> in Linux.</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. <b>Note</b>:you can only have one SensorTag
per node-red instance at the moment.</p> 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 <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 sensor that creates the reading. e.g. <i>sensorTag/temperature</i>. If
@ -62,35 +62,36 @@
<p><strong>NOTE:</strong> Only 1 sensorTag can be read from at a time, <p><strong>NOTE:</strong> Only 1 sensorTag can be read from 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>
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
RED.nodes.registerType('sensorTag',{ RED.nodes.registerType('sensorTag',{
category: 'advanced-function', category:'advanced-function',
color:"GoldenRod", color:"GoldenRod",
defaults: { defaults:{
name: {value:"sensorTag"}, name:{value:"sensorTag"},
topic: {value:"sensorTag"}, topic:{value:"sensorTag"},
uuid: {value:undefined}, uuid:{value:undefined},
temperature: {value:true}, temperature:{value:true},
humidity: {value:true}, humidity:{value:true},
pressure: {value:true}, pressure:{value:true},
magnetometer: {value:true}, magnetometer:{value:true},
accelerometer: {value:true}, accelerometer:{value:true},
gyroscope: {value:true}, gyroscope:{value:true},
keys: {value:true}, keys:{value:true},
luxometer: {value:false} luxometer:{value:false}
}, },
inputs:0, inputs:0,
outputs:1, outputs:1,
icon: "bluetooth.png", icon:"bluetooth.png",
label: function() { label:function() {
return this.name||this.topic||"sensorTag"; return this.name||this.topic||"sensorTag";
}, },
labelStyle: function() { labelStyle:function() {
return this.name?"node_label_italic":""; return this.name?"node_label_italic":"";
}, },
oneditsave: function() { oneditsave:function() {
var mac = $("#node-input-uuid").val(); var mac = $("#node-input-uuid").val();
mac = mac.toLowerCase(); mac = mac.toLowerCase();
// nasty hack as I can't get global replace to work // nasty hack as I can't get global replace to work

View File

@ -3,6 +3,20 @@ node-red-node-sensortag
This node adds support to Node-RED to read from the Texas Instruments SensorTag. This node adds support to Node-RED to read from the Texas Instruments SensorTag.
Pre-requisites
--------------
You will need a suitable Bluetooth Low Energy (BLE) stack and drivers for your hardware
- for example Bluez 5.2.x or better.
#### Raspberry Pi
Install Bluetooth drivers and bluez stack, and set executeable by non-root user
sudo apt-get install libbluetooth-dev libudev-dev pi-bluetooth
sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)
Install Install
------- -------
@ -10,10 +24,6 @@ Run the following command in your Node-RED user directory - typically `~/.node-r
npm i node-red-node-sensortag npm i node-red-node-sensortag
You will also need a suitable BLE dongle and an enabled Bluetooth stack - for example Bluez 5.2.x or better.
On a Raspberry Pi this can be installed (as of Feb 2016) by
sudo apt-get install pi-bluetooth
Usage Usage
----- -----

View File

@ -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.10", "version": "0.0.11",
"keywords": [ "keywords": [
"node-red", "node-red",
"sensortag", "sensortag",