@mschaeffler/node-red-format 2.2.2
nodes for formatting of simple data.
@mschaeffler/node-red-format
Nodes to format data for dashboard 2.0.
If the msg property invalid is present in the message, all nodes ignore the message.
Install
$ npm install @mschaeffler/node-red-format
formNumber
Formats the payload as a number.

Input
The message property to be used as payload can be defined with the Property property.
This value is then
- if the value is a number: converted to a string according to the parameters and a unit is added
- if the value is
nullor does not exist,nullis sent - if a JSONata expression cannot be evaluated,
nullis sent - in other cases: been sent out unmodified
Output
| msg. | type | description |
|---|---|---|
| payload | string | formated value |
Parameters
| config | type | description |
|---|---|---|
| Property | string | defines the message property to be used as payload. |
| Einheit | string | unit of the value. |
| Tausender | string | character to group the number in segments of 3 digits. |
| Dezimal | string | character to decimal separation. |
| Stellen | number | number of digits after the decimal point. |
| Status | boolean | shows the actual value as a node status. |
| Filter | boolean | block sending of unchanged payload. |
| Color | array | control the color for the output value with rules. |
colors
With the color parameter values can be formated for the dashboard 2.
This classes should be defined (for an example check the ui-template in the
examples):
- greenValue
- darkgreenValue
- yellowValue
- redValue
- blueValue
- grayValue
- silverValue
Example Flow
formatBool
Formats a boolean payload e.G. for display in a graph.

Input
The message property to be used as payload can be defined with the Property property.
Output
| msg. | type | description |
|---|---|---|
| payload | string | formated value |
Parameters
| config | type | description |
|---|---|---|
| Topic | string | defines the topic for the output message, "" is msg.topic. |
| Property | string | defines the message property to be used as payload. |
| falseValue | number, string, JSON | output value for falsy values. |
| trueValue | number, string, JSON | output value for truthy values. |
| Timeout | number | Timeout duration; 0 is no timeout. |
| Timeout Value | last, number, string, JSON | output value in case of a timeout, with "last Value" the last received value will be resent. |
| Status | boolean | shows the actual value as a node status. |
| Filter | boolean | block sending of unchanged payload. |
Example Flow
collectChart
Aggregates data series for a chart of dashboard 2.0.

Input
The message property to be used as payload can be defined with the Property property.
| msg. | type | description |
|---|---|---|
| topic | string | series of the input value. |
| payload | string | input value. |
| reset | boolean | deletes all stored data from the node. |
| remove | boolean | deletes all data points of topic series. |
Output
| msg. | type | description |
|---|---|---|
| payload | array | formated value for the dashboard 2.0 chart |
Parameters
| config | type | description |
|---|---|---|
| Property | string | defines the message property to be used as payload. |
| Contextstore | context store | context store for storing the values; none is no storage. |
| Topics | array | array of the series of the chart: they have a name and a flag for steps instead of linear chart. |
| Cyclic | number | cyclic time to send out the chart in seconds. |
| Löschzyklen | number | every how many cycles old data is deleted from the chart. |
| Hours | number | how many hours the chart should span over. |
| Erase only with data | boolean | do not delete outdated data, if there is no new data arriving at the input. |
| Status | boolean | shows the actual value as a node status. |
Example Flow
Author
License
LGPL-2.1