Modem: read uptime again, firewall drop counts, AT&T speed tests #52

Merged
jared merged 1 commits from modem-extras into main 2026-11-19 18:52:13 -05:00
Owner

Follow-up to #51, using more of what the gateway shows.

Changes

  • Uptime (bug fix, no login needed): firmware 6.40 shows "Time Since Last Reboot" as D:HH:MM:SS (e.g. 03:06:29:34). The parser expected plain seconds, as older firmware sent, so uptime was blank on the panel ("Uptime -") and restart detection, which relies on uptime going backwards, never fired. parse_uptime now reads both formats.

    This would have caught the modem's own reboot on Nov 16 at about 17:17 UTC. That was the 90 second outage UniFi recorded that day.

  • Firewall drops (logged in, every 5 minutes): the gateway's Logs page, counted per hour (gateway local time) for a day. The counts are split into:

    • flood: new incoming connections over the firmware's fixed 50 per second limit, which has no setting to change it;
    • invalid packets.

    The log keeps about ten minutes and records at most one drop every 2 s, so the counts are a lower bound. Only rows newer than the last read are counted, and gap notes when rows aged out before they could be read. This is shown on the panel only and is not added to Needs attention, because it runs near the log's cap all the time.

  • AT&T's own speed tests (logged in, read with the NAT check every 30 minutes): the latest down and up results run by the modem (1167 / 1243 Mbps on Nov 6), as a reference for what the line itself delivers.

  • README updated.

Tested on the real gateway

  • Uptime: 282,698 s (3 d 6 h), read without logging in.
  • Firewall log: 214 rows covering 11 minutes, of which 192 were flood and 22 invalid.
  • Speed tests: parsed.

Screenshots (preview data)

panel

Checks

  • 575 tests pass (new: uptime formats, the firewall log and speed parsers, hourly counting with overlap, rollover and a 24 hour cap, and the scheduling).
  • flake8 and bandit are clean; eslint is at the 21-warning baseline.

🤖 Generated with Claude Code

Follow-up to #51, using more of what the gateway shows. ## Changes - **Uptime (bug fix, no login needed)**: firmware 6.40 shows "Time Since Last Reboot" as `D:HH:MM:SS` (e.g. `03:06:29:34`). The parser expected plain seconds, as older firmware sent, so uptime was blank on the panel ("Uptime -") and restart detection, which relies on uptime going backwards, never fired. `parse_uptime` now reads both formats. This would have caught the modem's own reboot on Nov 16 at about 17:17 UTC. That was the 90 second outage UniFi recorded that day. - **Firewall drops** (logged in, every 5 minutes): the gateway's Logs page, counted per hour (gateway local time) for a day. The counts are split into: - *flood*: new incoming connections over the firmware's fixed 50 per second limit, which has no setting to change it; - *invalid* packets. The log keeps about ten minutes and records at most one drop every 2 s, so the counts are a lower bound. Only rows newer than the last read are counted, and `gap` notes when rows aged out before they could be read. This is shown on the panel only and is not added to Needs attention, because it runs near the log's cap all the time. - **AT&T's own speed tests** (logged in, read with the NAT check every 30 minutes): the latest down and up results run by the modem (1167 / 1243 Mbps on Nov 6), as a reference for what the line itself delivers. - README updated. ## Tested on the real gateway - Uptime: 282,698 s (3 d 6 h), read without logging in. - Firewall log: 214 rows covering 11 minutes, of which 192 were flood and 22 invalid. - Speed tests: parsed. ## Screenshots (preview data) ![panel](https://code.lotusguild.org/LotusGuild/gandalf/raw/branch/modem-extras-screenshots/wan-panel.png) <img src="https://code.lotusguild.org/LotusGuild/gandalf/raw/branch/modem-extras-screenshots/wan-panel-phone.png" width="390"> ## Checks - 575 tests pass (new: uptime formats, the firewall log and speed parsers, hourly counting with overlap, rollover and a 24 hour cap, and the scheduling). - flake8 and bandit are clean; eslint is at the 21-warning baseline. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jared added 1 commit 2026-11-19 18:50:51 -05:00
Modem: read uptime again, firewall drop counts, AT&T speed tests
Lint / JS (eslint) (push) Successful in 24s
Lint / Python (flake8) (push) Successful in 1m2s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Security / Python Security (bandit) (push) Successful in 1m26s
Test / Python Tests (pytest) (push) Successful in 1m57s
Lint / Python (flake8) (pull_request) Successful in 1m25s
Lint / JS (eslint) (pull_request) Successful in 24s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / Python Security (bandit) (pull_request) Successful in 1m9s
Test / Python Tests (pytest) (pull_request) Successful in 1m14s
0370358363
- Uptime: firmware 6.40 shows "Time Since Last Reboot" as D:HH:MM:SS,
  which the parser (expecting seconds) read as nothing, so uptime was
  blank and restart detection never fired. Both formats are read now.
- Firewall drops (logged in, every 5 minutes): the Logs page counted
  per hour for a day, split into incoming connections over the
  firmware's fixed flood limit (50 per second) and invalid packets. A
  lower bound, since the log keeps one entry per 2 s. Panel only.
- The modem's own speed test history (logged in, every 30 minutes):
  latest down and up results on the panel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jared scheduled this pull request to auto merge when all checks succeed 2026-11-19 18:52:07 -05:00
jared merged commit f097e4882c into main 2026-11-19 18:52:13 -05:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/gandalf#52