node-red-contrib-industrial-machine-forecast
raw JSON → 1.0.2 verified Sat Apr 25 auth: no javascript
Node-RED custom node for time-series forecasting and anomaly detection using exponential smoothing. Current version 1.0.2, stable release. It forecasts the next value in a time series based on a configurable smoothing factor (alpha) and detects anomalies (sudden spikes/drops) using a running estimate of forecast error variance and a threshold in standard deviations. Offers an adaptive mode that adjusts alpha based on data volatility. Unlike general statistical libraries, this is specifically designed as a Node-RED node with status indicator and configurable settings, intended for predictive maintenance and real-time monitoring. Released under GPL-3.0.
Common errors
error Error: [node-red-contrib-industrial-machine-forecast] Invalid payload: must be a number ↓
cause msg.payload is not a numeric value (e.g., string, null).
fix
Use a Change node to set msg.payload to a number, e.g., msg.payload = Number(msg.payload).
error TypeError: Cannot read properties of undefined (reading 'at') ↓
cause Node is missing initial state (e.g., first message after deploy without prior data).
fix
Ensure the first message sent to the node is a valid numeric payload. The node will initialize its state from the first message.
Warnings
gotcha Node expects numeric payload; non-numeric values cause silent failure or errors. ↓
fix Ensure msg.payload is a number before sending to the node (e.g., use a Change node to convert).
gotcha Node maintains state between messages; adapter mode changes alpha over time, which may cause inconsistent behavior if node is restarted or deployed. ↓
fix Be aware that the node uses in-memory state; redeploying the flow resets the state. For persistent state, consider using a context store.
gotcha Anomaly detection threshold is static unless adaptive mode modifies alpha; variance estimate can be affected by sequence length. ↓
fix Tune the Std Devs threshold based on expected data variability. Start with 2-3 standard deviations and adjust.
Install
npm install node-red-contrib-industrial-machine-forecast yarn add node-red-contrib-industrial-machine-forecast pnpm add node-red-contrib-industrial-machine-forecast Imports
- default (node)
Install via npm and then use in Node-RED flow; no direct import in JavaScript/TypeScript.
Quickstart
// This package is a Node-RED node, not a library for programmatic use.
// To use it, install Node-RED first, then:
// npm install node-red-contrib-industrial-machine-forecast
// Then in Node-RED flow editor, add it from the palette.
// Input: msg.payload = numeric observation
// Output: msg.payload = { value: number, status: "Normal" | "Anomaly - Sudden Spike" | "Anomaly - Sudden Drop" }