imrahil / OctoPrint-PrintHistory

Plugin for OctoPrint - saves filename, print time and filament usage for each print
GNU Affero General Public License v3.0
64 stars 64 forks source link

Missing filament usage #83

Closed kb- closed 3 years ago

kb- commented 5 years ago

The filament usage sometimes doesn't show up in the history despite being tracked properly by Octoprint.

PrintHistory 1.2 OctoPrint 1.3.10 OctoPi 0.15.1, running on Raspberry Pi 3 Model B Plus Rev 1.3

Capture

gif3 commented 5 years ago

For me it happens a lot also.

It looks like, if I choose model to print and quickly click print, then the filament usage is missing. If I choose model, then wait a second or two, then click print, then the filament usage is recorded.

When I printed directly from Slic3r PE with "Send to printer" (use Octoprint API) and when checked "Start printing after upload", then the filament usage is always missing.

(OctoPrint: 1.3.10 on Raspberry Pi 3, Print History Plugin: 1.2, Slic3r PE 1.41.3+win64)

jolcese commented 5 years ago

I fixed this bug here: https://github.com/jolcese/OctoPrint-PrintHistory/commit/1887145a66ad532f46eeceac716beb5be3a13f10

gif3 commented 5 years ago

Thank you very much.

PS: At first I didn't know how to install, so for others: choose install "from url" and use "https://github.com/jolcese/OctoPrint-PrintHistory/archive/master.zip"

guysoft commented 3 years ago

Fixed by #89

haarp commented 2 years ago

@guysoft I'm still seeing empty filament usage in version 1.3 of this plugin. I'm using Prusaslicer's Upload&Print button, if that matters. Could it be related to #27, i.e. Octoprint not having parsed filament usage yet before the print starts?

guysoft commented 2 years ago

Should be the latest. There are 4 commits in the devel branch that might solve the issue.

If you can test and see if it solves the problem it would be great!

  1. Run

    ~/oprint/bin/pip install git+https://github.com/imrahil/OctoPrint-PrintHistory@devel --upgrade
  2. restart octoprint

  3. test

If this solves the issue I will release 1.4

haarp commented 2 years ago

@guysoft

Thanks. The supplied command didn't seem to upgrade the plugin, so I manually edited ~/oprint/lib/python3.7/site-packages/octoprint_printhistory/export.py with the newest devel branch version and restarted Octoprint. Unfortunately the problem remains.

It only seems to happen when doing Upload+Print from Prusaslicer, which presumably doesn't give it time to parse the metadata, similar to #27. If I upload manually, and then press print, the filament usage is correctly entered into the history.

haarp commented 2 years ago

The plugin was installed via the plugin manager. Not sure why pip isn't working properly. This is an Octopi. It's cloning to /tmp/, notifies of a bunch of satisfied requirements, then returns to prompt without writing the file. No matter, as stated previously, I manually edited export.py.

As for PrintHistory, here's a log. I hit Upload+Print in Prusaslicer, waited a good minute, then cancelled the print in Octoprint. Interestingly, Analysis of entry foo.gcode finished (which I assume gathers things like filament usage) only appears on the bottom, after everything is said and done.

