fix(mqtt): ignore transient 'updated' kobra_state between print/report events

This commit is contained in:
Pavulon87
2026-07-14 13:37:28 +02:00
committed by Your Name
parent 1e63033c4b
commit f681246ae1

View File

@@ -1325,8 +1325,10 @@ class KobraXBridge:
def _on_print(self, payload: dict):
d = payload.get("data") or {}
kobra_state = payload.get("state", "")
self._state["print_state"] = KOBRA_TO_KLIPPER_STATE.get(kobra_state, "printing")
if kobra_state:
self._state["print_state"] = KOBRA_TO_KLIPPER_STATE.get(kobra_state, "printing")
if kobra_state != "" and kobra_state != "updated":
self._state["kobra_state"] = kobra_state
# Automatically switch on the camera at print start (settings option).
@@ -1435,7 +1437,8 @@ class KobraXBridge:
kobra_state = proj_state or d.get("state", "")
if kobra_state:
self._state["print_state"] = KOBRA_TO_KLIPPER_STATE.get(kobra_state, "standby")
self._state["kobra_state"] = kobra_state
if kobra_state != "" and kobra_state != "updated":
self._state["kobra_state"] = kobra_state
# Hide the upload banner after the print ends (Issue #29) - the state also
# arrives via info/report (project.state) depending on the printer, not only print/report.
if kobra_state in ("finished", "stoped", "canceled"):