Registry / data / node-red-contrib-calculate

node-red-contrib-calculate

JSON →
library0.1.4jsnpmunverified

node-red-contrib-calculate is a Node-RED contribution package providing nodes for performing simple calculations like average, maximum, minimum, and median over a specified time period or message count. It is currently at version 0.1.4. The package appears to have an infrequent release cadence, with the last update more than six years ago, suggesting it is no longer actively maintained. Its key differentiator lies in its straightforward configuration within the Node-RED visual editor for basic aggregate computations, contrasting with more general-purpose `function` nodes or other calculation-oriented nodes that might offer broader mathematical operations but require more complex setup.

npm install node-red-contrib-calculate
INSTALL
IMPORT
SIG · NODE-RED-CONTRIB-C
N
node-red-contrib-calculate
datajavascriptv0.1.4
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Calculate Node
✓ Install via Node-RED Palette Manager: Search for 'node-red-contrib-calculate' and click install. Alternatively, run `npm install node-red-contrib-calculate` in your Node-RED user directory.
✗ import { Calculate } from 'node-red-contrib-calculate'; // Incorrect: This is a Node-RED palette node, not a programmatic library. const calculateNode = require('node-red-contrib-calculate'); // Incorrect: Not directly consumable via CommonJS require.
This package provides nodes for the Node-RED visual editor, not JavaScript functions for direct programmatic import. Once installed, the 'calculate' node becomes available in the Node-RED palette under the 'data-and-analytics' category.

This Node-RED flow demonstrates various calculation nodes (average, median, min, max) configured to process random numbers either every minute or every 10 messages, outputting the results to a debug node. This can be imported directly into Node-RED's 'Import' menu.

[{"id":"4c3a1551.6c254c","type":"random","z":"aff2cc18.0b484","name":"RandomNumber","low":"1","high":"100","inte":"true","property":"payload","x":340,"y":300,"wires":[["6f127280.30cf3c","6867669e.2a13a8","ac90cf81.6e61b","6dd3b70c.dfd938","596e1e94.3205b"]]},{"id":"6f127280.30cf3c","type":"calculate","z":"aff2cc18.0b484","name":"AvgEveryMinute","pauseType":"timed","calculation":"average","timeout":"1","timeoutUnits":"minutes","rate":"10","x":600,"y":180,"wires":[["4fb1838b.89fb2c"]]},{"id":"b32574cf.036708","type":"inject","z":"aff2cc18.0b484","name":"10SecBump","topic":"","payload":"","payloadType":"date","repeat":"10","crontab":"","once":true,"onceDelay":0.1,"x":140,"y":300,"wires":[["4c3a1551.6c254c"]]},{"id":"6867669e.2a13a8","type":"calculate","z":"aff2cc18.0b484","name":"AvgEvery10Msg","pauseType":"rate","calculation":"average","timeout":"10","timeoutUnits":"seconds","rate":"10","x":600,"y":240,"wires":[["4fb1838b.89fb2c"]]},{"id":"ac90cf81.6e61b","type":"calculate","z":"aff2cc18.0b484","name":"MedEveryMinute","pauseType":"timed","calculation":"median","timeout":"1","timeoutUnits":"minutes","rate":"10","x":610,"y":320,"wires":[["4fb1838b.89fb2c"]]},{"id":"6dd3b70c.dfd938","type":"calculate","z":"aff2cc18.0b484","name":"MinEveryMinute","pauseType":"timed","calculation":"min","timeout":"1","timeoutUnits":"minutes","rate":"10","x":600,"y":380,"wires":[["4fb1838b.89fb2c"]]},{"id":"596e1e94.3205b","type":"calculate","z":"aff2cc18.0b484","name":"MaxEveryMinute","pauseType":"timed","calculation":"max","timeout":"1","timeoutUnits":"minutes","rate":"10","x":610,"y":440,"wires":[["4fb1838b.89fb2c"]]},{"id":"4fb1838b.89fb2c","type":"debug","z":"aff2cc18.0b484","name":"Debug","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":870,"y":300,"wires":[]}]
Debug
Known issues
breakingThis package (v0.1.4) has not been updated in over six years and may not be compatible with newer versions of Node.js or Node-RED, potentially causing runtime errors or unexpected behavior.
fix
Consider using alternative, actively maintained Node-RED calculation nodes such as `node-red-contrib-calc` or `node-red-contrib-statistics` for better compatibility and ongoing support.
affects: <=0.1.4
gotchaBeing unmaintained, this package may contain outdated dependencies with known security vulnerabilities (CVEs). Deploying it in production environments without thorough security auditing is not recommended.
fix
Audit the package's `node_modules` for vulnerable dependencies using tools like `npm audit`. Prioritize migrating to actively maintained alternatives that receive regular security updates.
affects: <=0.1.4
gotchaThe `timeout` and `rate` configurations require careful tuning. If messages arrive too quickly or slowly relative to the configured time period or message count, the node might not output results as expected, or could accumulate excessive memory if not released.
fix
Thoroughly test the node's behavior with realistic message loads and timing scenarios. Monitor Node-RED's memory usage and output frequency in development to ensure stable operation. Adjust `pauseType`, `timeout`, and `rate` settings based on observed performance and requirements.
affects: >=0.1.0
deprecatedThe package's low version number (0.1.4) and lack of updates for an extended period indicate it's effectively abandoned. While it might still function for basic tasks, it's not receiving new features, bug fixes, or performance improvements.
fix
Plan for migration to more robust and actively developed Node-RED calculation or statistics nodes for any critical applications. Examples include `node-red-contrib-calc` or `node-red-contrib-statistics`.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'node-red-contrib-calculate'
The package was not correctly installed into the Node-RED user directory, or Node-RED was not restarted after installation.
fix
Run `npm install node-red-contrib-calculate` in your Node-RED user directory (typically `~/.node-red`) and then restart Node-RED. Verify the node appears in the palette.
Node-RED palette does not show the 'calculate' node after installation.
Node-RED may not have picked up the new node, possibly due to an incomplete installation, caching issues, or a conflicting package.
fix
Ensure Node-RED is completely restarted after installation. Check the Node-RED console logs for any errors during startup. You can also try clearing the Node-RED cache or reinstalling the package.
Upgrade
Version history
0.1.4latest on npm
Audit
Dependencies
node-redrequiredThis is a Node-RED 'contrib' package, meaning it provides nodes to be used within the Node-RED runtime and editor. Node-RED itself is the core platform dependency.
Agent activity
14 hits · last 30 days
node
12
Resources
node-red-contrib-calculate — npm install node-red-contrib-calculate · libregistry