feat(usage-tracker): add diagnostic logging for slot-to-tray mapping investigation

Usage tracking works on X1E but fails on H2D Pro — the wrong tray
is identified, attributing usage to the wrong spool. The root cause
is unknown because we don't know what MQTT mapping data each printer
model reports.

Adds INFO-level logging at print start and completion:
- state.raw_data["mapping"] (unknown format, preserved but never parsed)
- tray_now, last_loaded_tray values
- All raw_data keys containing "map" (discovery)
- Per-AMS-tray summary: tray_type, tray_color, tray_now, tray_tar

This enables comparing MQTT behavior across printer models without
requiring DEBUG mode, so testers can send normal logs.
This commit is contained in:
maziggy
2026-02-16 17:04:47 +01:00
parent cf7c459099
commit ca9ffbba5d
3 changed files with 41 additions and 1 deletions
+2
View File
@@ -235,6 +235,8 @@ class TestOnPrintComplete:
printer_manager = MagicMock()
printer_manager.get_status.return_value = SimpleNamespace(
raw_data={"ams": [{"id": 0, "tray": [{"id": 0, "remain": 70}]}]},
tray_now=0,
last_loaded_tray=-1,
)
# db returns assignment then spool