@dbruno74/node-red-node-sensortag
Version:
A Node-RED node to read data from a TI SensorTag
83 lines (79 loc) • 4.26 kB
HTML
<script type="text/x-red" data-template-name="sensorTag">
<div class="form-row">
<label for="node-input-address"><i class="fa fa-ellipsis-h"></i> Address</label>
<input type="text" id="node-input-address" placeholder="optional device bluetooth address">
</div>
<div class="form-row">
<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/>
<label> </label>
<input type="checkbox" id="node-input-temperature" style="display:inline-block; width:auto; vertical-align:top;"> IR Temperature<br/>
<label> </label>
<input type="checkbox" id="node-input-pressure" style="display:inline-block; width:auto; vertical-align:top;"> Pressure<br/>
<label> </label>
<input type="checkbox" id="node-input-magnetometer" style="display:inline-block; width:auto; vertical-align:top;"> Magnetometer<br/>
<label> </label>
<input type="checkbox" id="node-input-accelerometer" style="display:inline-block; width:auto; vertical-align:top;"> Accelerometer<br/>
<label> </label>
<input type="checkbox" id="node-input-gyroscope" style="display:inline-block; width:auto; vertical-align:top;"> Gyroscope<br/>
<label> </label>
<input type="checkbox" id="node-input-luxometer" style="display:inline-block; width:auto; vertical-align:top;"> Luminosity (CC2650 only)<br/>
<label> </label>
<input type="checkbox" id="node-input-keys" style="display:inline-block; width:auto; vertical-align:top;"> Button press<br/>
<label> </label>
<input type="checkbox" id="node-input-button" style="display:inline-block; width:auto; vertical-align:top;"> Button press (CC1352)<br/>
<label> </label>
<input type="checkbox" id="node-input-battery" style="display:inline-block; width:auto; vertical-align:top;"> Battery Level<br/>
</div>
<div class="form-row">
<label for="node-input-topic"><i class="fa fa-tasks"></i> Topic</label>
<input type="text" id="node-input-topic" placeholder="optional topic prefix - defaults to device id">
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
</script>
<script type="text/x-red" data-help-name="sensorTag">
<p>Node to read from the Ti SensorTag</p>
<p>The Address 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.
<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
blank it will be set to the address of the sensor tag.</p>
<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
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 type="text/javascript">
RED.nodes.registerType('sensorTag',{
category:'advanced-function',
color:"GoldenRod",
defaults:{
name:{value:""},
topic:{value:"sensorTag"},
address:{value:""},
temperature:{value:true},
humidity:{value:true},
pressure:{value:true},
magnetometer:{value:true},
accelerometer:{value:true},
gyroscope:{value:true},
keys:{value:true},
button:{value:true},
luxometer:{value:false},
battery:{value:true}
},
inputs:1,
outputs:1,
icon:"bluetooth.png",
label:function() {
return this.name||this.topic||"sensorTag";
},
labelStyle:function() {
return this.name?"node_label_italic":"";
},
});
</script>