{"id":14754,"library":"node-red-node-smooth","title":"Node-RED Smoothing Algorithms Node","description":"node-red-node-smooth is a Node-RED package providing a collection of simple smoothing algorithms for processing incoming numerical data. It includes functions like Minimum, Maximum, Mean, Standard Deviation, High Pass, and Low Pass smoothing. The current stable version, 0.8.0, was released approximately a year ago, indicating an active but not rapid release cadence. This node is specifically designed for the Node-RED environment, a low-code programming platform for event-driven applications, differentiating it from general-purpose JavaScript libraries. Its primary strength lies in its direct integration into Node-RED flows, allowing users to easily incorporate data smoothing into their visual programming logic without writing complex code. It operates exclusively on numerical inputs and can reset its internal state via a `msg.reset` message.","status":"active","version":"0.1.2","language":"javascript","source_language":"en","source_url":"https://github.com/node-red/node-red-nodes/tree/master/function/smooth","tags":["javascript","node-red","smooth","average","standard deviation"],"install":[{"cmd":"npm install node-red-node-smooth","lang":"bash","label":"npm"},{"cmd":"yarn add node-red-node-smooth","lang":"bash","label":"yarn"},{"cmd":"pnpm add node-red-node-smooth","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"This package is a Node-RED node and requires the Node-RED runtime environment to function.","package":"node-red","optional":false}],"imports":[{"note":"Node-RED nodes are not imported into standard JavaScript files directly for use. They are installed via npm into the Node-RED user directory, which then makes them available in the Node-RED editor's palette for graphical use. They represent runtime functions within the Node-RED flow engine.","wrong":"import { smooth } from 'node-red-node-smooth'","symbol":"Node-RED Node (Smooth)","correct":"Install via npm: npm install node-red-node-smooth\nThen add 'smooth' node from the palette in Node-RED editor."},{"note":"While Node-RED nodes are Node.js modules that export a function, directly `require()`-ing the `node-red-node-smooth` package in user code is not how its functionality is typically consumed. Developers interact with the node definition `module.exports = function(RED){...}` when *creating* a new Node-RED node type, not when *using* an existing one.","wrong":"require('node-red-node-smooth')","symbol":"Node-RED Node Definition","correct":"// In a custom Node-RED node .js file (e.g., ~/.node-red/nodes/my-smooth-node.js)\nmodule.exports = function(RED) {\n    function SmoothNode(config) {\n        RED.nodes.createNode(this, config);\n        // ... node logic ...\n    }\n    RED.nodes.registerType('smooth', SmoothNode);\n}"}],"quickstart":{"code":"npm install node-red-node-smooth\n# After installation, restart Node-RED if it's running.\n# Open your Node-RED editor (usually at http://localhost:1880).\n# Drag the 'smooth' node from the palette (under 'function' or 'data-and-analytics' category) onto your flow.\n# Configure the node by double-clicking it, selecting a smoothing algorithm (e.g., 'Mean'), and setting parameters like window size or smoothing factor.\n# Connect an 'inject' node to its input to send numerical data (e.g., `msg.payload = 10`).\n# Connect a 'debug' node to its output to view the smoothed results.\n# Deploy the flow and observe the output in the debug sidebar.","lang":"javascript","description":"This quickstart demonstrates how to install the node-red-node-smooth package and integrate its smoothing functionality into a basic Node-RED flow for processing data."},"warnings":[{"fix":"Validate input messages before sending them to the smooth node, ensuring `msg.payload` is a number: `if (typeof msg.payload !== 'number') { return null; }`","message":"This node strictly operates only on numbers. Any non-numeric input will be internally coerced to a number if possible, and if coercion fails, the message will be rejected. Always ensure `msg.payload` (or configured property) contains a valid number.","severity":"gotcha","affected_versions":">=0.1.2"},{"fix":"Refer to the node's help documentation in the Node-RED editor for detailed explanation of the smoothing factor's behavior and its relationship to traditional alpha values.","message":"The 'High Pass Smoothing' and 'Low Pass Smoothing' algorithms use a 'smoothing factor' which is inversely analogous to an alpha value (α). A higher smoothing factor means more smoothing, where a factor of 10 is similar to α=0.1. This can be counter-intuitive for users familiar with alpha (0 to 1) values in exponential smoothing.","severity":"gotcha","affected_versions":">=0.1.2"},{"fix":"Only send `msg.reset` when you explicitly intend to reset the node's internal state. Design your flows to prevent accidental reset signals.","message":"Sending a message with `msg.reset` (with any value) to the node will clear all internal counters and intermediate values, effectively restarting the smoothing process. This is useful for re-initializing state but can lead to unexpected output if triggered unintentionally.","severity":"gotcha","affected_versions":">=0.1.2"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure that the `msg.payload` or the property configured for smoothing is always a number. Use a 'Change' or 'Function' node upstream to convert or filter non-numeric inputs.","cause":"The node received a message where the payload (or configured property) was not a valid number, and could not be converted to one.","error":"Input value is not a number and cannot be processed by the smooth node."}],"ecosystem":"npm"}