2022-02-10 15:54:03,089 - octoprint.plugins.dashboard - INFO - GcodePreProcessor started processing.
2022-02-10 15:54:15,724 - octoprint.filemanager.analysis - INFO - Starting analysis of local:Part40mkii_0.4n_0.16mm_PETG_MK3.gcode
2022-02-10 15:54:15,725 - octoprint.filemanager.analysis - INFO - Invoking analysis command: /home/pi/oprint/bin/python3 -m octoprint analysis gcode --speed-x=6000 --speed-y=6000 --max-t=10 --throttle=0.0 --throttle-lines=100 --bed-z=0.0 /home/pi/.octoprint/uploads/Part40mkii_0.4n_0.16mm_PETG_MK3.gcode
2022-02-10 15:54:15,775 - octoprint.printer.standard.job - INFO - Print job selected - origin: local, path: Part40mkii_0.4n_0.16mm_PETG_MK3.gcode, owner: haarp, user: haarp
2022-02-10 15:54:15,782 - octoprint.plugins.excluderegion - INFO - File selected, resetting internal state
2022-02-10 15:54:15,821 - octoprint.util.comm - INFO - Changing monitoring state from "Operational" to "Starting"
2022-02-10 15:54:15,824 - octoprint.printer.standard.job - INFO - Print job started - origin: local, path: Part40mkii_0.4n_0.16mm_PETG_MK3.gcode, owner: haarp, user: haarp
2022-02-10 15:54:15,848 - octoprint.plugins.dashboard - INFO - Gcode not pre-processed by Dashboard. Processing now.
2022-02-10 15:54:15,886 - octoprint.plugins.dashboard - INFO - GcodePreProcessor started processing.
2022-02-10 15:54:15,915 - octoprint.util.comm - INFO - M110 detected, setting current line number to 0
2022-02-10 15:54:15,928 - octoprint.util.comm - INFO - Changing monitoring state from "Starting" to "Printing"
2022-02-10 15:54:18,545 - octoprint.util.comm - INFO - Printer seems to support the busy protocol, will adjust timeouts and set busy interval accordingly
2022-02-10 15:54:20,736 - octoprint.util.comm - INFO - Telling the printer to set the busy interval to our "communicationBusy" timeout - 1s = 2s
2022-02-10 15:54:28,660 - octoprint.plugins.dashboard - INFO - Gcode pre-processing done.
2022-02-10 15:54:28,660 - octoprint.plugins.dashboard - INFO - GcodePreProcessor found layers: 180
2022-02-10 15:54:28,661 - octoprint.plugins.dashboard - INFO - GcodePreProcessor found filament changes: 0
2022-02-10 15:54:28,661 - octoprint.plugins.dashboard - INFO - GcodePreProcessor saving layer count in file metadata
2022-02-10 15:54:28,687 - octoprint.plugins.excluderegion - INFO - Printing started
2022-02-10 15:56:09,402 - octoprint.util.comm - INFO - Cancelling job on behalf of user haarp
2022-02-10 15:56:09,410 - octoprint.util.comm - INFO - Changing monitoring state from "Printing" to "Cancelling"
2022-02-10 15:56:09,416 - octoprint.filemanager.analysis - INFO - Starting analysis of local:Part40mkii_0.4n_0.16mm_PETG_MK3.gcode
2022-02-10 15:56:09,421 - octoprint.filemanager.analysis - INFO - Invoking analysis command: /home/pi/oprint/bin/python3 -m octoprint analysis gcode --speed-x=6000 --speed-y=6000 --max-t=10 --throttle=0.0 --throttle-lines=100 --bed-z=0.0 /home/pi/.octoprint/uploads/Part40mkii_0.4n_0.16mm_PETG_MK3.gcode
2022-02-10 15:56:09,423 - octoprint.plugins.excluderegion - INFO - Printing stopped: event=PrintCancelling
2022-02-10 15:56:09,461 - octoprint.printer.standard.job - INFO - Print job cancelled - origin: local, path: Part40mkii_0.4n_0.16mm_PETG_MK3.gcode, owner: haarp, user: haarp
2022-02-10 15:56:09,471 - octoprint.plugins.excluderegion - INFO - Printing stopped: event=PrintCancelled
2022-02-10 15:56:10,976 - octoprint.plugins.printhistory - INFO - fileData not found
2022-02-10 15:56:11,568 - octoprint.plugins.excluderegion - INFO - Printing stopped: event=PrintFailed
2022-02-10 15:56:11,725 - octoprint.plugins.printhistory - INFO - Name: Part40mkii_0.4n_0.16mm_PETG_MK3.gcode
2022-02-10 15:56:11,726 - octoprint.plugins.printhistory - INFO - Origin: local
2022-02-10 15:56:11,726 - octoprint.plugins.printhistory - INFO - Path: Part40mkii_0.4n_0.16mm_PETG_MK3.gcode
2022-02-10 15:56:11,915 - octoprint.plugins.printhistory - INFO - Path_On_disk: /home/pi/.octoprint/uploads/Part40mkii_0.4n_0.16mm_PETG_MK3.gcode
2022-02-10 15:56:12,155 - octoprint.plugins.printhistory - INFO - Got metadata from name
2022-02-10 15:56:12,275 - octoprint.plugins.printhistory - INFO - found fileData
2022-02-10 15:56:12,589 - octoprint.plugins.printhistory - INFO - Can't parse additional parameters from /home/pi/.octoprint/uploads/Part40mkii_0.4n_0.16mm_PETG_MK3.gcode
2022-02-10 15:56:12,589 - octoprint.plugins.printhistory - INFO - {}
2022-02-10 15:56:37,672 - octoprint.util.comm - INFO - Changing monitoring state from "Cancelling" to "Operational"
2022-02-10 15:56:49,195 - octoprint.filemanager.analysis - INFO - Analysis of entry local:Part40mkii_0.4n_0.16mm_PETG_MK3.gcode finished, needed 39.78s