Skip to content

Mainsail: show chamber temperature and compact ETA - #1063

Open
HK-Moebius wants to merge 1 commit into
linuxserver:masterfrom
HK-Moebius:mainsail-chamber-eta
Open

HK-Moebius wants to merge 1 commit into
linuxserver:masterfrom
HK-Moebius:mainsail-chamber-eta

Conversation

@HK-Moebius

Copy link
Copy Markdown
Contributor

Mainsail: show chamber temperature and a compact ETA

Follow-up to #1042, as suggested by @KodeStar in #1042 (comment): instead of a separate MainsailHT90 tile, this extends the existing Mainsail enhanced app so every Klipper printer with a chamber sensor gets it.

Changes

Chamber temperature (only if the printer has one)

  • Klipper has no dedicated chamber object, so the app picks the first sensor with "chamber" in its name (case-insensitive) from heaters.available_sensors, in this order: heater_generic, temperature_sensor, temperature_fan, then any other object. The last step covers printer-specific objects like heater_chamber on the Prusa Pro HT90 (its sensors: heater_bed, heater_generic panel, heater_chamber, extruder). Because available_sensors only lists temperature objects, macros or fans named "chamber" can't match.
  • The sensor list comes from heaters=available_sensors, added to the existing printer/objects/query request. A second query for the temperature only happens when a chamber sensor exists.
  • Printers without a chamber sensor make the same number of requests as before and the tile looks unchanged.
  • Shown in every state (standby, printing, complete …), so you can see the chamber heat up or cool down.

ETA

  • The remaining time is shown as 2h 05min instead of Carbon's diffForHumans() ("2 hours from now"). The label changes from "Finish" to "ETA".
  • Below one minute, or when the estimate is already exceeded: Soon!. Without any estimate: N/A, as before.
  • The calculation is unchanged from Fix Mainsail livestats: wrong progress percentage and remaining time #1041 (slicer estimate from the file metadata minus print_duration, otherwise extrapolated from progress).

Testing

  • php -l and PHPCS PSR12 (same settings as the lint workflow) pass, and so does node testRunner.js.
  • On a real Prusa Pro HT90, both requests the app makes return the expected data: heaters=available_sensors lists heater_chamber, and heater_chamber=temperature returns 16.79, so the tile shows Chamber 17°C.
  • Ran livestats() and the blade template against mocked Moonraker responses, including the real HT90 sensor list above:
Case Tile
HT90 (heater_chamber), printing Complete 40% · ETA 2h 05min · Chamber 55°C
HT90 (heater_chamber), standby State Standby · Chamber 38°C
heater_generic chamber + temperature_sensor chamber_top heater_generic is used
No chamber sensor, printing Complete 25% · ETA 1h 30min (as before, new ETA format)
No chamber sensor, standby State Standby (unchanged, no extra request)
< 1 min left / estimate exceeded ETA Soon!

🤖 Generated with Claude Code

- Show the chamber temperature when the printer reports a heater or
  sensor with "chamber" in its name: heater_generic, temperature_sensor
  and temperature_fan first, then printer-specific objects such as
  heater_chamber on the Prusa Pro HT90. Sensors come from
  heaters.available_sensors in the existing query, so printers without
  a chamber make no extra request and look as before.
- Show the remaining time as "2h 05min" instead of "2 hours from now",
  "Soon!" below one minute.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants