Show Spoolman fill level for AMS Lite and external spools (#293)

AMS Lite units (A1 series) have no weight sensor and always report 0%
fill level. When a spool is linked to Spoolman with weight data, use
Spoolman's remaining weight as a fallback. External spools also show
fill level from Spoolman data instead of always showing unknown.

Backend: Enrich GET /spoolman/spools/linked response with
remaining_weight and filament_weight alongside spool ID.

Frontend: Add getSpoolmanFillLevel() helper. Update regular AMS, HT
AMS, and external spool fill computations to use Spoolman fallback
when AMS reports 0%. Show "(Spoolman)" indicator in hover card when
fill data comes from Spoolman.
This commit is contained in:
maziggy
2026-02-08 08:47:18 +01:00
parent e073e494c7
commit 9cbd66593e
16 changed files with 819 additions and 439 deletions
@@ -10,6 +10,7 @@ interface FilamentData {
kFactor: string;
fillLevel: number | null; // null = unknown
trayUuid?: string | null; // Bambu Lab spool UUID for Spoolman linking
fillSource?: 'ams' | 'spoolman'; // Source of fill level data
}
interface SpoolmanConfig {
@@ -229,8 +230,11 @@ export function FilamentHoverCard({ data, children, disabled, className = '', sp
<Droplets className="w-3 h-3" />
{t('ams.fill')}
</span>
<span className="text-xs text-white font-semibold">
<span className="text-xs text-white font-semibold flex items-center gap-1">
{data.fillLevel !== null ? `${data.fillLevel}%` : '—'}
{data.fillSource === 'spoolman' && data.fillLevel !== null && (
<span className="text-[9px] text-bambu-gray font-normal">{t('spoolman.fillSourceLabel')}</span>
)}
</span>
</div>
{/* Fill bar */}