mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-18 03:54:17 +02:00
feat(smart-plugs): auto-off after AMS drying completes (#1349)
Reporter Kyobinoyo asked for the equivalent of the existing print-finish auto-off but triggered when AMS drying ends. Two new SmartPlug columns: auto_off_after_drying (default false), off_delay_after_drying_minutes (default 10 — AMS chamber is hot post-cycle so longer cooldown than the print-finish default of 5). SQLite + Postgres migrations both idempotent. Trigger lives in BambuMQTTClient — per-AMS _previous_dry_times tracks the dry_time > 0 → 0 falling edge and fires a new on_drying_complete(ams_id) callback. Plumbed through PrinterManager.set_drying_complete_callback to SmartPlugManager.on_drying_complete(printer_id, db), which walks linked plugs and respects the per-plug toggle. Catches queue, ambient and manual drying identically because it observes firmware state, not scheduler intent. Frontend: single "Auto Off After Drying" toggle + delay input on the smart plug card, next to the existing print-finish auto-off section. Per-AMS plug routing (separate plug for AMS only, per-AMS targeting on dual-AMS printers) deferred — Bambuddy's plug model is plug→printer, so the trigger fires whenever any AMS on the linked printer finishes a cycle.
This commit is contained in:
@@ -1447,6 +1447,9 @@ export interface SmartPlug {
|
||||
off_delay_mode: 'time' | 'temperature';
|
||||
off_delay_minutes: number;
|
||||
off_temp_threshold: number;
|
||||
// #1349: auto-off after AMS drying completes.
|
||||
auto_off_after_drying: boolean;
|
||||
off_delay_after_drying_minutes: number;
|
||||
username: string | null;
|
||||
password: string | null;
|
||||
// Power alerts
|
||||
@@ -1518,6 +1521,9 @@ export interface SmartPlugCreate {
|
||||
off_delay_mode?: 'time' | 'temperature';
|
||||
off_delay_minutes?: number;
|
||||
off_temp_threshold?: number;
|
||||
// #1349
|
||||
auto_off_after_drying?: boolean;
|
||||
off_delay_after_drying_minutes?: number;
|
||||
username?: string | null;
|
||||
password?: string | null;
|
||||
// Power alerts
|
||||
@@ -1581,6 +1587,9 @@ export interface SmartPlugUpdate {
|
||||
off_delay_mode?: 'time' | 'temperature';
|
||||
off_delay_minutes?: number;
|
||||
off_temp_threshold?: number;
|
||||
// #1349
|
||||
auto_off_after_drying?: boolean;
|
||||
off_delay_after_drying_minutes?: number;
|
||||
username?: string | null;
|
||||
password?: string | null;
|
||||
// Power alerts
|
||||
|
||||
Reference in New Issue
Block a user