Alert on genuinely new (never-seen-before) devices #17

Closed
opened 2026-07-12 23:53:54 -06:00 by jhodgkin · 1 comment
Owner

Detection: track first-ever-seen per MAC in a dedicated table (decoupled from the IP-keyed devices table, since DHCP IP churn would otherwise cause false new-device alerts for devices whose IP just changed). Bootstrap-safe: first run seeds the baseline without alerting on the whole existing device list.

Delivery: push a Home Assistant persistent_notification (user already runs HA at CT118) when a new MAC appears. Needs a long-lived access token from the user.

Also surface in the dashboard UI: a 'New' badge for devices first seen recently, independent of notification delivery.

Detection: track first-ever-seen per MAC in a dedicated table (decoupled from the IP-keyed devices table, since DHCP IP churn would otherwise cause false new-device alerts for devices whose IP just changed). Bootstrap-safe: first run seeds the baseline without alerting on the whole existing device list. Delivery: push a Home Assistant persistent_notification (user already runs HA at CT118) when a new MAC appears. Needs a long-lived access token from the user. Also surface in the dashboard UI: a 'New' badge for devices first seen recently, independent of notification delivery.
Author
Owner

Done and deployed. seen_macs table (permanent, MAC-keyed, insert-only) tracks first-ever-seen per device, bootstrap-safe so turning this on didn't alert on the entire existing 71-device population.

Found and fixed a real bug via actual deployment verification, not just the unit test: the notification path was correctly bootstrap-safe, but the separate dashboard "new" badge wasn't bootstrap-aware at all -- 65/71 devices showed as new on first deploy. Added is_bootstrap tracking + a migration that backfills it correctly for the already-deployed instance. Verified fixed (0 false positives), then did a full synthetic end-to-end test (injected a fake device into the discovery pipeline, confirmed it alone got flagged, cleaned up afterward).

Still pending: HOME_ASSISTANT_TOKEN from the user to enable the actual push notification (detection + dashboard badge work regardless; only the HA push is gated on that).

Done and deployed. seen_macs table (permanent, MAC-keyed, insert-only) tracks first-ever-seen per device, bootstrap-safe so turning this on didn't alert on the entire existing 71-device population. Found and fixed a real bug via actual deployment verification, not just the unit test: the notification path was correctly bootstrap-safe, but the separate dashboard "new" badge wasn't bootstrap-aware at all -- 65/71 devices showed as new on first deploy. Added is_bootstrap tracking + a migration that backfills it correctly for the already-deployed instance. Verified fixed (0 false positives), then did a full synthetic end-to-end test (injected a fake device into the discovery pipeline, confirmed it alone got flagged, cleaned up afterward). Still pending: HOME_ASSISTANT_TOKEN from the user to enable the actual push notification (detection + dashboard badge work regardless; only the HA push is gated on that).
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jhodgkin/homelab-monitor#17