Node-RED Calculator Node

1.0.6 · active · verified Sun Apr 19

node-red-contrib-calc is a Node-RED node designed to perform a range of basic mathematical operations directly within Node-RED flows. Currently at version 1.0.6, it primarily receives maintenance updates, with recent releases focusing on expanding available operations like `truncate` and enhancing result formatting. Unlike traditional JavaScript libraries, this package integrates as a graphical node in the Node-RED editor. Its core differentiator lies in providing a simplified, visual interface for common arithmetic, aggregation (min, max, average), and rounding tasks, allowing users to easily inject, process, and output numerical data within their IoT and automation workflows without writing custom functions. It is positioned as a simpler alternative to more advanced statistical packages like `node-red-contrib-statistics`.

Common errors

Warnings

Install

Quickstart

This example Node-RED flow demonstrates how to configure the `calc` node to find the maximum value from an array of numbers injected into the flow, and then display the result in the Node-RED debug sidebar.

[
  {
    "id": "b6bc5399.8385e",
    "type": "calculator",
    "z": "4142483e.06fca8",
    "name": "",
    "inputMsgField": "payload",
    "outputMsgField": "payload",
    "operation": "max",
    "constant": "",
    "round": false,
    "decimals": 0,
    "x": 640,
    "y": 3060,
    "wires": [
      ["4c297cba.7585a4"]
    ]
  },
  {
    "id": "e5a3b930.003428",
    "type": "inject",
    "z": "4142483e.06fca8",
    "name": "",
    "topic": "",
    "payload": "[321,123,333,222,111]",
    "payloadType": "json",
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": 0.1,
    "showConfirmation": false,
    "confirmationLabel": "",
    "x": 420,
    "y": 3060,
    "wires": [
      ["b6bc5399.8385e"]
    ]
  },
  {
    "id": "4c297cba.7585a4",
    "type": "debug",
    "z": "4142483e.06fca8",
    "name": "",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "false",
    "x": 830,
    "y": 3060,
    "wires": []
  }
]

view raw JSON →