How to filter or route variables

Revision as of 12:08, 13 August 2020 by Registered User (Created page with "==How to filter or route variable to UI?== The “single value” subflow allows to send data in a gauge but not in a chart, here are the solutions to perform a monitoring of...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

1. How to filter or route variable to UI?

The “single value” subflow allows to send data in a gauge but not in a chart, here are the solutions to perform a monitoring of multiple variables with several UI.

Several solutions can perform this routing or filtering:

  1. You can create 2 different groups of variables (variable nodes), and consequently the same amount of processing nodes. One can be connected to the gauge and the other one to the chart.
  1. You can use the “switch node”, used like a filtering node on the output of the processing node. The switch node filters your variable on the following property : msg.payload.variablename and set == myVariable.

Here is the switch node configuration :

   [{
       "id": "2ca79e6f.a68e72",
       "type": "switch",
       "z": "8bf74b4c.0fa5f8",
       "name": "filter variable",
       "property": "payload.variablename",
       "propertyType": "msg",
       "rules": [
           {
               "t": "eq",
               "v": "myVariable",
               "vt": "str"
           }
       ],
       "checkall": "true",
       "repair": false,
       "outputs": 1,
       "x": 630,
       "y": 220,
       "wires": [
           [
               "b9d7ae86.0da72"
           ]
       ]
   } ]

You first have to import it into your STM32CubeMonitor tool following these steps :

  • Click on the “Hamburger” menu, at the top right of your window
  • Select “Import”
  • In “Clipboard” paste your json configuration and click on “Import”

The switch node will automatically appear in your design window. Link it to your processing node output.
In the switch node configuration panel, replace “myVariable” by the variable name you want to filter.

You can either use several “switch nodes” in series or in parallels to filter multiple variables :

1.1. "Switch nodes" in series

In the previous flow, the first switch node allows to route the "counter" variable to a new chart. The second switch node allows to plot all remaining variables in the other chart excluding only one variable.

1.2. "Switch nodes" in parallel

In the previous flow, the first switch node allows to route all variables except the counter value. The second switch node allows to route only the counter variable to a new chart.