Giter Site home page Giter Site logo

alexverrico / octoprint-display-eta Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 7.0 147 KB

Octoprint Plugin to display the estimated finish time of the current print

License: GNU Affero General Public License v3.0

Python 88.02% JavaScript 3.52% Jinja 8.46%

octoprint-display-eta's Introduction

OctoPrint-Display-Print-ETA

Display the finish time of the current print as estimated by Octoprint. The day of finish is displayed only when the current print will not finish today. You can configure if you want to display the ETA on the printer, as well as if you want to use 12HR or 24HR time. If this plugin causes your printer to report errors, try enabling the option "remove all colons"

alt text

Setup

Install via the bundled Plugin Manager or manually using this URL:

https://github.com/AlexVerrico/Octoprint-Display-ETA/archive/master.zip

Some users have reported that the ETA is extremely innacurate, please try installing Print Time Genius before opening a new issue. You must have the time zone configured on the host, otherwise you will see the time in UTC. In Debian, use the following command to set time zone:

sudo dpkg-reconfigure tzdata

then follow the wizard.

Day and time are printed according to the host locales. In Debian they are configured using

sudo dpkg-reconfigure locales

then follow the wizard.

API

The API endpoint is /api/plugin/display_eta
For general API information see the Octoprint Docs.
For GET requests, the parameters should be included as query parameters
For POST requests the parameters should be included as a JSON dictionary
The endpoint requires that the parameter "command" be sent with all requests.
The available commands are:

  • current_eta: No additional parameters, returns a JSON dictionary containing the currently stored ETA for the current print. For example, {"eta":"02:32:05 PM"}
  • update_eta: No additional parameters, recalculates the ETA then returns a JSON dictionary containing the old ETA and the new ETA for the current print. For example, {"eta":"02:28:39 PM","old_eta":"02:28:38 PM"}

Contributing

All Pull Requests MUST be made to the devel branch, otherwise they will be ignored.
Please ensure that you follow the style of the code (use spaces not tabs, etc)
Please include descriptive comments to assist others to understand your changes
For now, all code must be backwards compatible with Python 2, unless you can provide a very compelling reason to drop Python 2 support.
Please open an issue to discuss what you feature(s) you want to add / bug(s) you want to fix before working on them, as this avoids 2 people submitting a PR for the same feature/bug.

octoprint-display-eta's People

Contributors

alexverrico avatar jbryson3 avatar pablogventura avatar robomagus avatar ropaha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

octoprint-display-eta's Issues

[Feature Request] Only show ETA on printer LCD when actually printing.

Is your feature request related to a problem? Please describe.
I'd like the ETA to only be shown on the printer's LCD when the machine is actually printing. Right now, as soon as there is a file loaded the ETA pops up on the screen. This interferes with other stuff I'd like to have shown there prior to a print starting.

Describe the solution you'd like
An option / setting that would allow me to only have the ETA on the printers LCD when its actually printing.

Additional context
I've taken a quick look at the code and this should be an easy addon. If you aren't able to add this feature but are open to the addition I'll be happy to implement it myself and create a PR.

[Feature Request] Show absolute time-of-day for finish time.

Is your feature request related to a problem? Please describe.
When it currently says: "print time left 21:32:53", I have to calculate when that will be. Will I be near the printer or will I be asleep ?

