Skip to content

Commit

Permalink
Added variable 'time_done'.
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianonline committed Feb 18, 2016
1 parent 2cbfe9e commit a5290e9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ To allow the plugin to send messages via telegram, you have to register a telegr
* `{file}` - The currently printing file.
* `{z}` (only for height change events) - The current z value.
* `{percent}` (only useful for height change notifications) - The current percentage of the print progress.
* `{time_left}` (only useful for height change events) - Time left in the print.
* `{time_done}`, `{time_left}` (only useful for height change events) - Time done / left in the print.
* `{bed_temp}`, `{e1_temp}`, `{e2_temp}` - Temperatures of bed, extruder 1 and extruder 2.
* `{bed_target}`, `{e1_target}`, `{e2_target}` - Target temperatures of bed, extruder 1 and extruder 2.
3 changes: 2 additions & 1 deletion octoprint_telegram/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def get_settings_defaults(self):
messages = dict(
PrintStarted = "Started printing {file}.",
PrintFailed = "Printing {file} failed.",
ZChange = "Printing at Z={z}.\nBed {bed_temp}/{bed_target}, Extruder {e1_temp}/{e1_target}.\n{percent}% done, {time_left} remaining.",
ZChange = "Printing at Z={z}.\nBed {bed_temp}/{bed_target}, Extruder {e1_temp}/{e1_target}.\n{time_done}, {percent}% done, {time_left} remaining.",
PrintDone = "Finished printing {file}.",
)
)
Expand Down Expand Up @@ -283,6 +283,7 @@ def on_event(self, event, payload, *args, **kwargs):
e2_temp = temps['tool1']['actual']
e2_target = temps['tool1']['target']
percent = int(status['progress']['completion'] or 0)
time_done = octoprint.util.get_formatted_timedelta(datetime.timedelta(seconds=(status['progress']['printTime'] or 0)))
time_left = octoprint.util.get_formatted_timedelta(datetime.timedelta(seconds=(status['progress']['printTimeLeft'] or 0)))

if "file" in payload: file = payload["file"]
Expand Down

0 comments on commit a5290e9

Please sign in to comment.