mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
Re-added optional topic to avoid breaking compatibility
This commit is contained in:
parent
eef6f28e89
commit
6d32edc0f2
@ -11,6 +11,10 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<script type="text/x-red" data-template-name="PhysicalWeb in">
|
<script type="text/x-red" data-template-name="PhysicalWeb in">
|
||||||
|
<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="eddystone">
|
||||||
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label><i class="fa fa-list"></i> Duplicates</span></label>
|
<label><i class="fa fa-list"></i> Duplicates</span></label>
|
||||||
<input type="checkbox" id="node-input-duplicates" style="display: inline-block; width: auto; vertical-align: top;">
|
<input type="checkbox" id="node-input-duplicates" style="display: inline-block; width: auto; vertical-align: top;">
|
||||||
@ -26,6 +30,7 @@
|
|||||||
<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. The status of the Eddystone
|
<p>This node scans for Eddystones and publishes what it finds. The status of the Eddystone
|
||||||
(found, updated or lost) will be sent as <code>msg.topic</code> and the data as <code>msg.payload</code></p>
|
(found, updated or lost) will be sent as <code>msg.topic</code> and the data as <code>msg.payload</code></p>
|
||||||
|
<p>If a <code>topic</code> is specified in the node configuration, it will override the status.</p>
|
||||||
<p><b>URL</b> type:</p>
|
<p><b>URL</b> type:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><code>type</code> - Eddystone type</li>
|
<li><code>type</code> - Eddystone type</li>
|
||||||
@ -62,6 +67,7 @@
|
|||||||
category: 'input',
|
category: 'input',
|
||||||
defaults: {
|
defaults: {
|
||||||
name: {value:""},
|
name: {value:""},
|
||||||
|
topic: {value:""},
|
||||||
duplicates: {value: true}
|
duplicates: {value: true}
|
||||||
},
|
},
|
||||||
color: "#2F7ACD",
|
color: "#2F7ACD",
|
||||||
|
@ -187,24 +187,33 @@ module.exports = function(RED) {
|
|||||||
node.duplicates = n.duplicates;
|
node.duplicates = n.duplicates;
|
||||||
|
|
||||||
function onFound(beacon) {
|
function onFound(beacon) {
|
||||||
node.send({
|
var topic_data;
|
||||||
topic: 'found',
|
if (node.topic !== "") {
|
||||||
payload: beacon
|
topic_data = node.topic;
|
||||||
});
|
} else {
|
||||||
|
topic_data = 'found';
|
||||||
|
}
|
||||||
|
node.send({topic: topic_data, payload: beacon});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onUpdated(beacon) {
|
function onUpdated(beacon) {
|
||||||
node.send({
|
var topic_data;
|
||||||
topic: 'updated',
|
if (node.topic !== "") {
|
||||||
payload: beacon
|
topic_data = node.topic;
|
||||||
});
|
} else {
|
||||||
|
topic_data = 'updated';
|
||||||
|
}
|
||||||
|
node.send({topic: topic_data, payload: beacon});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onLost(beacon) {
|
function onLost(beacon) {
|
||||||
node.send({
|
var topic_data;
|
||||||
topic: 'lost',
|
if (node.topic !== "") {
|
||||||
payload: beacon
|
topic_data = node.topic;
|
||||||
});
|
} else {
|
||||||
|
topic_data = 'lost';
|
||||||
|
}
|
||||||
|
node.send({topic: topic_data, payload: beacon});
|
||||||
}
|
}
|
||||||
|
|
||||||
EddystoneBeaconScanner.on('found', onFound);
|
EddystoneBeaconScanner.on('found', onFound);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user