bambuddy/backend/app/models
maziggy 328bac450a Stop auto-drying re-arming into a threshold it can never reach (#2770)
An H2D armed five 12-hour drying cycles inside four hours, one of them six
seconds after the previous one ended, and none ran more than a couple of
hours.

Two things combine. The firmware ends a cycle when it decides the filament
is dry rather than when the clock runs out, and reports no fault doing it --
across this printer's history the run length tracks how wet the spools were,
from nearly the full 12 hours starting at 32% down to minutes once the unit
sat at 10-13%. That part is the AMS doing its job.

The loop is ours. An AMS reports higher relative humidity while it is warm
than once it has cooled: the same unit read 10-13% cold and 15-20% through
every cycle. With the threshold at 14% the reading at the moment a cycle
ended was always still above it, so the next 30-second pass armed another
12-hour cycle. Nothing counted, nothing waited, and it only stopped when the
box finally cooled enough to read 13%.

Auto-drying now waits 30 minutes after a cycle ends before arming another on
the same unit, and gives up on a unit after two consecutive cycles that
bring the reading no lower -- logging why and sending a new notification,
on by default because it reports that Bambuddy has stopped acting. Progress
is judged against the lowest reading any cycle on that unit has ended at,
not against the threshold, so a genuinely wet spool in a humid room coming
down 40-37-35 keeps drying however far it still is from the target;
comparing against the best so far rather than the previous end stops a
sensor wobbling by one point reading as progress every other cycle. The
suspension lifts by itself once the reading falls below the threshold.

Neither guard can stop a running cycle, and a cycle Bambuddy cut short for a
print, or that the user stopped by hand, is not counted against the unit --
so a farm that dries between queue jobs is unaffected. The threshold field
now warns below 20%, and every cycle end logs the unit's temperature and
humidity, which is what made this diagnosable.

The same bundle showed unrelated tasks failing with "database is locked",
each inside a 30.000-second Discord connect timeout. Alarms are raised from
inside the loop that records sensor history, at a point where the new rows
are added but not committed; the first read in the notification path flushed
them to satisfy itself, opening a write transaction, and the provider was
then contacted over the network with that transaction still open. SQLite
allows one writer and 30 seconds outlives the 15-second busy timeout, so
every other write in that window failed. The two reads that run before a
provider is contacted no longer flush the caller's pending work, and the
connect timeout is 5 seconds rather than 30 -- the body keeps the full 30,
so image uploads on a slow uplink are unaffected. SQLite only; Postgres has
no single-writer limit.
2026-08-08 12:40:17 +02:00
..
__init__.py Show Home Assistant sensors on the printer card (#1148, #448) 2026-08-05 14:26:38 +02:00
active_print_spoolman.py feat(spoolman): remain%-delta fallback for no-3MF "Untitled" prints (#1820) 2026-06-25 10:46:57 +02:00
ams_history.py - Add interactive API Browser to Settings > API Keys 2026-01-02 15:00:21 +01:00
ams_label.py Feature AMS Info Card (#570) 2026-03-05 08:36:39 +01:00
api_key.py fix(auth): let API keys manage projects via new can_manage_projects scope (#1893) 2026-07-05 09:58:16 +02:00
archive.py implemented pr (worth fixing) feedback 2026-08-06 20:27:25 +02:00
auth_ephemeral.py feat: Two-Factor Authentication (TOTP, Email OTP) and OIDC/SSO – full implementation with admin UI (#933) 2026-04-13 13:24:28 +02:00
bug_report.py Add in-app bug reporting with relay, debug log collection, and privacy controls 2026-03-04 13:33:19 +01:00
color_catalog.py feat(inventory): multi-colour gradients, transparency, visual effects (#1154) 2026-04-29 09:13:33 +02:00
external_link.py Add "Open in new tab" toggle for external sidebar links (#338) 2026-02-12 07:51:55 +01:00
filament.py - Add interactive API Browser to Settings > API Keys 2026-01-02 15:00:21 +01:00
filament_sku_settings.py [Fix] Forecasting: Group spools by color and rework UI (#1814) 2026-06-25 11:35:57 +02:00
finance.py implemented pr (minor) feedback 2026-08-06 20:28:16 +02:00
github_backup.py fix(backup): stop overwrite writing a spool's other tag key (#2656) 2026-08-04 08:57:34 -04:00
group.py Add group-based permissions system with granular access control 2026-01-31 12:50:15 +01:00
kprofile_note.py - Add interactive API Browser to Settings > API Keys 2026-01-02 15:00:21 +01:00
library.py Add variant-group endpoints and cross-model queue creation (#671, #2570) 2026-08-03 11:10:11 +02:00
local_preset.py Add local profiles — import OrcaSlicer presets without Bambu Cloud (#310) 2026-02-09 17:00:02 +01:00
location.py feat(inventory): structured storage locations catalog (#1505) 2026-06-17 11:33:23 +02:00
long_lived_token.py feat(#1108): long-lived camera-stream tokens + fix(#1089) audit-pass tweaks 2026-04-25 10:44:37 +02:00
maintenance.py Add soft-delete for system maintenance tasks 2026-02-13 15:39:52 +01:00
notification.py Stop auto-drying re-arming into a threshold it can never reach (#2770) 2026-08-08 12:40:17 +02:00
notification_template.py Stop auto-drying re-arming into a threshold it can never reach (#2770) 2026-08-08 12:40:17 +02:00
oidc_provider.py feat(oidc): add is_env_managed column to oidc_providers 2026-07-28 21:05:29 +00:00
orca_base_cache.py Add local profiles — import OrcaSlicer presets without Bambu Cloud (#310) 2026-02-09 17:00:02 +01:00
pending_upload.py fix(archive,vp): strip .gcode.3mf properly + sync review/archive name (#1152) 2026-05-01 12:34:56 +02:00
pipeline_run.py feat(slicer): Pipelines — multi-copy + class targeting + fanout + runs dashboard + retry-failed + WS updates (#1425 PR C — completes the v3 design) 2026-06-27 16:52:05 +02:00
print_batch.py Add batch orders with a quantity per plate (#342) 2026-08-04 11:11:36 +02:00
print_log.py Add batch orders with a quantity per plate (#342) 2026-08-04 11:11:36 +02:00
print_queue.py implemented pr (worth fixing) feedback 2026-08-06 20:27:25 +02:00
printer.py Show Home Assistant sensors on the printer card (#1148, #448) 2026-08-05 14:26:38 +02:00
printer_ha_sensor.py Show Home Assistant sensors on the printer card (#1148, #448) 2026-08-05 14:26:38 +02:00
printer_sensor_history.py feat(heater-history): track nozzle / bed / chamber readings + per-tile chart-icon overlay opens history modal 2026-06-20 12:55:24 +02:00
project.py feat(projects): per-file print progress and complete-sets tracking (#1897) 2026-07-28 12:46:31 +02:00
project_bom.py - Project page enhancements and bug fixes 2025-12-28 12:04:33 +01:00
settings.py - Add interactive API Browser to Settings > API Keys 2026-01-02 15:00:21 +01:00
shopping_list.py [Fix] Forecasting: Group spools by color and rework UI (#1814) 2026-06-25 11:35:57 +02:00
slicer_pipeline.py feat(slicer): Slicer Pipelines — save & reuse a preset bundle in one click (#1425 PR A) 2026-06-27 13:56:18 +02:00
slot_preset.py Add local profiles — import OrcaSlicer presets without Bambu Cloud (#310) 2026-02-09 17:00:02 +01:00
smart_plug.py fix(smart-plugs): don't blank printer state when an accessory plug switches off (#2629) 2026-07-22 09:57:27 +02:00
smart_plug_energy_snapshot.py fix(energy): date-range energy in total mode + restart-resilient per-print tracking (#941) 2026-04-11 11:14:54 +02:00
sponsor_toast_state.py feat(sponsor-prompt): in-app toast at earned milestones 2026-06-20 15:50:58 +02:00
spool.py feat(inventory): structured storage locations catalog (#1505) 2026-06-17 11:33:23 +02:00
spool_assignment.py Sync 2026-02-12 11:54:50 +01:00
spool_catalog.py Sync 2026-02-12 07:07:50 +01:00
spool_k_profile.py Sync 2026-02-12 07:07:50 +01:00
spool_usage_history.py Add archive_id to SpoolUsageHistory model and update cost calculations in usage_tracker 2026-02-20 13:39:41 +01:00
spoolbuddy_device.py fix(spoolbuddy): lower /update permission to INVENTORY_UPDATE so kiosk's own Settings -> Update button works 2026-05-08 14:28:41 +02:00
spoolman_k_profile.py Feature/spoolman inventory UI (#1241) 2026-05-08 11:52:42 +02:00
spoolman_slot_assignment.py fix(spoolman): allow AMS-HT ams_id range in slot-assignment table (#1274) 2026-05-12 08:48:30 +02:00
user.py fix(cloud): stop reporting an expired Bambu Cloud sign-in as connected (issue #2562) 2026-07-14 11:29:56 +02:00
user_email_pref.py Post work PR #693 2026-03-17 12:24:36 +01:00
user_otp_code.py feat: Two-Factor Authentication (TOTP, Email OTP) and OIDC/SSO – full implementation with admin UI (#933) 2026-04-13 13:24:28 +02:00
user_totp.py feat: Two-Factor Authentication (TOTP, Email OTP) and OIDC/SSO – full implementation with admin UI (#933) 2026-04-13 13:24:28 +02:00
virtual_printer.py fix(vp): gate the slicer's AMS pick behind the toggle and scope its badges (#2700) 2026-07-31 16:16:39 +02:00