mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
More BLE node doc/info updates
for Sensortag and physical-web nodes. Added info, and node Status.
This commit is contained in:
parent
ea9c5f8474
commit
20f14a698c
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "node-red-node-physical-web",
|
||||
"version": "0.0.7",
|
||||
"version": "0.0.8",
|
||||
"description": "Node-RED nodes to interact with the Physical Web",
|
||||
"main": "physical-web.js",
|
||||
"scripts": {
|
||||
|
@ -24,50 +24,41 @@
|
||||
|
||||
<script type="text/x-red" data-help-name="PhysicalWeb in">
|
||||
<p><a href="https://google.github.io/physical-web/">Physical Web</a> node to scan for Eddystone beacons.</p>
|
||||
<p>This node scans for Eddystones and publishes what it finds. It can output 2 types of message</p>
|
||||
<ul>
|
||||
<li><strong>URL</strong> -
|
||||
<ul>
|
||||
<li>type - Eddystone type</li>
|
||||
<li>txPower - Received power at 0m in dBm</li>
|
||||
<li>url - The URL the beacon is broadcasting</li>
|
||||
<li>tlm - TLM data, if the device is interleaving broadcasts</li>
|
||||
<li>rssi - RSSI of the beacon</li>
|
||||
<li>distance - Estimated distance to the beacon</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>UID</strong> -
|
||||
<ul>
|
||||
<li>type - Eddystone type</li>
|
||||
<li>txPower - Received power at 0m in dBm</li>
|
||||
<li>namespace - 10-byte ID of namspace</li>
|
||||
<li>instance - 6-byte ID insance</li>
|
||||
<li>tlm - TLM data, if the device is interleaving broadcasts</li>
|
||||
<li>rssi - RSSI of the beacon</li>
|
||||
<li>distance - Estimated distance to the beacon</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<p>Where the tlm data will be in the following format</p>
|
||||
<ul>
|
||||
<li>tlm -
|
||||
<ul>
|
||||
<li>version - TML version</li>
|
||||
<li>vbatt - Battery Voltage</li>
|
||||
<li>temp - Temperature</li>
|
||||
<li>advCnt - Advertising PDU count</li>
|
||||
<li>secCnt - Time since power on or reboot</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>rssi - RSSI of diecovered beacon</li>
|
||||
<li>distance - Approximate distance to beacon</li>
|
||||
<p>This node scans for Eddystones and publishes what it finds. It can output 2 types of `msg.payload`</p>
|
||||
<p>Either a <b>URL</b> type:</p>
|
||||
<ul>
|
||||
<li>`type` - Eddystone type</li>
|
||||
<li>`txPower` - Received power at 0m in dBm</li>
|
||||
<li>`url` - The URL the beacon is broadcasting</li>
|
||||
<li>`tlm` - TLM data, if the device is interleaving broadcasts</li>
|
||||
<li>`rssi` - RSSI of the beacon</li>
|
||||
<li>`distance` - Estimated distance to the beacon</li>
|
||||
</ul>
|
||||
<p>or a <b>UID</b> type:</p>
|
||||
<ul>
|
||||
<li>`type` - Eddystone type</li>
|
||||
<li>`txPower` - Received power at 0m in dBm</li>
|
||||
<li>`namespace` - 10-byte ID of namspace</li>
|
||||
<li>`instance` - 6-byte ID insance</li>
|
||||
<li>`rssi` - RSSI of the beacon</li>
|
||||
<li>`distance` - Estimated distance to the beacon</li>
|
||||
<li>`tlm` - TLM data, if the device is interleaving broadcasts</li>
|
||||
</ul>
|
||||
<p>Where the `tlm` data will be an object containing:</p>
|
||||
<ul>
|
||||
<li>`version` - TML version</li>
|
||||
<li>`vbatt` - Battery Voltage</li>
|
||||
<li>`temp` - Temperature</li>
|
||||
<li>`advCnt` - Advertising PDU count</li>
|
||||
<li>`secCnt` - Time since power on or reboot</li>
|
||||
</ul>
|
||||
</ul>
|
||||
<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('PhysicalWeb in',{
|
||||
category: 'Physical_Web',
|
||||
category: 'input',
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
topic: {value:"eddystone"}
|
||||
@ -110,21 +101,22 @@
|
||||
|
||||
<script type="text/x-red" data-help-name="PhysicalWeb out">
|
||||
<p><a href="https://google.github.io/physical-web/">Physical Web</a> beacon node.</p>
|
||||
<p>This node takes the value of <code>msg.payload</code> and publishes it as an Eddystone URL
|
||||
<p>This node can take the value of <code>msg.payload</code> and publishes it as an Eddystone URL
|
||||
announcement. URLs <b>must</b> be less than 18 bytes long, so should be run through a shortner first.</p>
|
||||
<p>The config window will allow you to set the powerlevel (-30 to 100 db) and the period (ms)
|
||||
between anouncements</p>
|
||||
<p>You can also preset the URL, in which case the node does not require any input.</p>
|
||||
<p>The config window will allow you to set the powerlevel (-30 to 100 db) and the period (S)
|
||||
between anouncements.</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('PhysicalWeb out',{
|
||||
category: 'Physical_Web',
|
||||
category: 'output',
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
url: {value:"",validate:function(v) {return v.length<19; }},
|
||||
power: {value:"-21",validate:RED.validators.number()},
|
||||
period: {value:"10",validate:RED.validators.number()}
|
||||
period: {value:"1",validate:RED.validators.number()}
|
||||
},
|
||||
color: "#2F7ACD",
|
||||
inputs:1,
|
||||
|
@ -18,12 +18,13 @@ module.exports = function(RED) {
|
||||
"use strict";
|
||||
var eddystoneBeacon = require('eddystone-beacon');
|
||||
var EddystoneBeaconScanner = require('eddystone-beacon-scanner');
|
||||
var eddyBeacon = false;
|
||||
|
||||
function Beacon(n) {
|
||||
RED.nodes.createNode(this,n);
|
||||
var node = this;
|
||||
node.power = n.power;
|
||||
node.period = n.period;
|
||||
node.period = n.period * 10;
|
||||
node.url = n.url;
|
||||
|
||||
node.options = {
|
||||
@ -33,23 +34,32 @@ module.exports = function(RED) {
|
||||
};
|
||||
|
||||
if (node.url) {
|
||||
try {
|
||||
eddystoneBeacon.advertiseUrl(node.url, node.options);
|
||||
} catch(e) {
|
||||
node.error('Error setting beacon URL', e);
|
||||
if (!eddyBeacon) {
|
||||
eddyBeacon = true;
|
||||
try {
|
||||
eddystoneBeacon.advertiseUrl(node.url, node.options);
|
||||
node.status({fill:"green",shape:"dot",text:node.url});
|
||||
} catch(e) {
|
||||
node.error('Error setting beacon URL', e);
|
||||
}
|
||||
}
|
||||
else {node.warn('Beacon node already in use');}
|
||||
}
|
||||
|
||||
node.on('input', function(msg) {
|
||||
try {
|
||||
eddystoneBeacon.advertiseUrl(msg.payload, node.options);
|
||||
node.status({fill:"green",shape:"dot",text:node.url.toString()});
|
||||
} catch(e) {
|
||||
node.status({fill:"red",shape:"circle",text:"URL too long"});
|
||||
node.error('error updating beacon URL', e);
|
||||
}
|
||||
});
|
||||
|
||||
node.on('close', function(done) {
|
||||
eddyBeacon = false;
|
||||
try {
|
||||
node.status({});
|
||||
eddystoneBeacon.stop();
|
||||
done();
|
||||
} catch(e) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Copyright 2014.2015 IBM Corp.
|
||||
Copyright 2014.2016 IBM Corp.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@ -49,14 +49,11 @@
|
||||
|
||||
<script type="text/x-red" data-help-name="sensorTag">
|
||||
<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
|
||||
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
|
||||
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,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2014,2015 IBM Corp.
|
||||
* Copyright 2014,2016 IBM Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -34,7 +34,7 @@ module.exports = function(RED) {
|
||||
if (this.uuid === "") { this.uuid = undefined; }
|
||||
var node = this;
|
||||
|
||||
if ( typeof node.stag === "undefined") {
|
||||
if (typeof node.stag === "undefined") {
|
||||
node.status({fill:"blue", shape:"dot", text:"discovering..."});
|
||||
|
||||
SensorTag.discover(function(sensorTag) {
|
||||
|
@ -11,7 +11,7 @@ You will need a suitable Bluetooth Low Energy (BLE) stack and drivers for your h
|
||||
|
||||
#### Raspberry Pi
|
||||
|
||||
Install Bluetooth drivers and bluez stack, and set executeable by non-root user
|
||||
Install Bluetooth drivers and bluez stack, and set executable 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`)
|
||||
@ -23,7 +23,7 @@ Install
|
||||
Run the following command in your Node-RED user directory - typically `~/.node-red`
|
||||
|
||||
npm i node-red-node-sensortag
|
||||
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
@ -51,6 +51,4 @@ these sensors will be sent as a JSON object payload with the sensor name appende
|
||||
* Luxometer - { topic: [topic_prefix]/luxometer , payload: { lux: 212 } }
|
||||
* Buttons - { topic: [topic_prefix]/keys , payload: { left: true, right: false} }
|
||||
|
||||
The sensorTag library used by this node only supports using 1 SensorTag at a time.
|
||||
|
||||
**NOTE:** On Linux Node-RED needs to be run as root in order or access the Linux Bluetooth 4.0 system calls
|
||||
**Note**: This sensorTag library only supports using 1 SensorTag at a time.
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "node-red-node-sensortag",
|
||||
"description": "A Node-RED node to read data from a TI SensorTag",
|
||||
"version": "0.0.11",
|
||||
"version": "0.0.12",
|
||||
"keywords": [
|
||||
"node-red",
|
||||
"sensortag",
|
||||
|
Loading…
Reference in New Issue
Block a user