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`.
npm install node-red-contrib-calcNo compatibility data collected yet for this library.
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.
Consult the node's configuration sidebar or documentation to understand the exact input requirements for the chosen operation. Use debug nodes upstream to verify input message content and type.
For advanced statistical analysis or more complex mathematical transformations, consider using `node-red-contrib-statistics` or implementing custom JavaScript functions within a Node-RED `function` node.
Carefully select between `round` and `truncate` based on the desired numerical precision behavior. Test with edge cases to ensure the output matches expectations.
Ensure the input message field (e.g., `msg.payload`) contains an array with the minimum required number of elements for the selected operation, for example, `[2, 3]` for multiplication.
Verify that the input message field, as configured in the node's properties, correctly points to a numeric value or an array of numbers. Use an upstream debug node to inspect `msg` content.
Check upstream nodes to ensure only valid numeric inputs are being sent to the `calc` node. Use debug nodes to inspect the input `msg.payload` or the chosen input field before it reaches the calculator node.
No dependency data recorded yet.