API shows wrong completion percentage of job

What is the problem?
The Octoprint API shows a wrong completion percentage of current print. The octoprint client shows the correct percentage.

Left: http://{ip}/api/job. Right: http://{ip}/

octoprint - 2020-04-10T210106.740.log (1.3 MB)

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ... as much data as possible)

  • Printer: CR-10
  • OctoPrint: v1.3.12
  • OctoPi: v0.15.1
  • Raspberry Pi 3

Also in safe mode?

The print is still going, and don't know if this is a one-off just yet. Will try on the same printer after the print is done - same .gcode file but in safe mode!

Little update. The print is currently at 97% (in the Octoprint client), and 93 in the api.

I wonder if there are huge chunks of comments at the beginning/ending of the gcode file in question. (Just a weird thought.)

cat before.gcode | grep -v "^;" > after.gcode

There is not - just a standard "Build Summary".
a550a384-7b4d-11ea-8a98-b827ebd922b0.gcode (3.6 MB)

The print is currently running in OctoPrint safe mode. So far the API says 3% and the OctoPrint client says the same, so so far so good. I also noticed that the percentages "flattened out" at the end of the print. Around ~93% the API caught up, so it's possible that this is happening in the beginning of the print as well.

We first noticed the difference about 60% into the print (60% according to OctoPrint client, ~20% according to the api)

Well. Looks like it works just fine in safe mode. I'll check the plugins and see which one is the potential sinner...

1 Like

You are on an older version of octoprint... Octopi is now 0.17, and Octoprint is 1.4.0

My money is on PrintTimeGenius. I noticed that it provided the print time estimate in your API output and I think it also overrides the percentage on the API based on its analysis. That that doesn't also reflect on the push socket (which feeds the percentage, or should feed it) might be a bug though.

Checking the code I didn't see any signs that it modifies the "completion" percentage. But if the percentage is calculated from the "time left" estimate, it'll still have an affect I guess. Still a bit weird that the percentage on the client is different from the API, as everything else is in sync.

@AlbertMN did you ever get this fixed? My percent complete is all over the place in Home Assistant.

This is still going on... I am using Print time genius and there is a 20% difference not being reported to the api.

Print time genius overrides the value displayed in the UI with it's own time based progress estimate. The one you see on the UI is OctoPrint's default progress which, iirc, is file based.

See this; PTG % in octoprint different from % in API · Issue #267 · eyal0/OctoPrint-PrintTimeGenius · GitHub

@benquan @thelefty15

1 Like