{"library":"node-red-contrib-ui-state-trail","title":"Node-RED Dashboard State Trail Chart","description":"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.","language":"javascript","status":"active","last_verified":"Wed Apr 22","install":{"commands":["npm install node-red-contrib-ui-state-trail"],"cli":null},"imports":["msg.payload = true; // or 'running', 1","msg.payload = { state: 'on', timestamp: Date.now() };","msg.control = { period: 300000 }; // 5 minutes"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"[\n    {\n        \"id\": \"inject_current_state\",\n        \"type\": \"inject\",\n        \"name\": \"Send 'running'\",\n        \"topic\": \"\",\n        \"payload\": \"running\",\n        \"payloadType\": \"str\",\n        \"repeat\": \"5\",\n        \"crontab\": \"\",\n        \"once\": false,\n        \"onceDelay\": 0.1,\n        \"x\": 160,\n        \"y\": 100,\n        \"wires\": [\n            [\"state_trail_node\"]\n        ]\n    },\n    {\n        \"id\": \"inject_historical_data\",\n        \"type\": \"inject\",\n        \"name\": \"Send Historical Data\",\n        \"topic\": \"\",\n        \"payload\": \"[\n    {state: \\\"stopped\\\", timestamp: Date.now() - 3600000},\n    {state: \\\"running\\\", timestamp: Date.now() - 1800000},\n    {state: \\\"error\\\", timestamp: Date.now() - 600000}\n]\",\n        \"payloadType\": \"json_ata\",\n        \"repeat\": \"\",\n        \"crontab\": \"\",\n        \"once\": true,\n        \"onceDelay\": 1,\n        \"x\": 190,\n        \"y\": 160,\n        \"wires\": [\n            [\"state_trail_node\"]\n        ]\n    },\n    {\n        \"id\": \"inject_control_period\",\n        \"type\": \"inject\",\n        \"name\": \"Set Period to 10 min\",\n        \"topic\": \"\",\n        \"payload\": \"{\\\"period\\\":600000}\",\n        \"payloadType\": \"json\",\n        \"repeat\": \"\",\n        \"crontab\": \"\",\n        \"once\": true,\n        \"onceDelay\": 2,\n        \"x\": 190,\n        \"y\": 220,\n        \"wires\": [\n            [\"state_trail_node\"]\n        ]\n    },\n    {\n        \"id\": \"state_trail_node\",\n        \"type\": \"ui_state_trail\",\n        \"z\": \"flow_id\", // Replace with your flow ID\n        \"group\": \"dashboard_group\", // Replace with your dashboard group ID\n        \"name\": \"My State Trail\",\n        \"label\": \"Process State\",\n        \"order\": 0,\n        \"width\": 0,\n        \"height\": 2,\n        \"period\": 3600000, // Default to 1 hour\n        \"period_unit\": \"hour\",\n        \"combine\": true,\n        \"states\": [\n            { \"state\": \"running\", \"label\": \"Running\" },\n            { \"state\": \"stopped\", \"label\": \"Stopped\" },\n            { \"state\": \"error\", \"label\": \"Error\" },\n            { \"state\": true, \"label\": \"Active\" },\n            { \"state\": false, \"label\": \"Inactive\" }\n        ],\n        \"legend\": 0,\n        \"ticks\": 6,\n        \"x\": 450,\n        \"y\": 100,\n        \"wires\": []\n    }\n]","lang":"javascript","description":"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}