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",
|
"name": "node-red-node-physical-web",
|
||||||
"version": "0.0.7",
|
"version": "0.0.8",
|
||||||
"description": "Node-RED nodes to interact with the Physical Web",
|
"description": "Node-RED nodes to interact with the Physical Web",
|
||||||
"main": "physical-web.js",
|
"main": "physical-web.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -24,50 +24,41 @@
|
|||||||
|
|
||||||
<script type="text/x-red" data-help-name="PhysicalWeb in">
|
<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><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>
|
<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>
|
<ul>
|
||||||
<li><strong>URL</strong> -
|
<li>`type` - Eddystone type</li>
|
||||||
<ul>
|
<li>`txPower` - Received power at 0m in dBm</li>
|
||||||
<li>type - Eddystone type</li>
|
<li>`url` - The URL the beacon is broadcasting</li>
|
||||||
<li>txPower - Received power at 0m in dBm</li>
|
<li>`tlm` - TLM data, if the device is interleaving broadcasts</li>
|
||||||
<li>url - The URL the beacon is broadcasting</li>
|
<li>`rssi` - RSSI of the beacon</li>
|
||||||
<li>tlm - TLM data, if the device is interleaving broadcasts</li>
|
<li>`distance` - Estimated distance to the beacon</li>
|
||||||
<li>rssi - RSSI of the beacon</li>
|
|
||||||
<li>distance - Estimated distance to the beacon</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
<p>or a <b>UID</b> type:</p>
|
||||||
<li><strong>UID</strong> -
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>type - Eddystone type</li>
|
<li>`type` - Eddystone type</li>
|
||||||
<li>txPower - Received power at 0m in dBm</li>
|
<li>`txPower` - Received power at 0m in dBm</li>
|
||||||
<li>namespace - 10-byte ID of namspace</li>
|
<li>`namespace` - 10-byte ID of namspace</li>
|
||||||
<li>instance - 6-byte ID insance</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>rssi - RSSI of the beacon</li>
|
<li>`distance` - Estimated distance to the beacon</li>
|
||||||
<li>distance - Estimated distance to the beacon</li>
|
<li>`tlm` - TLM data, if the device is interleaving broadcasts</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
<p>Where the `tlm` data will be an object containing:</p>
|
||||||
</ul>
|
|
||||||
<p>Where the tlm data will be in the following format</p>
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>tlm -
|
<li>`version` - TML version</li>
|
||||||
<ul>
|
<li>`vbatt` - Battery Voltage</li>
|
||||||
<li>version - TML version</li>
|
<li>`temp` - Temperature</li>
|
||||||
<li>vbatt - Battery Voltage</li>
|
<li>`advCnt` - Advertising PDU count</li>
|
||||||
<li>temp - Temperature</li>
|
<li>`secCnt` - Time since power on or reboot</li>
|
||||||
<li>advCnt - Advertising PDU count</li>
|
|
||||||
<li>secCnt - Time since power on or reboot</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
|
||||||
<li>rssi - RSSI of diecovered beacon</li>
|
|
||||||
<li>distance - Approximate distance to beacon</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<p>Linux users should <a href="https://github.com/sandeepmistry/bleno#running-on-linux" target="_new">READ THIS</a>.</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('PhysicalWeb in',{
|
RED.nodes.registerType('PhysicalWeb in',{
|
||||||
category: 'Physical_Web',
|
category: 'input',
|
||||||
defaults: {
|
defaults: {
|
||||||
name: {value:""},
|
name: {value:""},
|
||||||
topic: {value:"eddystone"}
|
topic: {value:"eddystone"}
|
||||||
@ -110,21 +101,22 @@
|
|||||||
|
|
||||||
<script type="text/x-red" data-help-name="PhysicalWeb out">
|
<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><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>
|
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)
|
<p>You can also preset the URL, in which case the node does not require any input.</p>
|
||||||
between anouncements</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>
|
<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('PhysicalWeb out',{
|
RED.nodes.registerType('PhysicalWeb out',{
|
||||||
category: 'Physical_Web',
|
category: 'output',
|
||||||
defaults: {
|
defaults: {
|
||||||
name: {value:""},
|
name: {value:""},
|
||||||
url: {value:"",validate:function(v) {return v.length<19; }},
|
url: {value:"",validate:function(v) {return v.length<19; }},
|
||||||
power: {value:"-21",validate:RED.validators.number()},
|
power: {value:"-21",validate:RED.validators.number()},
|
||||||
period: {value:"10",validate:RED.validators.number()}
|
period: {value:"1",validate:RED.validators.number()}
|
||||||
},
|
},
|
||||||
color: "#2F7ACD",
|
color: "#2F7ACD",
|
||||||
inputs:1,
|
inputs:1,
|
||||||
|
@ -18,12 +18,13 @@ module.exports = function(RED) {
|
|||||||
"use strict";
|
"use strict";
|
||||||
var eddystoneBeacon = require('eddystone-beacon');
|
var eddystoneBeacon = require('eddystone-beacon');
|
||||||
var EddystoneBeaconScanner = require('eddystone-beacon-scanner');
|
var EddystoneBeaconScanner = require('eddystone-beacon-scanner');
|
||||||
|
var eddyBeacon = false;
|
||||||
|
|
||||||
function Beacon(n) {
|
function Beacon(n) {
|
||||||
RED.nodes.createNode(this,n);
|
RED.nodes.createNode(this,n);
|
||||||
var node = this;
|
var node = this;
|
||||||
node.power = n.power;
|
node.power = n.power;
|
||||||
node.period = n.period;
|
node.period = n.period * 10;
|
||||||
node.url = n.url;
|
node.url = n.url;
|
||||||
|
|
||||||
node.options = {
|
node.options = {
|
||||||
@ -33,23 +34,32 @@ module.exports = function(RED) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (node.url) {
|
if (node.url) {
|
||||||
|
if (!eddyBeacon) {
|
||||||
|
eddyBeacon = true;
|
||||||
try {
|
try {
|
||||||
eddystoneBeacon.advertiseUrl(node.url, node.options);
|
eddystoneBeacon.advertiseUrl(node.url, node.options);
|
||||||
|
node.status({fill:"green",shape:"dot",text:node.url});
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
node.error('Error setting beacon URL', e);
|
node.error('Error setting beacon URL', e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {node.warn('Beacon node already in use');}
|
||||||
|
}
|
||||||
|
|
||||||
node.on('input', function(msg) {
|
node.on('input', function(msg) {
|
||||||
try {
|
try {
|
||||||
eddystoneBeacon.advertiseUrl(msg.payload, node.options);
|
eddystoneBeacon.advertiseUrl(msg.payload, node.options);
|
||||||
|
node.status({fill:"green",shape:"dot",text:node.url.toString()});
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
node.status({fill:"red",shape:"circle",text:"URL too long"});
|
||||||
node.error('error updating beacon URL', e);
|
node.error('error updating beacon URL', e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
node.on('close', function(done) {
|
node.on('close', function(done) {
|
||||||
|
eddyBeacon = false;
|
||||||
try {
|
try {
|
||||||
|
node.status({});
|
||||||
eddystoneBeacon.stop();
|
eddystoneBeacon.stop();
|
||||||
done();
|
done();
|
||||||
} catch(e) {
|
} 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");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with 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">
|
<script type="text/x-red" data-help-name="sensorTag">
|
||||||
<p>Node to read from the Ti SensorTag</p>
|
<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
|
<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 <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
|
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>
|
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,
|
<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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -11,7 +11,7 @@ You will need a suitable Bluetooth Low Energy (BLE) stack and drivers for your h
|
|||||||
|
|
||||||
#### Raspberry Pi
|
#### 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 apt-get install libbluetooth-dev libudev-dev pi-bluetooth
|
||||||
sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)
|
sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)
|
||||||
@ -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 } }
|
* Luxometer - { topic: [topic_prefix]/luxometer , payload: { lux: 212 } }
|
||||||
* Buttons - { topic: [topic_prefix]/keys , payload: { left: true, right: false} }
|
* 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**: This sensorTag library 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
|
|
||||||
|
@ -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.11",
|
"version": "0.0.12",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"node-red",
|
"node-red",
|
||||||
"sensortag",
|
"sensortag",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user