RZL: Add 3D printer time remaining
This pull request closes #20. It was rewritten because I deemed that the merge of the stale pull-request #20 is harder than rewriting the whole thing.
This commit is contained in:
parent
e3c11c19cd
commit
16ac2f0a40
1 changed files with 21 additions and 0 deletions
|
|
@ -145,6 +145,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 ""
|
||||
} else {
|
||||
const secondsLeft = json["time_total"] - json["time_elapsed"]
|
||||
return new Date(secondsLeft * 1000).toISOString().substr(11, 8);
|
||||
}
|
||||
}
|
||||
},
|
||||
defaultValue: ""
|
||||
},
|
||||
nebenraumPowerStatus: {
|
||||
state: {
|
||||
name: "/service/nebenraum-power",
|
||||
|
|
@ -383,6 +398,12 @@ const config: Config = {
|
|||
max: 1,
|
||||
text: "Printing 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