From 760e337878d1808d6348e35ae072c7bff2eed97b Mon Sep 17 00:00:00 2001 From: Ranlvor Date: Sun, 14 Jan 2018 16:59:03 +0100 Subject: [PATCH] RZL: Add 3D printer --- config/rzl.js | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/config/rzl.js b/config/rzl.js index a8a38c0..380723d 100644 --- a/config/rzl.js +++ b/config/rzl.js @@ -117,6 +117,33 @@ const config : Config = { command: "/service/openhab/in/pca301_infoscreen/command", defaultValue: "OFF", values: { on: "ON", off: "OFF" } + }, + printer_3d_status: { + state: "/service/ultimaker/state", + command: "", + defaultValue: "unavailable", + parseState: msg => { + switch (msg.toString()) { + case "unreachable": + case "booting": + return "unavailable" + + case "pausing": + case "paused": + case "resuming": + case "wait_cleanup": + case "maintenance": + return "action_needed" + + case "pre_print": + case "post_print": + case "printing": + return "printing" + + default: + return msg.toString() + } + }, } }, controls: { @@ -393,6 +420,31 @@ const config : Config = { text: "Open Infoscreen" } ] + }, + printer_3d: { + name: "Ultimaker 3", + position: [754, 560], + icon: "printer-3d", + iconColor: ({printer_3d_status}) => { + if(printer_3d_status == "action_needed") { + return "#b3b300"; + } else if(printer_3d_status == "printing") { + return "#00ff00"; + } else if(printer_3d_status == "idle") { + return "#000000"; + } else if(printer_3d_status == "unavailable") { + return "#888888"; + } else { + return "#ff0000"; + } + }, + ui: [ + { + type: "link", + link: "http://ultimaker.rzl/", + text: "Open Webinterface" + } + ] } }, layers: [