mirror of
https://github.com/RunLit/Bambu-Run.git
synced 2026-08-22 06:44:19 +01:00
The printer publishes partial deltas most of the time; the accumulator merges each one onto whatever state it already has. When the printer powers off, our cloud MQTT connection stays up (it's a persistent session to Bambu's broker, not a socket to the printer), so nothing signals the outage. When the printer reconnects and resumes its normal partial updates, those deltas get merged onto the stale pre-outage state — fields the delta doesn't mention (e.g. nozzle_temp) stay frozen at their old values. Sending any command happens to trigger a full report from the printer, which is why toggling the light "fixes" it. Track the time of the last message per BambuPrinter instance. When a new message arrives after a gap longer than BAMBU_RUN_MQTT_RESYNC_GAP_SECONDS (default 90s), request a pushall before processing it, forcing a complete state refresh instead of trusting the partial delta to overwrite stale fields.