RZL: Add 3D printer time remaining (#78)
* RZL: Add 3D printer time remaining This pull request closes #20.
This commit is contained in:
parent
3375c798dc
commit
37c9f524cd
1 changed files with 21 additions and 0 deletions
|
|
@ -186,6 +186,21 @@ const config: Config = {
|
||||||
},
|
},
|
||||||
defaultValue: "0"
|
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: {
|
nebenraumPowerStatus: {
|
||||||
state: {
|
state: {
|
||||||
name: "/service/nebenraum-power",
|
name: "/service/nebenraum-power",
|
||||||
|
|
@ -472,6 +487,12 @@ const config: Config = {
|
||||||
max: 1,
|
max: 1,
|
||||||
text: "Printing Progress",
|
text: "Printing Progress",
|
||||||
topic: "printer_3d_progress"
|
topic: "printer_3d_progress"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
text: "Time Left",
|
||||||
|
icon: mdi("clock"),
|
||||||
|
topic: "printer3Dremaining"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue