Skip to content

Self-hosted homelab infrastructure visualizer — interactive network diagram with live status monitoring

feat(nodes): add KVM switch as a device type

Pouzor5040b7007359
diff --git a/backend/app/data/service_signatures.json b/backend/app/data/service_signatures.json
index 54821fb..3b1fbd0 100644
--- a/backend/app/data/service_signatures.json
+++ b/backend/app/data/service_signatures.json
@@ -204,6 +204,11 @@
{"port": null, "protocol": "tcp", "banner_regex": null, "http_regex": "Syncthing", "service_name": "Syncthing", "icon": "refresh-cw", "category": "storage", "suggested_node_type": "server"},
{"port": null, "protocol": "tcp", "banner_regex": null, "http_regex": "Gitea", "service_name": "Gitea", "icon": "git-branch", "category": "dev", "suggested_node_type": "server"},
+ {"port": null, "protocol": "tcp", "banner_regex": null, "http_regex": "[Pp]i[Kk]VM", "service_name": "PiKVM", "icon": "monitorcog", "category": "kvm", "suggested_node_type": "kvm"},
+ {"port": null, "protocol": "tcp", "banner_regex": null, "http_regex": "TinyPilot", "service_name": "TinyPilot", "icon": "monitorcog", "category": "kvm", "suggested_node_type": "kvm"},
+ {"port": null, "protocol": "tcp", "banner_regex": null, "http_regex": "JetKVM", "service_name": "JetKVM", "icon": "monitorcog", "category": "kvm", "suggested_node_type": "kvm"},
+ {"port": null, "protocol": "tcp", "banner_regex": null, "http_regex": "NanoKVM", "service_name": "NanoKVM", "icon": "monitorcog", "category": "kvm", "suggested_node_type": "kvm"},
+
{"port": null, "protocol": "tcp", "banner_regex": null, "http_regex": "openmediavault", "service_name": "OpenMediaVault", "icon": "hard-drive", "category": "nas", "suggested_node_type": "nas"},
{"port": null, "protocol": "tcp", "banner_regex": null, "http_regex": "Unraid", "service_name": "Unraid", "icon": "hard-drive", "category": "nas", "suggested_node_type": "nas"},
{"port": null, "protocol": "tcp", "banner_regex": null, "http_regex": "Cockpit", "service_name": "Cockpit", "icon": "monitor", "category": "nas", "suggested_node_type": "server"}
diff --git a/backend/app/services/fingerprint.py b/backend/app/services/fingerprint.py
index 4532644..0e092f3 100644
--- a/backend/app/services/fingerprint.py
+++ b/backend/app/services/fingerprint.py
@@ -213,12 +213,16 @@ def suggest_node_type(open_ports: list[dict[str, Any]], mac: str | None = None)
if mac_type == "iot":
return "iot"
- priority = ["proxmox", "nas", "router", "lxc", "vm", "ap", "camera", "iot", "server", "switch"]
+ priority = [
+ "proxmox", "nas", "kvm", "router", "lxc", "vm", "ap", "camera", "iot", "server", "switch",
+ ]
found: set[str] = set()
for p in open_ports:
port = p["port"]
proto = p.get("protocol", "tcp")
- sig = match_port(port, proto)
+ # Pass the HTTP-probe signals through: port-agnostic signatures (port: null,
+ # e.g. PiKVM, Unraid) match on title/headers alone and are invisible otherwise.
+ sig = match_service(port, proto, p.get("banner"), p.get("http_signals"))
if sig and sig.get("suggested_node_type"):
found.add(sig["suggested_node_type"])
if port in _PORT_TYPE_HINTS:
diff --git a/backend/tests/test_fingerprint.py b/backend/tests/test_fingerprint.py
index bdf487e..0634af6 100644
--- a/backend/tests/test_fingerprint.py
+++ b/backend/tests/test_fingerprint.py
@@ -124,6 +124,41 @@ def test_suggest_node_type_priority_proxmox_over_server():
assert result == "proxmox"
+# A port-agnostic signature: only an HTTP probe can ever match it.
+KVM_SIGNATURE = {
+ "port": None, "protocol": "tcp", "banner_regex": None, "http_regex": "PiKVM",
+ "service_name": "PiKVM", "icon": "monitorcog", "category": "kvm",
+ "suggested_node_type": "kvm",
+}
+
+
+def test_suggest_node_type_kvm_from_http_title():
+ # An IP-KVM answers on 443 like any web app; only the probed title identifies it.
+ with patch("app.services.fingerprint._load", return_value=[*MOCK_SIGNATURES, KVM_SIGNATURE]):
+ result = suggest_node_type([
+ {"port": 443, "protocol": "tcp", "http_signals": {"title": "PiKVM", "headers": {}}},
+ ])
+ assert result == "kvm"
+
+
+def test_suggest_node_type_priority_kvm_over_server():
+ # The same host also answers on 80 (→ server); the KVM signal outranks it.
+ with patch("app.services.fingerprint._load", return_value=[*MOCK_SIGNATURES, KVM_SIGNATURE]):
+ result = suggest_node_type([
+ {"port": 80, "protocol": "tcp"},
+ {"port": 443, "protocol": "tcp", "http_signals": {"title": "PiKVM", "headers": {}}},
+ ])
+ assert result == "kvm"
+
+
+def test_suggest_node_type_ignores_port_agnostic_sig_without_probe():
+ # No http_signals (probe disabled) → port-agnostic entries can't match and the
+ # port-only guess stands, unchanged from pre-probe behaviour.
+ with patch("app.services.fingerprint._load", return_value=[*MOCK_SIGNATURES, KVM_SIGNATURE]):
+ result = suggest_node_type([{"port": 443, "protocol": "tcp"}])
+ assert result == "server"
+
+
def test_suggest_node_type_camera_from_rtsp_port():
# RTSP port 554 → camera (via _PORT_TYPE_HINTS)
result = suggest_node_type([{"port": 554, "protocol": "tcp"}])
diff --git a/backend/tests/test_signatures_data.py b/backend/tests/test_signatures_data.py
index 4d34221..e3ea7b4 100644
--- a/backend/tests/test_signatures_data.py
+++ b/backend/tests/test_signatures_data.py
@@ -7,7 +7,7 @@ from app.services.fingerprint import _load, match_service
_NODE_TYPES = {
"isp", "router", "switch", "server", "proxmox", "vm", "lxc",
- "nas", "iot", "ap", "camera", "generic",
+ "nas", "kvm", "iot", "ap", "camera", "generic",
}
@@ -43,6 +43,13 @@ def test_popular_apps_have_port_agnostic_signatures(signatures):
assert expected in names, f"missing port-agnostic signature for {expected}"
[email protected]("title", ["PiKVM", "TinyPilot", "JetKVM", "NanoKVM"])
+def test_ip_kvm_titles_suggest_kvm_node_type(title):
+ sig = match_service(80, "tcp", banner=None, http_signals={"title": title, "headers": {}})
+ assert sig is not None
+ assert sig["suggested_node_type"] == "kvm"
+
+
@pytest.mark.parametrize(("title", "expected"), [
("Jellyfin", "Jellyfin"),
("Home Assistant", "Home Assistant"),
diff --git a/frontend/src/components/canvas/nodes/__tests__/nodeTypes.test.ts b/frontend/src/components/canvas/nodes/__tests__/nodeTypes.test.ts
index 1e0b237..25380dc 100644
--- a/frontend/src/components/canvas/nodes/__tests__/nodeTypes.test.ts
+++ b/frontend/src/components/canvas/nodes/__tests__/nodeTypes.test.ts
@@ -1,7 +1,23 @@
import { describe, it, expect } from 'vitest'
import { nodeTypes } from '../nodeTypes'
+import { NODE_TYPE_LABELS, type NodeType } from '@/types'
+import { NODE_TYPE_DEFAULT_ICONS } from '@/utils/nodeIcons'
describe('nodeTypes registry', () => {
+ it('registers a component for every declared node type', () => {
+ // Adding a NodeType touches several hand-written maps; the Record<NodeType, …>
+ // ones fail typecheck when one is missed, this registry does not.
+ for (const t of Object.keys(NODE_TYPE_LABELS) as NodeType[]) {
+ expect(nodeTypes[t as keyof typeof nodeTypes], `missing nodeType: ${t}`).toBeDefined()
+ }
+ })
+
+ it('gives the KVM type a label, an icon and a component', () => {
+ expect(NODE_TYPE_LABELS.kvm).toBe('KVM Switch')
+ expect(NODE_TYPE_DEFAULT_ICONS.kvm).toBeDefined()
+ expect(nodeTypes.kvm).toBeDefined()
+ })
+
it('registers a component for every wireless mesh node type', () => {
// Regression: zwave_* types were missing, so React Flow fell back to the
// default (unstyled) node — no icon, no accent. (Zigbee covered too.)
diff --git a/frontend/src/components/canvas/nodes/index.tsx b/frontend/src/components/canvas/nodes/index.tsx
index d7b758a..4b353da 100644
--- a/frontend/src/components/canvas/nodes/index.tsx
+++ b/frontend/src/components/canvas/nodes/index.tsx
@@ -1,7 +1,7 @@
import { type NodeProps, type Node } from '@xyflow/react'
import {
Globe, Router, Network, Server, Layers, Box, Container,
- HardDrive, Cpu, Wifi, Circle, Cctv, Printer, Monitor, Laptop, Smartphone, PlugZap, Anchor, Package, Flame, Radio, Antenna, RadioTower, Share2,
+ HardDrive, Cpu, Wifi, Circle, Cctv, Printer, Monitor, MonitorCog, Laptop, Smartphone, PlugZap, Anchor, Package, Flame, Radio, Antenna, RadioTower, Share2,
Grid3x3, Battery, Fuel, Sun, Repeat2, Split, ToggleLeft, Lightbulb, Gauge, Combine, Cable, Zap,
} from 'lucide-react'
import { BaseNode } from './BaseNode'
@@ -18,6 +18,7 @@ export const ProxmoxNode = (props: N) => <BaseNode {...props} icon={Layers} />
export const VmNode = (props: N) => <BaseNode {...props} icon={Box} />
export const LxcNode = (props: N) => <BaseNode {...props} icon={Container} />
export const NasNode = (props: N) => <BaseNode {...props} icon={HardDrive} />
+export const KvmNode = (props: N) => <BaseNode {...props} icon={MonitorCog} />
export const IotNode = (props: N) => <BaseNode {...props} icon={Cpu} />
export const ApNode = (props: N) => <BaseNode {...props} icon={Wifi} />
export const CameraNode = (props: N) => <BaseNode {...props} icon={Cctv} />
diff --git a/frontend/src/components/canvas/nodes/nodeTypes.ts b/frontend/src/components/canvas/nodes/nodeTypes.ts
index 98f8b8e..3044f33 100644
--- a/frontend/src/components/canvas/nodes/nodeTypes.ts
+++ b/frontend/src/components/canvas/nodes/nodeTypes.ts
@@ -1,6 +1,6 @@
import {
IspNode, RouterNode, FirewallNode, SwitchNode, ServerNode, VmNode, LxcNode,
- NasNode, IotNode, ApNode, CameraNode, PrinterNode, ComputerNode, LaptopNode,
+ NasNode, KvmNode, IotNode, ApNode, CameraNode, PrinterNode, ComputerNode, LaptopNode,
MobileNode, CplNode, DockerHostNode, DockerContainerNode, GenericNode,
ZigbeeCoordinatorNode, ZigbeeRouterNode, ZigbeeEndDeviceNode,
ZwaveCoordinatorNode, ZwaveRouterNode, ZwaveEndDeviceNode,
@@ -23,6 +23,7 @@ export const nodeTypes = {
vm: VmNode,
lxc: LxcNode,
nas: NasNode,
+ kvm: KvmNode,
iot: IotNode,
ap: ApNode,
camera: CameraNode,
diff --git a/frontend/src/components/modals/CustomStyleModal.tsx b/frontend/src/components/modals/CustomStyleModal.tsx
index ab1b0d6..4365eef 100644
--- a/frontend/src/components/modals/CustomStyleModal.tsx
+++ b/frontend/src/components/modals/CustomStyleModal.tsx
@@ -26,7 +26,7 @@ import { MarkerShapePicker } from './MarkerShapePicker'
// ── Node types exposed for custom style, grouped by category (skip groupRect/group) ──
const NODE_TYPE_GROUPS: { label: string; types: NodeType[] }[] = [
- { label: 'Hardware', types: ['isp', 'router', 'firewall', 'switch', 'server', 'nas', 'ap', 'printer'] },
+ { label: 'Hardware', types: ['isp', 'router', 'firewall', 'switch', 'server', 'nas', 'kvm', 'ap', 'printer'] },
{ label: 'Virtualization', types: ['proxmox', 'vm', 'lxc', 'docker_host', 'docker_container'] },
{ label: 'IoT', types: ['iot', 'camera', 'cpl'] },
{ label: 'Zigbee', types: ['zigbee_coordinator', 'zigbee_router', 'zigbee_enddevice'] },
diff --git a/frontend/src/components/modals/NodeModal.tsx b/frontend/src/components/modals/NodeModal.tsx
index 1b11e1e..b165001 100644
--- a/frontend/src/components/modals/NodeModal.tsx
+++ b/frontend/src/components/modals/NodeModal.tsx
@@ -16,7 +16,7 @@ import { MAX_HANDLES, clampHandles, sideDefault, handleCountField, type Side } f
import { getValidParentTypes } from '@/utils/virtualEdgeParent'
const NODE_TYPE_GROUPS: { label: string; types: NodeType[] }[] = [
- { label: 'Hardware', types: ['isp', 'router', 'firewall', 'switch', 'server', 'nas', 'ap', 'printer'] },
+ { label: 'Hardware', types: ['isp', 'router', 'firewall', 'switch', 'server', 'nas', 'kvm', 'ap', 'printer'] },
{ label: 'Virtualization', types: ['proxmox', 'vm', 'lxc', 'docker_host', 'docker_container'] },
{ label: 'IoT', types: ['iot', 'camera', 'cpl'] },
{ label: 'Zigbee', types: ['zigbee_coordinator', 'zigbee_router', 'zigbee_enddevice'] },
diff --git a/frontend/src/components/modals/__tests__/NodeModal.test.tsx b/frontend/src/components/modals/__tests__/NodeModal.test.tsx
index 5051560..554c4a9 100644
--- a/frontend/src/components/modals/__tests__/NodeModal.test.tsx
+++ b/frontend/src/components/modals/__tests__/NodeModal.test.tsx
@@ -288,7 +288,7 @@ describe('NodeModal', () => {
// ── Container mode ─────────────────────────────────────────────────────
const containerModeTypes = ['proxmox', 'vm', 'lxc', 'docker_host'] as const
- const nonContainerModeTypes = ['isp', 'router', 'switch', 'server', 'nas', 'ap', 'printer', 'iot', 'camera', 'cpl', 'computer', 'generic', 'docker_container', 'groupRect', 'group'] as const
+ const nonContainerModeTypes = ['isp', 'router', 'switch', 'server', 'nas', 'kvm', 'ap', 'printer', 'iot', 'camera', 'cpl', 'computer', 'generic', 'docker_container', 'groupRect', 'group'] as const
it.each(containerModeTypes)('shows Container Mode toggle for %s type', (type) => {
renderModal({ initial: { ...BASE, type } })
diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.ts
index c234a26..93027ee 100644
--- a/frontend/src/types/index.ts
+++ b/frontend/src/types/index.ts
@@ -33,6 +33,7 @@ export type NodeType =
| 'vm'
| 'lxc'
| 'nas'
+ | 'kvm'
| 'iot'
| 'ap'
| 'camera'
@@ -213,6 +214,7 @@ export const NODE_TYPE_LABELS: Record<NodeType, string> = {
vm: 'Virtual Machine',
lxc: 'LXC Container',
nas: 'NAS',
+ kvm: 'KVM Switch',
iot: 'IoT Device',
ap: 'Access Point',
camera: 'Camera',
diff --git a/frontend/src/utils/__tests__/themes.test.ts b/frontend/src/utils/__tests__/themes.test.ts
index 9563a4d..4436e1b 100644
--- a/frontend/src/utils/__tests__/themes.test.ts
+++ b/frontend/src/utils/__tests__/themes.test.ts
@@ -4,7 +4,7 @@ import type { NodeType, EdgeType, NodeStatus } from '@/types'
const NODE_TYPES: NodeType[] = [
'isp', 'router', 'firewall', 'switch', 'server', 'proxmox', 'vm', 'lxc',
- 'nas', 'iot', 'ap', 'camera', 'printer', 'computer', 'laptop', 'mobile', 'cpl', 'docker_host', 'docker_container', 'generic', 'groupRect',
+ 'nas', 'kvm', 'iot', 'ap', 'camera', 'printer', 'computer', 'laptop', 'mobile', 'cpl', 'docker_host', 'docker_container', 'generic', 'groupRect',
]
const EDGE_TYPES: EdgeType[] = ['ethernet', 'wifi', 'iot', 'vlan', 'virtual', 'cluster', 'fibre']
const STATUS_TYPES: NodeStatus[] = ['online', 'offline', 'pending', 'unknown']
diff --git a/frontend/src/utils/nodeIcons.ts b/frontend/src/utils/nodeIcons.ts
index 182d6a5..7a383e8 100644
--- a/frontend/src/utils/nodeIcons.ts
+++ b/frontend/src/utils/nodeIcons.ts
@@ -5,7 +5,7 @@ import {
// Media
Play, Film, Tv, Tv2, Music, Camera, Video, Headphones, Clapperboard, Cctv,
// Monitoring & Observability
- Activity, BarChart2, LineChart, Eye, Bell, Gauge, Monitor,
+ Activity, BarChart2, LineChart, Eye, Bell, Gauge, Monitor, MonitorCog,
// Storage & Databases
Database, Archive, Cloud, FolderOpen,
// Security & Auth
@@ -48,6 +48,7 @@ export const ICON_REGISTRY: IconEntry[] = [
{ key: 'box', label: 'VM', category: 'Infrastructure', icon: Box },
{ key: 'container', label: 'Container / LXC', category: 'Infrastructure', icon: Container },
{ key: 'harddrive', label: 'NAS / Storage', category: 'Infrastructure', icon: HardDrive },
+ { key: 'monitorcog', label: 'KVM Switch', category: 'Infrastructure', icon: MonitorCog },
{ key: 'cpu', label: 'IoT / Embedded', category: 'Infrastructure', icon: Cpu },
{ key: 'wifi', label: 'Access Point', category: 'Infrastructure', icon: Wifi },
{ key: 'circle', label: 'Generic', category: 'Infrastructure', icon: Circle },
@@ -165,6 +166,7 @@ export const NODE_TYPE_DEFAULT_ICONS: Record<NodeType, LucideIcon> = {
vm: Box,
lxc: Container,
nas: HardDrive,
+ kvm: MonitorCog,
iot: Cpu,
ap: Wifi,
camera: Cctv,
diff --git a/frontend/src/utils/themes.ts b/frontend/src/utils/themes.ts
index 892ca46..5a15bb2 100644
--- a/frontend/src/utils/themes.ts
+++ b/frontend/src/utils/themes.ts
@@ -51,6 +51,7 @@ export const THEMES: Record<ThemeId, ThemePreset> = {
vm: { border: '#a855f7', icon: '#a855f7' },
lxc: { border: '#00d4ff', icon: '#00d4ff' },
nas: { border: '#39d353', icon: '#39d353' },
+ kvm: { border: '#a855f7', icon: '#a855f7' },
iot: { border: '#e3b341', icon: '#e3b341' },
ap: { border: '#00d4ff', icon: '#00d4ff' },
camera: { border: '#8b949e', icon: '#8b949e' },
@@ -133,6 +134,7 @@ export const THEMES: Record<ThemeId, ThemePreset> = {
vm: { border: '#c084fc', icon: '#c084fc' },
lxc: { border: '#22d3ee', icon: '#22d3ee' },
nas: { border: '#4ade80', icon: '#4ade80' },
+ kvm: { border: '#c084fc', icon: '#c084fc' },
iot: { border: '#fbbf24', icon: '#fbbf24' },
ap: { border: '#22d3ee', icon: '#22d3ee' },
camera: { border: '#94a3b8', icon: '#94a3b8' },
@@ -215,6 +217,7 @@ export const THEMES: Record<ThemeId, ThemePreset> = {
vm: { border: '#7c3aed', icon: '#7c3aed' },
lxc: { border: '#0284c7', icon: '#0284c7' },
nas: { border: '#16a34a', icon: '#16a34a' },
+ kvm: { border: '#7c3aed', icon: '#7c3aed' },
iot: { border: '#b45309', icon: '#b45309' },
ap: { border: '#0284c7', icon: '#0284c7' },
camera: { border: '#6b7280', icon: '#6b7280' },
@@ -297,6 +300,7 @@ export const THEMES: Record<ThemeId, ThemePreset> = {
vm: { border: '#ff00ff', icon: '#ff00ff' },
lxc: { border: '#00ffff', icon: '#00ffff' },
nas: { border: '#00ff80', icon: '#00ff80' },
+ kvm: { border: '#ff00ff', icon: '#ff00ff' },
iot: { border: '#ffff00', icon: '#ffff00' },
ap: { border: '#00ffff', icon: '#00ffff' },
camera: { border: '#8888ff', icon: '#8888ff' },
@@ -379,6 +383,7 @@ export const THEMES: Record<ThemeId, ThemePreset> = {
vm: { border: '#008822', icon: '#008822' },
lxc: { border: '#00ff41', icon: '#00ff41' },
nas: { border: '#00cc33', icon: '#00cc33' },
+ kvm: { border: '#008822', icon: '#008822' },
iot: { border: '#66ff33', icon: '#66ff33' },
ap: { border: '#00ff41', icon: '#00ff41' },
camera: { border: '#005500', icon: '#005500' },
@@ -461,6 +466,7 @@ export const THEMES: Record<ThemeId, ThemePreset> = {
vm: { border: '#a855f7', icon: '#a855f7' },
lxc: { border: '#00d4ff', icon: '#00d4ff' },
nas: { border: '#39d353', icon: '#39d353' },
+ kvm: { border: '#a855f7', icon: '#a855f7' },
iot: { border: '#e3b341', icon: '#e3b341' },
ap: { border: '#00d4ff', icon: '#00d4ff' },
camera: { border: '#8b949e', icon: '#8b949e' },
diff --git a/mcp/app/tools.py b/mcp/app/tools.py
index ba1649f..1128629 100644
--- a/mcp/app/tools.py
+++ b/mcp/app/tools.py
@@ -9,7 +9,7 @@ from .backend_client import backend
# group/groupRect/text are canvas annotations created via dedicated UI actions, not create_node).
# Sync is enforced automatically by test_node_types_in_sync_with_frontend (mcp/tests/test_node_types_sync.py).
NODE_TYPES = [
- "isp", "router", "firewall", "switch", "server", "proxmox", "vm", "lxc", "nas", "iot", "ap",
+ "isp", "router", "firewall", "switch", "server", "proxmox", "vm", "lxc", "nas", "kvm", "iot", "ap",
"camera", "printer", "computer", "laptop", "mobile", "cpl", "docker_host", "docker_container",
"generic", "zigbee_coordinator", "zigbee_router", "zigbee_enddevice",
"zwave_coordinator", "zwave_router", "zwave_enddevice", "grid", "ups", "battery", "generator",