Octoprint
Node-RED

Octoprint

Shows the time left on print and displays a progressbar.
A flow by Bruijntje

Download flow Download assets

Flow Details

Shows the time left on print and displays a progressbar. Displays "Ready" when waiting for print job. App gets removed from the app rotation if printer is no longer reachable.

To configure: -Insert Octoprint addres in 'http request' and insert octoprint API-key as bearer token. -Insert Awtrix mqtt prefix in 'Custom App'

Icon Required: 68577

[ { "id": "16e7dffe125168a0", "type": "inject", "z": "07fcc1e9c415d5a8", "name": "Start", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "60", "crontab": "", "once": true, "onceDelay": "1", "topic": "", "payload": "", "payloadType": "date", "x": 350, "y": 280, "wires": [ [ "0de3133e6fcdaefc" ] ] }, { "id": "7da992173b2032d3", "type": "mqtt out", "z": "07fcc1e9c415d5a8", "name": "Custom App", "topic": "AWTRIX_PREFIX_HERE/custom/Octoprint", "qos": "1", "retain": "false", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "7ab578ded1bbee4f", "x": 990, "y": 280, "wires": [] }, { "id": "0de3133e6fcdaefc", "type": "http request", "z": "07fcc1e9c415d5a8", "name": "", "method": "GET", "ret": "obj", "paytoqs": "ignore", "url": "http://INSERT-IP-HERE/api/job", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "bearer", "senderr": false, "headers": [], "x": 530, "y": 280, "wires": [ [ "be0d4703729e31b2", "5da7379ac3bec2dc" ] ] }, { "id": "be0d4703729e31b2", "type": "debug", "z": "07fcc1e9c415d5a8", "name": "Debug API response", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 560, "y": 360, "wires": [] }, { "id": "1c8286d28e93ab36", "type": "comment", "z": "07fcc1e9c415d5a8", "name": "Insert API token and octoprint adress here", "info": "", "x": 540, "y": 240, "wires": [] }, { "id": "5da7379ac3bec2dc", "type": "function", "z": "07fcc1e9c415d5a8", "name": "To Matrix", "func": "// Make sure payload exists\nif (!msg.payload || !msg.payload.progress) {\n node.warn(\"Payload missing progress field: \" + JSON.stringify(msg.payload));\n return null; // shouldn't happen but stops if data isn't in expected format\n}\n\nvar completion = msg.payload.progress.completion;\nvar timeleft = msg.payload.progress.printTimeLeft;\nvar state = msg.payload.state; // <-- string (e.g. \"Operational\", \"Printing\", \"Offline\")\nvar icon = 68577;\n\n// Printer offline/not connected but octoprint is reachable = stop sending, let lifetime kill the app\nif (state === \"Offline\" || state === \"Closed\" || state === \"Error\") {\n return null;\n}\n\n// Printer active but not printing\nif (state === \"Operational\") {\n msg.payload = {\n \"text\": \"Ready\",\n \"icon\": icon,\n \"pushIcon\": 0,\n \"lifetime\": 180\n };\n return [msg, null];\n}\n\n// Printer is printing\nif (state === \"Printing\" && completion != null && timeleft != null) {\n completion = completion.toFixed(0);\n var hours = Math.floor(timeleft / 3600);\n var mins = Math.round((timeleft % 3600) / 60);\n\n let text = (hours === 0) ? (mins + \" min\") : (hours + \" h \" + mins + \" min\");\n\n msg.payload = {\n \"text\": text,\n \"icon\": icon,\n \"pushIcon\": 0,\n \"lifetime\": 180,\n \"progress\": Number(completion),\n };\n return [msg, null];\n}\n\n// Default = send nothing, let lifetime kill the app\nreturn null;\n", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 760, "y": 280, "wires": [ [ "7da992173b2032d3" ] ] }, { "id": "7ab578ded1bbee4f", "type": "mqtt-broker", "name": "localhost", "broker": "localhost", "port": "1883", "clientid": "", "autoConnect": true, "usetls": false, "protocolVersion": "4", "keepalive": "60", "cleansession": true, "autoUnsubscribe": true, "birthTopic": "", "birthQos": "0", "birthPayload": "", "birthMsg": {}, "closeTopic": "", "closeQos": "0", "closePayload": "", "closeMsg": {}, "willTopic": "", "willQos": "0", "willPayload": "", "willMsg": {}, "userProps": "", "sessionExpiry": "" } ]
/flows/wqGQomx0Ape0/68577.gif
-- Flow first published on September 23, 2025, last updated on September 23, 2025 at 20:29.