Calculating The Lngth Of Files (Number Of Lines); Subsribe Once And Filter In Node-Red; Node_Red Does Not "Scan; Getting Data From Wzzard, Adam, And Wise Units Using Node-Red - Advantech SMARTSWARM 300 Series User Manual

Table of Contents

Advertisement

7.3.6 CALCULATING THE LNGTH OF FILES (NUMBER OF LINES)

Of course, you will need to be able to determine the number of lines in a file to decide when to start truncating the
top. This can be achieved using an 'exec' node as follows:
Note that the '-I' element uses a lower case L.

7.3.7 SUBSRIBE ONCE AND FILTER IN NODE-RED

When using input nodes such as Wzzard, MQTT, etc., it should be remembered that each node essentially creates
an IP connection in the background. Whilst it would be possible to use multiple input nodes, each subscribing to
very specific data topics in order to trigger the downstream flows, this is wasteful of resources and can slow down
the gateway operation considerably. It is better to use fewer subscriptions with wildcards and to filter out the
specific items of interest within a flow.

7.3.8 NODE_RED DOES NOT "SCAN"

The order of execution of Node-RED nodes does not have any relationship with their order on the page (ie all
things being equal, Node-RED flows do NOT execute left to right, top to bottom). In flows where race conditions
can exist therefore, it is recommended that delay nodes are introduced to ensure the desired precedence of
execution is achieved.

7.4 GETTING DATA FROM WZZARD, ADAM, AND WISE UNITS USING NODE-RED

7.4.1 WZZARD

1. Navigate to the Node-RED home screen and
drag a Wzzard input node onto the canvas. Drag
a debug node onto the canvas and connect the
two together.
2. Double click on the Wzzard input node. Click on
the pencil button in the resulting screen to
configure the local interface. You will only need
to do this once.
3. In the resulting screen, unless you have been advised differently by B+B SmartWorx, simply click the 'Add'
button to create the required connection on port 1883.
4. Select the topic to which you want to subscribe. Wzzard nodes publish sensor data on the topic
'BB/<mac_id>/data', where <mac_id> is the 12 digit number printed on the Wzzard node label beginning
with 001343.
5. To get all sensor data from all connected nodes, subscribe using the '+' wildcard in place of <mac_id> -
('BB/+/data').
SmartSwarm 342
42
:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Smartswarm 342

Table of Contents