mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-08 15:11:21 +02:00
@@ -16,6 +16,16 @@ class FolderCreate(BaseModel):
|
||||
archive_id: int | None = None
|
||||
|
||||
|
||||
class ExternalFolderCreate(BaseModel):
|
||||
"""Schema for linking an external folder."""
|
||||
|
||||
name: str = Field(..., min_length=1, max_length=255)
|
||||
external_path: str = Field(..., min_length=1, max_length=500)
|
||||
readonly: bool = True
|
||||
show_hidden: bool = False
|
||||
parent_id: int | None = None
|
||||
|
||||
|
||||
class FolderUpdate(BaseModel):
|
||||
"""Schema for updating a folder."""
|
||||
|
||||
@@ -35,6 +45,10 @@ class FolderResponse(BaseModel):
|
||||
archive_id: int | None = None
|
||||
project_name: str | None = None
|
||||
archive_name: str | None = None
|
||||
is_external: bool = False
|
||||
external_path: str | None = None
|
||||
external_readonly: bool = False
|
||||
external_show_hidden: bool = False
|
||||
file_count: int = 0 # Computed field
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
@@ -53,6 +67,9 @@ class FolderTreeItem(BaseModel):
|
||||
archive_id: int | None = None
|
||||
project_name: str | None = None
|
||||
archive_name: str | None = None
|
||||
is_external: bool = False
|
||||
external_path: str | None = None
|
||||
external_readonly: bool = False
|
||||
file_count: int = 0
|
||||
children: list["FolderTreeItem"] = []
|
||||
|
||||
@@ -104,6 +121,7 @@ class FileResponse(BaseModel):
|
||||
folder_name: str | None = None
|
||||
project_id: int | None
|
||||
project_name: str | None = None
|
||||
is_external: bool = False
|
||||
|
||||
filename: str
|
||||
file_path: str
|
||||
@@ -145,6 +163,7 @@ class FileListResponse(BaseModel):
|
||||
|
||||
id: int
|
||||
folder_id: int | None
|
||||
is_external: bool = False
|
||||
filename: str
|
||||
file_type: str
|
||||
file_size: int
|
||||
|
||||
@@ -35,6 +35,10 @@ class NotificationProviderBase(BaseModel):
|
||||
on_print_failed: bool = Field(default=True, description="Notify on print failed")
|
||||
on_print_stopped: bool = Field(default=True, description="Notify when print is stopped/cancelled")
|
||||
on_print_progress: bool = Field(default=False, description="Notify at 25%, 50%, 75% progress")
|
||||
on_print_missing_spool_assignment: bool = Field(
|
||||
default=False,
|
||||
description="Notify when a print starts with required trays missing spool assignments",
|
||||
)
|
||||
|
||||
# Event triggers - printer status
|
||||
on_printer_offline: bool = Field(default=False, description="Notify when printer goes offline")
|
||||
@@ -119,6 +123,7 @@ class NotificationProviderUpdate(BaseModel):
|
||||
on_print_failed: bool | None = None
|
||||
on_print_stopped: bool | None = None
|
||||
on_print_progress: bool | None = None
|
||||
on_print_missing_spool_assignment: bool | None = None
|
||||
|
||||
# Event triggers - printer status
|
||||
on_printer_offline: bool | None = None
|
||||
|
||||
@@ -15,6 +15,7 @@ class EventType(StrEnum):
|
||||
PRINT_FAILED = "print_failed"
|
||||
PRINT_STOPPED = "print_stopped"
|
||||
PRINT_PROGRESS = "print_progress"
|
||||
PRINT_MISSING_SPOOL_ASSIGNMENT = "print_missing_spool_assignment"
|
||||
PRINTER_OFFLINE = "printer_offline"
|
||||
PRINTER_ERROR = "printer_error"
|
||||
FILAMENT_LOW = "filament_low"
|
||||
@@ -62,6 +63,13 @@ EVENT_VARIABLES: dict[str, list[str]] = {
|
||||
"app_name",
|
||||
],
|
||||
"print_progress": ["printer", "filename", "progress", "remaining_time", "eta", "timestamp", "app_name"],
|
||||
"print_missing_spool_assignment": [
|
||||
"printer",
|
||||
"missing_slots",
|
||||
"missing_slot_details",
|
||||
"timestamp",
|
||||
"app_name",
|
||||
],
|
||||
"printer_offline": ["printer", "timestamp", "app_name"],
|
||||
"printer_error": ["printer", "error_type", "error_detail", "timestamp", "app_name"],
|
||||
"filament_low": ["printer", "slot", "remaining_percent", "color", "timestamp", "app_name"],
|
||||
@@ -140,6 +148,13 @@ SAMPLE_DATA: dict[str, dict[str, str]] = {
|
||||
"timestamp": "2024-01-15 15:00",
|
||||
"app_name": "Bambuddy",
|
||||
},
|
||||
"print_missing_spool_assignment": {
|
||||
"printer": "Bambu X1C",
|
||||
"missing_slots": "A1, A3",
|
||||
"missing_slot_details": "- A1: PLA Basic\n- A3: PETG HF",
|
||||
"timestamp": "2024-01-15 14:30",
|
||||
"app_name": "Bambuddy",
|
||||
},
|
||||
"printer_offline": {
|
||||
"printer": "Bambu X1C",
|
||||
"timestamp": "2024-01-15 14:30",
|
||||
|
||||
@@ -136,6 +136,7 @@ class AMSTray(BaseModel):
|
||||
nozzle_temp_max: int | None = None # Max nozzle temperature
|
||||
drying_temp: int | None = None # RFID-recommended drying temp
|
||||
drying_time: int | None = None # RFID-recommended drying time (hours)
|
||||
state: int | None = None # AMS tray state: 9=empty, 10=spool present not loaded, 11=loaded
|
||||
|
||||
|
||||
class AMSUnit(BaseModel):
|
||||
|
||||
@@ -48,6 +48,7 @@ class SmartPlugBase(BaseModel):
|
||||
enabled: bool = True
|
||||
auto_on: bool = True
|
||||
auto_off: bool = True
|
||||
auto_off_persistent: bool = False
|
||||
off_delay_mode: Literal["time", "temperature"] = "time"
|
||||
off_delay_minutes: int = Field(default=5, ge=0, le=60)
|
||||
off_temp_threshold: int = Field(default=70, ge=30, le=150)
|
||||
@@ -115,6 +116,7 @@ class SmartPlugUpdate(BaseModel):
|
||||
enabled: bool | None = None
|
||||
auto_on: bool | None = None
|
||||
auto_off: bool | None = None
|
||||
auto_off_persistent: bool | None = None
|
||||
off_delay_mode: Literal["time", "temperature"] | None = None
|
||||
off_delay_minutes: int | None = Field(default=None, ge=0, le=60)
|
||||
off_temp_threshold: int | None = Field(default=None, ge=30, le=150)
|
||||
|
||||
@@ -16,6 +16,7 @@ class DeviceRegisterRequest(BaseModel):
|
||||
calibration_factor: float = 1.0
|
||||
nfc_reader_type: str | None = None
|
||||
nfc_connection: str | None = None
|
||||
backend_url: str | None = None
|
||||
has_backlight: bool = False
|
||||
|
||||
|
||||
@@ -31,6 +32,7 @@ class DeviceResponse(BaseModel):
|
||||
calibration_factor: float
|
||||
nfc_reader_type: str | None = None
|
||||
nfc_connection: str | None = None
|
||||
backend_url: str | None = None
|
||||
display_brightness: int = 100
|
||||
display_blank_timeout: int = 0
|
||||
has_backlight: bool = False
|
||||
@@ -42,7 +44,9 @@ class DeviceResponse(BaseModel):
|
||||
uptime_s: int
|
||||
update_status: str | None = None
|
||||
update_message: str | None = None
|
||||
system_stats: dict | None = None
|
||||
online: bool = False
|
||||
ssh_public_key: str | None = None
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
@@ -58,11 +62,14 @@ class HeartbeatRequest(BaseModel):
|
||||
ip_address: str | None = None
|
||||
nfc_reader_type: str | None = None
|
||||
nfc_connection: str | None = None
|
||||
backend_url: str | None = None
|
||||
system_stats: dict | None = None
|
||||
|
||||
|
||||
class HeartbeatResponse(BaseModel):
|
||||
pending_command: str | None = None
|
||||
pending_write_payload: dict | None = None
|
||||
pending_system_payload: dict | None = None
|
||||
tare_offset: int
|
||||
calibration_factor: float
|
||||
display_brightness: int = 100
|
||||
@@ -104,10 +111,6 @@ class UpdateSpoolWeightRequest(BaseModel):
|
||||
# --- Calibration schemas ---
|
||||
|
||||
|
||||
class TareRequest(BaseModel):
|
||||
pass
|
||||
|
||||
|
||||
class SetTareRequest(BaseModel):
|
||||
tare_offset: int
|
||||
|
||||
@@ -142,3 +145,24 @@ class WriteTagResultRequest(BaseModel):
|
||||
class DisplaySettingsRequest(BaseModel):
|
||||
brightness: int = Field(ge=0, le=100)
|
||||
blank_timeout: int = Field(ge=0)
|
||||
|
||||
|
||||
class SystemConfigRequest(BaseModel):
|
||||
backend_url: str = Field(..., min_length=1, max_length=255)
|
||||
api_key: str | None = Field(default=None, max_length=255)
|
||||
|
||||
|
||||
class SystemCommandResultRequest(BaseModel):
|
||||
command: str
|
||||
success: bool
|
||||
message: str | None = None
|
||||
|
||||
|
||||
# --- Diagnostics schemas ---
|
||||
|
||||
|
||||
class DiagnosticResultRequest(BaseModel):
|
||||
diagnostic: str # 'nfc', 'scale', or 'read_tag'
|
||||
success: bool
|
||||
output: str
|
||||
exit_code: int
|
||||
|
||||
Reference in New Issue
Block a user