The internet was slow and lossy on and off for about a day, and Gandalf showed nothing: it only notices the WAN being fully down. UniFi already rates the WAN every 5 minutes (fine, high latency, packet loss, down), the same timeline its Network app charts. So Gandalf reads that instead of pinging on its own.
What
Monitor: each cycle reads the last day from UniFi's dashboard API (v2/.../aggregated-dashboard, read only) and stores monitor_state.wan_quality: 5 minute periods, drops, and current latency to Cloudflare, Google and Microsoft. If UniFi can't be read, the last copy stays and is ignored once it's 30 minutes old.
Needs attention (Broken now), judged on the newest 12 periods:
Internet: packet loss in N of the last 12 five-minute periods: red when 2 or more had loss or downtime.
Internet: high latency in N of the last 12 ...: amber when 3 or more had any problem.
Internet dropped for 90 s, 20 min ago (or "dropped N times in the last hour").
The detail gives the 24 hour count and the latency now. These are dashboard lines only, not tickets, and they clear once the hour is clean.
WAN / Fiber panel: a 24 hour strip (amber latency, red loss, white or black down) with hover times, a legend and latency now. It also shows while the modem's own page can't be read.
Run against today's real UniFi data, it gives 104 high-latency, 11 packet-loss and 1 down periods out of 296. The list currently shows "packet loss in 6 of the last 12" and "dropped for 90 s, 20 min ago".
Screenshots
The preview uses today's real timeline (states only) and documentation addresses.
Needs attention:
WAN / Fiber panel, dark:
Light:
Phone:
Checks
524 tests pass (new: TestWanQuality, TestWan, TestWanQualityCollection, and an app test that the stored timeline reaches /api/attention and /api/modem).
flake8 and bandit are clean; eslint is at the 21-warning baseline.
## Why
The internet was slow and lossy on and off for about a day, and Gandalf showed nothing: it only notices the WAN being fully down. UniFi already rates the WAN every 5 minutes (fine, high latency, packet loss, down), the same timeline its Network app charts. So Gandalf reads that instead of pinging on its own.
## What
- **Monitor**: each cycle reads the last day from UniFi's dashboard API (`v2/.../aggregated-dashboard`, read only) and stores `monitor_state.wan_quality`: 5 minute periods, drops, and current latency to Cloudflare, Google and Microsoft. If UniFi can't be read, the last copy stays and is ignored once it's 30 minutes old.
- **Needs attention** (Broken now), judged on the newest 12 periods:
- *Internet: packet loss in N of the last 12 five-minute periods*: red when 2 or more had loss or downtime.
- *Internet: high latency in N of the last 12 ...*: amber when 3 or more had any problem.
- *Internet dropped for 90 s, 20 min ago* (or "dropped N times in the last hour").
- The detail gives the 24 hour count and the latency now. These are dashboard lines only, not tickets, and they clear once the hour is clean.
- **WAN / Fiber panel**: a 24 hour strip (amber latency, red loss, white or black down) with hover times, a legend and latency now. It also shows while the modem's own page can't be read.
Run against today's real UniFi data, it gives 104 high-latency, 11 packet-loss and 1 down periods out of 296. The list currently shows "packet loss in 6 of the last 12" and "dropped for 90 s, 20 min ago".
## Screenshots
The preview uses today's real timeline (states only) and documentation addresses.
Needs attention:

WAN / Fiber panel, dark:

Light:

Phone:
<img src="https://code.lotusguild.org/LotusGuild/gandalf/raw/branch/pr-46-screenshots/wan-modem-phone.png" width="390">
## Checks
- 524 tests pass (new: `TestWanQuality`, `TestWan`, `TestWanQualityCollection`, and an app test that the stored timeline reaches `/api/attention` and `/api/modem`).
- flake8 and bandit are clean; eslint is at the 21-warning baseline.
- No horizontal scroll at 390 px.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
UniFi already rates the WAN every 5 minutes (fine, high latency, packet
loss, down), the same timeline its Network app charts. The monitor now
reads the last day of it from the dashboard API each cycle, read only,
instead of Gandalf pinging on its own.
- modem.wan_quality() turns the dashboard data into periods, drops and
current service latencies; stored as monitor_state.wan_quality.
- Needs attention: "Internet: packet loss in N of the last 12 five-minute
periods" (2+ lossy periods, red), "high latency" (3+ bad periods,
amber), and drops in the last hour. Stale copies are ignored.
- WAN / Fiber panel: a 24 hour strip with a legend and latency now,
also shown while the modem itself can't be read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jared
scheduled this pull request to auto merge when all checks succeed 2026-11-16 13:12:30 -05:00
jared
merged commit 73787daaec into main2026-11-16 13:12:32 -05:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Why
The internet was slow and lossy on and off for about a day, and Gandalf showed nothing: it only notices the WAN being fully down. UniFi already rates the WAN every 5 minutes (fine, high latency, packet loss, down), the same timeline its Network app charts. So Gandalf reads that instead of pinging on its own.
What
v2/.../aggregated-dashboard, read only) and storesmonitor_state.wan_quality: 5 minute periods, drops, and current latency to Cloudflare, Google and Microsoft. If UniFi can't be read, the last copy stays and is ignored once it's 30 minutes old.Run against today's real UniFi data, it gives 104 high-latency, 11 packet-loss and 1 down periods out of 296. The list currently shows "packet loss in 6 of the last 12" and "dropped for 90 s, 20 min ago".
Screenshots
The preview uses today's real timeline (states only) and documentation addresses.
Needs attention:

WAN / Fiber panel, dark:

Light:

Phone:

Checks
TestWanQuality,TestWan,TestWanQualityCollection, and an app test that the stored timeline reaches/api/attentionand/api/modem).🤖 Generated with Claude Code