[Release] Moonraker Klipper 3D Printer Driver

Moonraker / Klipper 3D Printer Driver for Hubitat

Author: jdthomas24 | Version: 1.0.45 | Available via Hubitat Package Manager


Moonraker/Klipper 3D printer driver for Hubitat. Works with any Klipper printer running Moonraker — including Creality Sonicpad multi-printer setups and standard installs on Raspberry Pi, BTT Pi, CB1, and similar.


What It Does

Monitor and control your 3D printers directly from Hubitat with two dashboard tiles and full automation support.

aa Status Tile

Live printer dashboard showing:

  • Printer name, hostname, online status, and Klipper state
  • Current print state and filename
  • Hotend and bed temps vs target (side by side)
  • Progress bar with percentage
  • Elapsed time, time remaining, and ETA
  • Fan speed, filament status, and filament used
  • Red error banner when the printer reports an error

files List Tile

Recent prints browser showing:

  • Top 20 most recently printed files sorted by actual print history
  • Currently printing file pinned green at #1
  • Last completed print highlighted at the top
  • File numbers for use with the startPrint command

Installation

Via Hubitat Package Manager (Recommended)

  1. Open Hubitat Package Manager
  2. Click Install → Search by Keywords
  3. Search Moonraker Klipper Printer
  4. Select and install

Manual

  1. Drivers Code → New Driver — paste the driver code and Save Groovy
    https://raw.githubusercontent.com/jdthomas24/Hubitat-Apps-Drivers/refs/heads/main/Moonraker%20Klipper%203D%20Printer/Raw%20Code/Moonraker%20Klipper%20Printer.groovy

Setup

:warning: Name your Hubitat device BEFORE saving preferences — the name shows in the status tile as your printer name.

  1. Devices → Add Device → Virtual
  2. Name it to match your printer (e.g. 3D - CR10 Pro 1)
  3. Set Type to Moonraker Klipper PrinterSave Device
  4. Fill in preferences → Save PreferencesInitialize

Repeat for each printer.

Sonicpad

All printers share one IP — create one Hubitat device per printer with the same IP and a different port:

Sonicpad USB Port Moonraker Port
Port 1 7125
Port 2 7126
Port 3 7127
Port 4 7128

Standard Install

Each printer has its own IP. Use the port configured in your moonraker.conf — this varies by install, but 7125 is the most common default. Check your config if unsure.


Adding Tiles to Your Dashboard

  1. Open your Hubitat Dashboard
  2. Add a new tile → select Attribute
  3. Pick your printer device
  4. Select aaStatusTile or filesListTile
  5. Save

Automation and Rules

Automations & Rules

These attributes are available for use in Rule Machine or any Hubitat automation:

Attribute Values Example Use
printState printing, complete, paused, error, cancelled, standby Notify when print completes
filamentDetected true, false, unknown Alert on filament runout
error error message or none Push notification with error details
filename current print filename Log what was printed
lastPrint last completed filename Trigger post-print actions
chamberTemp (°C) temperature Monitor enclosure temp

Example rules:

  • printState = complete → turn off printer smart plug (with 5 min delay)
  • filamentDetected = false → send push notification "Filament runout on 3D - CR10 Pro 1"
  • printState = printing → turn on printer lights
  • error != none → send push notification with error message

Trouble shooting

Troubleshooting

Issue Fix
"klipper: unknown" in tile Hit Initialize on the device
Temps in wrong unit Preferences → set Temperature Unit → Save Preferences
File list not updating Hit Initialize on the device
Printer shows offline but is on Hit Initialize
filePathCache in State Variables Normal — used internally by startPrint

Questions or issues? Drop them below. Happy printing! :printer:

1 Like

Moonraker Klipper Printer Driver — v1.0.46


Bug Fix — Log Spam Eliminated

Root cause: setOnline() was logging "printer is online" on every single poll cycle regardless of actual state changes. The guard condition checking healthStatus != "online" never worked because healthStatus was never actually being set — sendEvent was missing from both setOnline() and setOffline().

Fix: Both setOnline() and setOffline() now correctly persist healthStatus via sendEvent, so the duplicate-check works as intended. Coming online from offline still logs once. Routine heartbeats no longer spam the log.


New Preference — Suppress Routine Poll Logs

A new "Suppress routine poll logs" toggle has been added to preferences, defaulting to ON.

When enabled, the "printer is online" heartbeat is silenced during all printer states. This is the recommended setting for most users who only care about meaningful events.

The following always log regardless of this setting:

  • Print started
  • Print complete :star:
  • Print error :warning:
  • Print paused / cancelled
  • Filament runout :warning:
  • Klipper state changes
  • Coming back online after being offline
  • Going offline

How to Update

Paste the updated code into Drivers Code and save. No device re-pairing or settings reset needed. The new preference defaults to ON automatically.