feat(power): add setting to show current status instead of action

Reddit report: the header power toggle switches correctly but
displays "backwards" - the button shows the action a click would
perform (e.g. "Aus" while the printer is on), not the printer's
actual current state, which some users find counterintuitive.

Both readings are legitimate, so this adds a per-printer opt-in
(Settings -> Power Switch -> "Aktuellen Status statt Aktion
anzeigen") rather than flipping the default for everyone.
power_status_inverted=0 (default) keeps today's behavior; =1 mirrors
the actual on/off state instead. The backend's power-status parsing
is untouched - only _applyHeaderPowerState() picks which state to
display, so the click handler still always toggles the real state
regardless of display mode.
This commit is contained in:
2026-09-01 17:31:38 +02:00
parent b44c9021a0
commit 7d28ed4e92
11 changed files with 30 additions and 2 deletions

View File

@ -66,6 +66,7 @@ CONFIG_ENV_MAPPING = {
"POWER_ON_URL": (CONFIG_SECTION_CONNECTION, "power_on_url"),
"POWER_OFF_URL": (CONFIG_SECTION_CONNECTION, "power_off_url"),
"POWER_STATUS_URL": (CONFIG_SECTION_CONNECTION, "power_status_url"),
"POWER_STATUS_INVERTED": (CONFIG_SECTION_CONNECTION, "power_status_inverted"),
"DEFAULT_AMS_SLOT": (CONFIG_SECTION_PRINT, "default_ams_slot"),
"AUTO_LEVELING": (CONFIG_SECTION_PRINT, "auto_leveling"),
"VIBRATION_COMPENSATION": (CONFIG_SECTION_PRINT, "vibration_compensation"),
@ -487,6 +488,7 @@ DEVICE_ID = get("DEVICE_ID", "")
POWER_ON_URL = get("POWER_ON_URL", "")
POWER_OFF_URL = get("POWER_OFF_URL", "")
POWER_STATUS_URL = get("POWER_STATUS_URL", "")
POWER_STATUS_INVERTED = _safe_int(get("POWER_STATUS_INVERTED", "0"), 0)
DEFAULT_AMS_SLOT = get("DEFAULT_AMS_SLOT", "auto")
AUTO_LEVELING = _safe_int(get("AUTO_LEVELING", "1"), 1)
VIBRATION_COMPENSATION = _safe_int(get("VIBRATION_COMPENSATION", "0"), 0)