API does not expose fan speed


First time poster, long time observer.
Hello there.

I don't know if this is an intended feature, or just me not finding it.
I would expect the fan speed to be within the printer status endpoint response.
Is there some reason for this, or there was just never the need for it?


Marlin has the ability to set the fan speed with M106 S0-255 but no command exists to read the current speed.

A plugin for OctoPrint could probably be written that captured the M106 and M107 commands from the gcode.


Just for the records:
Since version 1.7.0 the DisplayLayerProgress Plugin also can display the fanspeed :wink:


https://github.com/ntoff/OctoPrint-FanSpeedSlider also captures the fan speed from M106 and M107 commands as it has a minimum and maximum setting that will adjust what is actually sent to the printer.

I have modified my version to also send the speed from the M106 command to an external script but the author of that plugin didn't think my modifications were "in the spirit" of the plugin. I'll get around to writing a separate plugin with just my changes someday.


hmmm... I am thinking about a new feature for my DisplayLayerProgress - Plugin.
Exposing all "data" to:

  • pre definied URL(s)
  • shell command(s)

If you also like the idea, please create an issue on the GitHub-Page (https://github.com/OllisGit/OctoPrint-DisplayLayerProgress/issues)



I ended up stitching together a SimpleApiPlugin with a hook for the octoprint.comm.protocol.gcode.sending as @OllisGit did, but way simpler since I just really need a way to get the current fan speed.
But as soon as I moved to a BlueprintPlugin (following the example described here) I started getting 404s all around (I want to implement more than one endpoint).
The logs don't show any errors besides the tornado.access 404.
Is there any known issue with the BlueprintPlugin or common pitfall?


Did you adjust your endpoint? BlueprintPlugins have a different endpoint than SimpleApiPlugins (to allow coexistence and also since a BlueprintPlugin doesn't necessarily need to provide a new bit of the API, could also just be some specific endpoint like e.g. in the Discovery plugin for UPNP's discovery.xml)


What do you mean by this? From the doc it seems to be a similar endpoint:

Your blueprint will be published by OctoPrint under the base URL /plugin/<plugin identifier>/,so the above example of a plugin with the identifier “myblueprintplugin” would be reachable under /plugin/myblueprintplugin/echo.


Oh wait... is it /plugin/someplugin instead of /api/plugin/someplugin?

EDIT: Tested! It is. Thanks!


Just to add my own 2 cents, most printer firmwares don't report back anything when setting the fan speed via sd card based prints or their LCD panel, nor do they provide a way to query the speed.

https://github.com/ntoff/OctoPrint-FanSpeed Someone posted a fan speed plugin in octoprint's issue tracker a while ago and I sort of ran with it and added the ability to detect fan speed changes from repetier firmware. If the fan speed is reported back by the firmware (currently only repetier firmware is known to do that), the plugin will see it and catch it in the same way it catches M107 / M106 and display the fan speed in the navigation bar.