Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ITEMS:
- Number OctoprintPrintTimeLeft "Verbleibende Zeit [%.0f s]" <time> (gOctoprint) {mqtt="<[broker:octoprint/progress/printing:state:JSONPATH($.printer_data.progress.printTimeLeft)]"}
- String OctoprintPrintTimeLeftString "Verbleibende Zeit[%s]" <time> (gOctoprint)
- DateTime OctoprintPrintETADateTime "ETA [%1$tA, %1$td.%1$tm.%1$tY %1$tH:%1$tM]" <time> (gOctoprint)
- RULE:
- rule "Time Left String"
- when
- Item OctoprintPrintTimeLeft changed
- then
- val seconds = (OctoprintPrintTimeLeft.state as DecimalType).intValue
- val int totalMinutes = seconds/60
- val int remainderSecs = seconds%60
- val int totalHours = totalMinutes/60
- val int remainderMins = totalMinutes%60
- val formattedTime = String::format("%02d", totalHours) + ":" + String::format("%02d", remainderMins) + ":" + String::format("%02d", remainderSecs)
- OctoprintPrintTimeLeftString.postUpdate(formattedTime)
- val DateTime OctoprintETA = now.plusSeconds(seconds)
- OctoprintPrintETAString.postUpdate(OctoprintETA.toString)
- OctoprintPrintETADateTime.postUpdate(new DateTimeType(OctoprintETA.toString))
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement