2013-10-25 14:06:29 +02:00
|
|
|
<!--
|
2015-07-02 00:45:34 +02:00
|
|
|
Copyright 2014.2015 IBM Corp.
|
2013-10-25 14:06:29 +02:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
-->
|
|
|
|
|
|
|
|
<script type="text/x-red" data-template-name="sensorTag">
|
|
|
|
<div class="form-row">
|
2015-07-02 00:45:34 +02:00
|
|
|
<label for="node-input-uuid"><i class="fa fa-ellipsis-h"></i> UUID</label>
|
|
|
|
<input type="text" id="node-input-uuid" placeholder="optional device bluetooth id">
|
2013-10-25 14:06:29 +02:00
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
2015-07-02 00:45:34 +02:00
|
|
|
<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/>
|
2013-10-25 14:06:29 +02:00
|
|
|
</div>
|
2013-11-22 14:58:41 +01:00
|
|
|
<div class="form-row">
|
2015-07-02 00:45:34 +02:00
|
|
|
<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">
|
2013-11-22 14:58:41 +01:00
|
|
|
</div>
|
2013-10-25 14:06:29 +02:00
|
|
|
<div class="form-row">
|
2015-07-02 00:45:34 +02:00
|
|
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
|
|
<input type="text" id="node-input-name" placeholder="Name">
|
2013-10-25 14:06:29 +02:00
|
|
|
</div>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/x-red" data-help-name="sensorTag">
|
2015-07-02 14:29:13 +02:00
|
|
|
<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
|
2015-07-02 00:45:34 +02:00
|
|
|
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,
|
2015-04-08 14:54:42 +02:00
|
|
|
if you add more than one to the canvas then only the first to connect
|
|
|
|
will work.</p>
|
2013-10-25 14:06:29 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
RED.nodes.registerType('sensorTag',{
|
2015-07-02 00:45:34 +02:00
|
|
|
category: 'advanced-function',
|
2013-10-25 14:06:29 +02:00
|
|
|
color:"GoldenRod",
|
2015-07-02 00:45:34 +02:00
|
|
|
defaults: {
|
|
|
|
name: {value:"sensorTag"},
|
2013-10-25 14:06:29 +02:00
|
|
|
topic: {value:"sensorTag"},
|
2013-11-22 14:58:41 +01:00
|
|
|
uuid: {value:undefined},
|
2013-10-25 14:06:29 +02:00
|
|
|
temperature: {value:true},
|
|
|
|
humidity: {value:true},
|
|
|
|
pressure: {value:true},
|
|
|
|
magnetometer: {value:true},
|
|
|
|
accelerometer: {value:true},
|
|
|
|
gyroscope: {value:true},
|
2015-07-02 00:45:34 +02:00
|
|
|
keys: {value:true},
|
|
|
|
luxometer: {value:false}
|
2013-10-25 14:06:29 +02:00
|
|
|
},
|
2015-07-02 00:45:34 +02:00
|
|
|
inputs:0,
|
|
|
|
outputs:1,
|
|
|
|
icon: "bluetooth.png",
|
|
|
|
label: function() {
|
2013-10-25 14:06:29 +02:00
|
|
|
return this.name||this.topic||"sensorTag";
|
|
|
|
},
|
2015-07-02 00:45:34 +02:00
|
|
|
labelStyle: function() {
|
2013-10-25 14:06:29 +02:00
|
|
|
return this.name?"node_label_italic":"";
|
2013-11-24 14:48:14 +01:00
|
|
|
},
|
|
|
|
oneditsave: function() {
|
|
|
|
var mac = $("#node-input-uuid").val();
|
2014-02-25 12:18:45 +01:00
|
|
|
mac = mac.toLowerCase();
|
2015-07-02 00:45:34 +02:00
|
|
|
// nasty hack as I can't get global replace to work
|
2013-11-24 14:48:14 +01:00
|
|
|
mac = mac.replace(/:/gi,'');
|
|
|
|
mac = mac.replace(/:/gi,'');
|
|
|
|
mac = mac.replace(/:/gi,'');
|
|
|
|
mac = mac.replace(/:/gi,'');
|
|
|
|
mac = mac.toLowerCase();
|
|
|
|
$("#node-input-uuid").val(mac);
|
2013-10-25 14:06:29 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|