Add LAN device discovery (ping sweep + ARP, known/unknown labeling)
CI / web (push) Successful in 17s
CI / api (push) Successful in 23s

Runs as a host-level systemd timer on CT122 (scripts/discover-devices.sh)
rather than inside the api container, since real ARP entries live in the
host's network namespace, not Docker's bridge network. See
docs/device-discovery.md for the full writeup, including why literal
passive-only ARP reading was dropped (near-empty result in practice).

API reads the resulting JSON file each poll cycle, cross-references
config/hosts.yaml's knownDevices list by IP, and serves /api/devices.
Dashboard gets a new "Network Devices" table.

Closes #9.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-12 20:49:22 -06:00
parent d75bd58792
commit 04282232cc
15 changed files with 434 additions and 8 deletions
@@ -0,0 +1,10 @@
[Unit]
Description=homelab-monitor LAN device discovery (ping sweep + ARP read)
After=network-online.target
[Service]
Type=oneshot
ExecStart=/opt/homelab-monitor/scripts/discover-devices.sh
Environment=SUBNET_PREFIX=192.168.1
Environment=OUTPUT_FILE=/opt/homelab-monitor/data/devices-raw.json
Environment=IFACE=eth0
@@ -0,0 +1,9 @@
[Unit]
Description=Run homelab-monitor LAN device discovery every 5 minutes
[Timer]
OnBootSec=1min
OnUnitActiveSec=5min
[Install]
WantedBy=timers.target