node-red-contrib-ui-state-trail is a Node-RED dashboard UI node that renders a Gantt-type chart to visualize the historical changes of a state over a configurable time period. It is designed for displaying single-line state timelines, such as the operational status (on/off, running/stopped) of a device or process. The current stable version is 1.0.2. As a Node-RED contrib node, it typically receives updates on an as-needed basis rather than a strict release cadence, focusing on stability and new features. Key differentiators include its ability to accept both simple and timestamped historical data, customizable legend display (showing all states, current states, or latest state), state aggregation for performance, and optional persistent data storage when Node-RED's context storage is properly configured. It supports string, number, and boolean state types, which are treated distinctly.
npm install node-red-contrib-ui-state-trailVerified import paths — ran on the pinned version, not inferred.
This Node-RED flow demonstrates sending a simple current state, an array of historical states, and a control message to dynamically change the chart's display period for the 'State Trail' UI node. Replace `flow_id` and `dashboard_group` with actual IDs from your Node-RED instance.
Keep the input rate low for long periods, or configure shorter display periods. Ensure the 'Combine similar states' option is enabled in the node's configuration if individual state instances are not critical for analysis.
To retain data, enable 'Data Storage' in the node properties and follow Node-RED documentation to configure a persistent context store (e.g., file-based) in `settings.js`.
Ensure consistency in state types. If you intend `true` and `"true"` to represent the same state, standardize on one type or configure both with identical labels.
Increase the widget height to at least 2 units in the Node-RED Dashboard UI tab to display the label and legend correctly.
If continuous appending of historical data is needed, send individual historical state messages one by one rather than large arrays, or manage the data set externally before sending the complete array.
Go to Node-RED `settings.js`, configure a persistent context storage (e.g., `localfilesystem`), and ensure the 'Data Storage' checkbox is selected in the State Trail node's properties.
Reduce the `Period` setting in the node's configuration, lower the frequency of input messages, or ensure the 'Combine similar states' option is checked to reduce data points.
Edit the Node-RED Dashboard layout, find the State Trail node, and increase its 'Height' property to at least 2 units.
Standardize the data type for your states (e.g., always send `true` boolean or always send `"true"` string) or configure both `true` and `"true"` as distinct states with appropriate labels in the node's configuration.