Describe the solution you'd like
When configured to do so (maybe depending on a configurable time-to-go threshold?), the plugin should display the absolute time of finishing instead of the time-to-go. (actually that time-to-go threshold parameter is the only thing that is needed. Suppose I always what to display the time-of-finish, I set it to zero, if you want to keep it the way it is, set it to "infinite".

Describe alternatives you've considered
A completely different plugin. But in the "display it" part it should be just a line-or-two. How much code is required to add a configurable option: I have no idea.

Plugin causes continuous spinning save button

Describe the bug
When the plugin is enabled it causes the save button in the tools menu to continuously spin.

To Reproduce
Steps to reproduce the behavior:
Enable the plugin.

Expected behavior
Not a spinning button that can't be saved.

Environment information:

  • Octoprint Version: 1.8.1 on OctoPrint for Android version 1.0.4
  • Browser: Firefox
  • Python Version: 3.9.5

Additional context
Note that the plugin never seemed to work with OctoPrint for Android but the spinning button thing only was noticed after upgrading to Octoprint 1.8.1

[Feature Request] Option to add trailing character to printer display

Is your feature request related to a problem? Please describe.
My CR-10 clips the last character off the message sent to the display

Describe the solution you'd like
Add an option to the plugin to send an extra trailing character to account for the printers that do that. The ip on connect plugin has a good example
https://github.com/jneilliii/OctoPrint-ipOnConnect/blob/66e3b863932989e1312434b1370b6f84784aaf63/octoprint_ipOnConnect/templates/ipOnConnect_settings.jinja2#L22

Describe alternatives you've considered
I'll get by day to day

Additional context
https://github.com/jneilliii/OctoPrint-ipOnConnect/blob/d14347bfe7367c674460cf02ac893d30eb1fc746/README.md#added-2

ETA value only displays "-"

ETA value is not being displayed in OctoPrint Sidebar. Only shows a dash.

Following is from octoprint.log

2020-12-13 23:55:12,352 - octoprint.printer.standard - ERROR - Exception while sending print progress to plugin display_eta
Traceback (most recent call last):
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/printer/standard.py", line 327, in call_plugins
    plugin.on_print_progress(storage, filename, progress)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/util/__init__.py", line 1890, in wrapper
    return f(*args, **kwargs)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_display_eta/__init__.py", line 60, in on_print_progress
    self.eta_string = self.calculate_ETA()
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_display_eta/__init__.py", line 47, in calculate_ETA
    strtime = format_time(finish_time,CustomTimeFormat)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/babel/dates.py", line 801, in format_time
    return parse_pattern(format).apply(time, locale)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/babel/dates.py", line 1232, in apply
    return self % DateTimeFormat(datetime, locale)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/babel/dates.py", line 1229, in __mod__
    return self.format % other
  File "/home/pi/oprint/local/lib/python2.7/site-packages/babel/dates.py", line 1267, in __getitem__
    return self.format_period(char)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/babel/dates.py", line 1410, in format_period
    period_names = get_period_names(context='format', width=width, locale=self.locale)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/babel/dates.py", line 295, in get_period_names
    return Locale.parse(locale).day_periods[context][width]
AttributeError: 'NoneType' object has no attribute 'day_periods'

Environment information:

  • Octoprint Version: 1.5.2
  • Browser: [Chrome/87.0.4280.88
  • Python Version: Python 2.7.13

[Feature Request] Use Free area in main screen for Big Clock / Countdown

Is your feature request related to a problem? Please describe.
Big Blank Space

Describe the solution you'd like
Use it for a big clock style, eta, or even actual time of expected finish + counddown box

Describe alternatives you've considered
i searched and noticed no other relative apps, thinking of using this one.

Additional context
the big red target marked area could be used in my layout for a larger Clock, see how relativly tiny the current Print time remaining information is, small red arrow.

octoprint screen

Exception during page load

Describe the bug
During page lode of the OctoPrint interface I see the following exception in the console:

Could not bind view model ETAModel to target #settings_plugin_display_eta

The cause of this exception is the inner exception:

Error: You cannot apply bindings multiple times to the same element.

To Reproduce
Steps to reproduce the behavior:

  1. Open the browser console
  2. (Re-)load the octoprint webinterface

Expected behavior
I think the Exception should be removed.

Environment information:

  • Octoprint Version: 1.5.1
  • Browser: Firefox
  • Python Version: Python 2.7

Additional context
I think the error was introduced in 81daf3a. If I understand the API correctly, you should not need to bind the elements when using custom_bindings=False. So I think #settings_plugin_display_eta should be removed here: octoprint_display_eta/static/js/display_eta.js:30. I think #navbar_plugin_octoprint_display_eta would be the same problem, but currently there is no navbar template. But I think it should be removed from the elements list, too.

Timezone format (12/24hr) not used

V1.0.6

A minor issue but the timezone format is not used when displaying ETA. If the system is configured to use 24hr format, the plug-in still displays 12hr format.

ETA TZ Format

JS error: Cannot apply bindings multiple times to #settings_plugin_display_eta

Describe the bug

Receiving the following JS error in the browser console (which appears to be related to OP-ETA:

packed_core.js?407b5f07:formatted:19317 Could not bind view model ETAModel to target #settings_plugin_display_eta : Error: You cannot apply bindings multiple times to the same element.
    at p (http://192.168.1.7:5000/static/webassets/packed_libs.js?ab739628:3:3221)
    at k (http://192.168.1.7:5000/static/webassets/packed_libs.js?ab739628:3:2747)
    at Object.a.vc (http://192.168.1.7:5000/static/webassets/packed_libs.js?ab739628:4:3231)
    at http://192.168.1.7:5000/static/webassets/packed_core.js?407b5f07:1007:8
    at Pn (http://192.168.1.7:5000/static/webassets/packed_libs.js?ab739628:1:94753)
    at Function.<anonymous> (http://192.168.1.7:5000/static/webassets/packed_libs.js?ab739628:1:105184)
    at http://192.168.1.7:5000/static/webassets/packed_core.js?407b5f07:1002:26
    at Pn (http://192.168.1.7:5000/static/webassets/packed_libs.js?ab739628:1:94753)
    at Function.<anonymous> (http://192.168.1.7:5000/static/webassets/packed_libs.js?ab739628:1:105184)
    at bindViewModels (http://192.168.1.7:5000/static/webassets/packed_core.js?407b5f07:993:106)

To Reproduce
Steps to reproduce the behavior:

  1. Install OD-ETA
  2. Load OP - and display console.

Environment information:

  • Octoprint Version: 1.5.2
  • Browser: brave i.e. chromium
  • Python Version: 3.8.6

Error on install - OctoPrint 1.4.0 on Version 0.17.0, running on Raspberry Pi 4 Model B Rev 1.2

Version 1.0.5

2020-05-22 17:42:43,303 - octoprint.plugins.pluginmanager - INFO - Installing plugin from https://github.com/AlexVerrico/Octoprint-Display-ETA/archive/master.zip
2020-05-22 17:42:49,392 - octoprint.plugin.core - ERROR - Invalid syntax in /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_display_eta/init.py for plugin display_eta
Traceback (most recent call last):
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/plugin/core.py", line 599, in _parse_metadata
root = ast.parse(f.read(), filename=path)
File "/usr/lib/python2.7/ast.py", line 37, in parse
return compile(source, filename, mode, PyCF_ONLY_AST)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_display_eta/init.py", line 65
return dict{
^
SyntaxError: invalid syntax

global name 'CustomTimeFormat' is not defined error

Describe the bug
I noticed this error in my logs while developing with the virtual printer. It appears the calculate_eta function is using a global that is set in the event handler, and there is a race condition.

To Reproduce
Steps to reproduce the behavior:

  1. Switch octoprint to the virtual printer
  2. Print something (virtually)
  3. Open octoprint.log
  4. See error

Expected behavior
I think this bug can be avoided my moving the global instantiation to the class init function. That would ensure it is always set.

Screenshots
N/A

Environment information:

  • Octoprint Version: 1.4.1
  • Browser: N/A
  • Python Version: 2

Additional context

Traceback (most recent call last):
  File "/home/pi/devel/OctoPrint/src/octoprint/printer/standard.py", line 241, in call_plugins
    plugin.on_print_progress(storage, filename, progress)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_display_eta/__init__.py", line 60, in on_print_progress
    self.eta_string = self.calculate_ETA()
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_display_eta/__init__.py", line 47, in calculate_ETA
    strtime = format_time(finish_time,CustomTimeFormat)
NameError: global name 'CustomTimeFormat' is not defined

No display of ETA

Hello,
first of all, thank you for the acquisition of Display-ETA. After uninstalling the previous version, restarting the octoprint-server and installing Display-ETA 1.0.5 the ETA display is missing.A restart of the octoprint server and a new deinstallation and installation did not bring any improvement.
I use a raspberry pi 3 with octopi 0.17.0 and recent updates.
Any idea what this might be due to?

regards,

Dirk

Time should be shown in the timezone the browser is in, not the server.

Describe the bug
All my servers run on UTC. Octoprint is no exception. The plugin seems to show the ETA in UTC, rather than the timezone the client (browser) is in. It should use the browser's local time.

To Reproduce
Steps to reproduce the behavior:

  1. Set your server timezone to UTC
  2. Print something
  3. Access Octoprint from a browser not in UTC.
  4. It shows the incorrect time. (correct for UTC).

Expected behavior
It should show the time in the local time of the browser.

Environment information:

  • Octoprint Version: 1.9.3
  • Browser: Firefox: 124.0.2
  • Python Version: 3.9.2

[Feature Request] Show completion time once print finishes.

Describe the solution you'd like
When a print finishes the ETA: field becomes "useless" but at times I come back to my printer and see it finished (earlier than expected). So then an easy way to use the empty space would be to display: Finished at: hh:mm:ss

Describe alternatives you've considered
I've considered looking in the logs. That's a hassle.

Additional context
current job shows "ETA: 10:05 tomorrow", but doing the math myself, I'd say it will finish at 07:23... As I usually come here well after 10:00, I'd like to know who's right.... :-)

Double ETA in predicted time

Describe the bug
afbeelding

Should be pretty self-explanatory. After that newest update

To Reproduce
Steps to reproduce the behavior:

  1. use v2.2.0
  2. start any print.
  3. See the double ETA

Expected behavior
no double ETA of course

Screenshots
See above

Environment information:

  • Octoprint Version: 1.7.3
  • Browser: Not relevant but 99.0.1
  • Python Version: [3.7.3

Additional context
Add any other context about the problem here.

no ETA reported. plugin error

2021-01-31 20:24:45,488 - octoprint.printer.standard - ERROR - Exception while sending print progress to plugin display_eta
Traceback (most recent call last):
File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/printer/standard.py", line 327, in call_plugins
plugin.on_print_progress(storage, filename, progress)
File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/init.py", line 1890, in wrapper
return f(*args, **kwargs)
File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_display_eta/init.py", line 61, in on_print_progress
if (doM117 == True):
NameError: name 'doM117' is not defined

Recv: echo:Unknown command: "32"

Describe the bug
A clear and concise description of what the bug is.
when this Plug in is enabled on all of my printers, it spams my terminal with M117 ETA is 10:39:51 pm
Recv: echo:Unknown command: "18 pm"
Recv: ok
Send: M117 ETA is 11:32:19 pm
Recv: ok
Recv: echo:Unknown command: "32"
Recv: ok
Recv: echo:Unknown command: "19 pm"
Recv: ok
Send: M117 ETA is 11:32:20 pm
Recv: ok
Recv: echo:Unknown command: "32"
Recv: ok
Recv: echo:Unknown command: "20 pm"
Recv: ok
[...]
Send: M117 ETA is 11:32:21 pm
Recv: ok
Recv: echo:Unknown command: "32"
Recv: ok
Recv: echo:Unknown command: "21 pm"
Recv: ok
Send: M117 ETA is 11:32:22 pm
Recv: ok
Recv: echo:Unknown command: "32"
Recv: ok
Recv: echo:Unknown command: "22 pm"
Recv: ok
Send: M117 ETA is 11:32:23 pm
Recv: ok
Recv: echo:Unknown command: "32"
Recv: ok
Recv: echo:Unknown command: "23 pm"
Recv: ok
To Reproduce
Steps to reproduce the behavior:

  1. install/enable plug in
  2. send print to printer
  3. watch terminal

Expected behavior
not send extra spam to the terminal causing Octoprint to think it's an unknown command
Screenshots
image
Environment information:

  • Octoprint Version: 1.8.7
  • Browser: firefox, chrome, Edge
  • Python Version: [eg. Python 3.9

Set time zone through plugin management

I have not properly set the timezone of my Raspberry Pi and have not yet figured out how to fix that. The displayed ETA is now wrong.
I'd love to be able to set my timezone for this plugin from the settings page for this plugin in Octoprint.

Octo4a

Eta locks up the save button in Settings in octo4a.

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment information:

  • Octoprint Version: [eg. 1.4.0]
  • Browser: [e.g. chrome, safari]
  • Python Version: [eg. Python 3.8]

Additional context
Add any other context about the problem here.

Doesn't update past 2.0.0

Describe the bug
Plugin doesn't update past 2.0.0, Octoprint shows a notification for 2.0.1 but it constantly keeps installing 2.0.0 even tho the little Log output window shows the URL for 2.0.1

To Reproduce
Simply try and update the plugin via the notification that automatically appears

Expected behavior
Update to 2.0.1

Screenshots
None

Environment information:

  • Octoprint Version: 1.6.1
  • Browser: MS Edge
  • Python Version: 2.7.13

Additional context
None

Wrong time,

Describe the bug
The time shown is not accurate
Never had an accurate time shown on display

Expected behavior
After loading a 45-minute print the plugin shows that I've got nearly 11 hours left.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment information:

  • Octoprint Version: [eg. 1.4.2]
  • Browser: [firefox]
  • Python Version: [eg. Python 3.3]
  • Prusa i3 MK3S

Additional context
time is wrong by various lengths. Sometimes 29 minutes, sometimes hours.

[Feature Request] Specify delay before calculating ETA

My new Ender-3 V3 SE has a longer delay than my previous printers before starting prints (auto-levelling, heating etc) which blows the ETA way out of proportion, like a 2 hour print estimating over 24 hours before slowing coming down to a more accurate measurement over the next 30 or so minutes. This also means estimated time for 30 min prints is basically useless.

Improving this could be achieved by being able to specify a delay which the calculation ignores while the printer is setting up, for instance in seconds between 0-999.

Thank you for all your effort, this is an incredibly useful tool

ETA Date/Time Crashes Certain Printer Firmware

In /octoprint_display_eta/__init__.py /, self._printer.commands("M117 ETA is {}".format(self.eta_string)) (line 50) outputs a time format containing : which causes certain printers (with admittedly faulty firmware, CR-10 in this case) to misinterpret the line, causing an infinite loop of resend requests, subsequently causing print failure. See octoprint.log output below:

2020-05-25 17:33:22,173 - octoprint.util.comm - INFO - Got a resend request from the printer: requested line = 14961, current line = 14962
| Last lines in terminal:
| Recv: ok
| Send: N14961 M117 ETA is 06:29:36 Tomorrow*76
| Recv: Error:No Checksum with line number, Last Line: 14960
| Recv: Resend: 14961
| Recv: ok
| Send: N14961 M117 ETA is 06:29:36 Tomorrow*76
| Recv: Error:No Checksum with line number, Last Line: 14960
| Recv: Resend: 14961
| Recv: ok
| Send: N14961 M117 ETA is 06:29:36 Tomorrow*76
| Recv: Error:No Checksum with line number, Last Line: 14960
| Recv: Resend: 14961
| Recv: ok
| Send: N14961 M117 ETA is 06:29:36 Tomorrow*76
| Recv: Error:No Checksum with line number, Last Line: 14960
| Recv: Resend: 14961
| Recv: ok
| Send: N14961 M117 ETA is 06:29:36 Tomorrow*76
| Recv: Error:No Checksum with line number, Last Line: 14960
| Recv: Resend: 14961
2020-05-25 17:33:22,249 - octoprint.util.comm - WARNING - Printer keeps requesting line 14961 again and again, communication stuck
2020-05-25 17:33:22,250 - octoprint.util.comm - INFO - Changing monitoring state from "Printing" to "Error: Printer keeps requesting line 14961 again and again, communication stuck"

It would be nice if an option existed to remove any : from M117 commands. Alternatively, a warning in the readme could prevent future issues.

Plugin Octoprint-Display-ETA: 1.1.1 => Moves Icon Navbar Top

Hello,

Describe the bug
When installing your Plugin (Octoprint-Display-ETA: 1.1.1), it moves the PSU Control Plugin icon (0.1.9) from right to left in the navbar at the top.

With Octoprint-Display-ETA-master_V1.0.6 there was no such problem.

Screenshots
image

Thank you for the solution.
See you soon.
(French text translated into English by Deepl.com)

Environment information:

  • OctoPrint 1.4.0 en fonctionnement OctoPi 0.16.0
  • Browser: Google Chrome Version 83.0.4103.116 (Build officiel) (64 bits)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.