diff --git a/config/rzl/index.js b/config/rzl/index.js index 8bd208d..09f3e97 100644 --- a/config/rzl/index.js +++ b/config/rzl/index.js @@ -186,6 +186,21 @@ const config: Config = { }, defaultValue: "0" }, + printer3Dremaining: { + state: { + name: "/service/ultimaker/job", + type: (msg) => { + const json = JSON.parse(msg.toString()); + if(!json || !json["time_elapsed"] || !json["time_total"]) { + return "unavailable"; + } else { + const secondsLeft = json["time_total"] - json["time_elapsed"]; + return new Date(secondsLeft * 1000).toISOString().substr(11, 8); + } + } + }, + defaultValue: "unavailable" + }, nebenraumPowerStatus: { state: { name: "/service/nebenraum-power", @@ -472,6 +487,12 @@ const config: Config = { max: 1, text: "Printing Progress", topic: "printer_3d_progress" + }, + { + type: "text", + text: "Time Left", + icon: mdi("clock"), + topic: "printer3Dremaining" } ] },