[RELEASE] Klipper/Moonraker 3D Printer Driver

Hi,

I saw the Octoprint driver didn't fully support Klipper, so I wrote one in a day, it's provided as is and you just need to add the Klipper Pi IP address, this uses the Moonraker API and was specifically developed to work with Fluidd as that is my setup, I understand that this should also work with Octoprint assuming Moonraker is installed there too..

I don't have a lot of spare time to further develop but pull requests are welcome, other features may be added when I have some time to do so.

Features:

  • Get various print/printer details, see pic below (ad-hoc or timed refresh)
  • Printer Control - Home (G28), FIRMWARE_RESTART, EMERGENCY_STOP
  • GCODE - execute any gcode command including custom gcode
  • Print file - Print any file on the server by filename
  • Print Control - Pause, Resume, Cancel
  • Host Software/Server Restart
  • OS - Reboot & Shutdown

4 Likes

Added version 0.4 with several bug fixes..

Looks great, haven't tried it yet. I'm wondering if this allows fluid to control a hubitat device? I'd like to turn off a Z wave switch when the print ends. Thanks for your effort!

Yes of course, can control Klipper and react to Klipper events

This is really well timed! I was just looking for a solution to use a Sonoff zigbee plug (without flashing Tasmoto) to turn my printer on and off when not being used.

One simple question - how do you pair the Klipper/Fluidd device with Hubitat?

Just add the driver and add the device as a virtual device, then specify the IP address of Klipper in the device itself..

1 Like

Thanks. I'd forgotten about virtual devices...

Got it running and did a test print. All works well and I am able to see the job status, etc. Thanks for putting this driver together!

One question - is there a way to recognize that I've sent a job to klipper and use this event to trigger a hubitat action (turn on the smart plug). This would allow me to use the smart plug to both turn on and turn off the printer. I looked through the driver code and didn't spot anything that checks the queue or anything like that.

Sorry I didn't get any notification of your question, however I don't think so, I guess if you send a job to Klipper and the MCU isn't alive it'll fail even if the printer was then turned on later.. you could obviously setup an action to turn on the switch, pause and then do a firmware restart, allowing everything to be in the correct state before hand, but I think what you are asking needs to be in Klipper itself

V0.5 - Changed RunIn to Schedule, changed checks from seconds to minutes in settings

This will fix longer term reliability issues.. mine had unscheduled itself likely due to another issue with an unexpected value being returned from Klipper (next time I print I'll see if I can work out what the issue is)

V0.6 - Various bugfixes, should be less spammy now

V0.7 Fixed "Complete" status reporting and added option to enable detailed reporting (previous was creating too much noise)

V0.8 2022-10-08 Fixed everything I broke in the last update

Ok...I haven't been active here for a long time. Still have my hub doing great!!! Just saw this looking for some Klipper update stuff and was intrigued. It installed perfect and easy for me!!! All current data from my printer is displaying great!! Thanks for a wonderful addition. Now to think how to integrate this into some of my automations...

1 Like

No problem, I’m just using it mostly for print complete notifications, I’ve just attached a smart plug to my printers so will see if I can add support for powering the printer on and off rather than just reporting.

But if you have any issues let me know, it’s not very well tested, but I think I’ve ironed out most of them now!

1 Like

@jebbett I just stumbled across your Klipper driver ... thank you mate, you are a legend!!! :sunglasses:

it took me 2 mins to setup the driver:

and then 3 mins to write a notifications rule!

:pray:

No problem, let me know how you get on, it was initially rushed together, but I think I’ve sorted most of the bugs, any issues let me know!

1 Like

I am seeing some errors, but it works regardless. :+1:

I can send notifications and turn off my filament dryer automatically now, which is super handy for mid-print filament changes.

If you manually disable debug logging do you still get the errors? If not then it’s fine it’s an issue with the debug lines rather than the core code, looks like it’s erroring on the additional reporting data which might be different based on slicer perhaps

I do, it looks likes it’s choking on the print job name. Or it’s a Fluidd vs Mainsail implantation quirk.

Btw, where do you get the "status” states from? I was only aware of these states:

I had to make my print complete notification a little more complex than I’d assumed I would need to.