Skip to content

Instantly share code, notes, and snippets.

@abolians
Last active March 2, 2025 00:24
Show Gist options
  • Save abolians/248dc3c1a7c13f4f3e43afca0630bb17 to your computer and use it in GitHub Desktop.
Save abolians/248dc3c1a7c13f4f3e43afca0630bb17 to your computer and use it in GitHub Desktop.
homepage dashboard widget for 3D printers running Klipper FW
#curl -s 'http://printer.example.com:7125/printer/objects/query?webhooks&virtual_sdcard&print_stats' |jq '.result'
{
"eventtime": 9189.221155666,
"status": {
"webhooks": {
"state": "ready",
"state_message": "Printer is ready"
},
"virtual_sdcard": {
"file_path": null,
"progress": 0.0,
"is_active": false,
"file_position": 0,
"file_size": 0,
"first_layer_stop": false,
"layer": 0,
"layer_count": 0,
"run_dis": 0.0
},
"print_stats": {
"filename": "",
"total_duration": 0.0,
"print_duration": 0.0,
"filament_used": 0.0,
"state": "standby",
"message": "",
"info": {
"total_layer": null,
"current_layer": null
},
"power_loss": 0,
"z_pos": 0
}
}
}
#Moonraker API Doc
#https://moonraker.readthedocs.io/en/latest/external_api/introduction/
- 3D Printer:
icon: mdi-printer-3d
href: http://printer.example.com/#/home
widget:
type: customapi
url: http://printer.examples.com:7125/printer/objects/query?webhooks&virtual_sdcard&print_stats
method: GET
mappings:
- field:
result:
status:
webhooks: state
label: Status
- field:
result:
status:
print_stats: state
label: Print
- field:
result:
status:
print_stats: total_duration
label: Duration
format: duration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment