Self-hosted homelab infrastructure visualizer — interactive network diagram with live status monitoring
TypeScript diagramhomelabhomelab-infrastructure-observabilitynetworkproxmox-veself-hostedzigbeezwavezwave-js
fix: re-scan updates services on existing pending devices instead of skipping
Pouzor6e6041d871e9
diff --git a/backend/app/services/scanner.py b/backend/app/services/scanner.pyindex 7bb530e..1f24a50 100644--- a/backend/app/services/scanner.py+++ b/backend/app/services/scanner.py@@ -115,27 +115,32 @@ async def run_scan(ranges: list[str], db: AsyncSession, run_id: str) -> None:services = fingerprint_ports(host["open_ports"])suggested_type = suggest_node_type(host["open_ports"])- # Skip if already pending (by IP)- existing = await db.execute(+ # Update existing pending device or create a new one+ existing_result = await db.execute(select(PendingDevice).where(PendingDevice.ip == host["ip"],PendingDevice.status == "pending",))- if existing.scalar_one_or_none():- continue-- device = PendingDevice(- ip=host["ip"],- mac=host.get("mac"),- hostname=host.get("hostname"),- os=host.get("os"),- services=services,- suggested_type=suggested_type,- status="pending",- )- db.add(device)- devices_found += 1+ existing = existing_result.scalar_one_or_none()+ if existing:+ existing.mac = host.get("mac") or existing.mac+ existing.hostname = host.get("hostname") or existing.hostname+ existing.os = host.get("os") or existing.os+ existing.services = services+ existing.suggested_type = suggested_type+ else:+ device = PendingDevice(+ ip=host["ip"],+ mac=host.get("mac"),+ hostname=host.get("hostname"),+ os=host.get("os"),+ services=services,+ suggested_type=suggested_type,+ status="pending",+ )+ db.add(device)+ devices_found += 1# Commit immediately so the device is visible right awayawait db.commit()