Restart modem button: silence Gandalf and Uptime Kuma, restart, end both #53

Merged
jared merged 2 commits from modem-restart into main 2026-11-19 20:39:04 -05:00
2 Commits
Author SHA1 Message Date
jaredandClaude Opus 5.5 3afd85626b Modem restart: load restarting.ha, which is what starts it
Lint / JS (eslint) (push) Successful in 8s
Lint / Python (flake8) (push) Successful in 1m2s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Security / Python Security (bandit) (push) Successful in 1m3s
Lint / Python (flake8) (pull_request) Successful in 2m7s
Test / Python Tests (pytest) (push) Successful in 2m20s
Lint / JS (eslint) (pull_request) Successful in 15s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / Python Security (bandit) (pull_request) Successful in 57s
Test / Python Tests (pytest) (pull_request) Successful in 1m28s
Tried on the real BGW320 (firmware 6.40.4): posting the Restart form only
answers 302 to /cgi-bin/restarting.ha, and the modem keeps running (its
uptime carried on). Loading that page, as a browser does, starts the
restart ("restarting ... approximately 155 seconds"). restart() now
follows the redirect and only reports 'accepted' when that page says it
is restarting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 20:34:50 -05:00
jaredandClaude Opus 5.5 c2ff072eb2 Restart modem button: silence Gandalf and Uptime Kuma, restart, end both
Lint / Python (flake8) (push) Failing after 15s
Lint / JS (eslint) (push) Successful in 1m43s
Lint / Deploy (push) Skipped
Test / Python Tests (pytest) (push) Failing after 21s
Security / Python Security (bandit) (push) Successful in 2m3s
Lint / Python (flake8) (pull_request) Failing after 15s
Lint / JS (eslint) (pull_request) Failing after 15s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / Python Security (bandit) (pull_request) Successful in 2m17s
Lint / Notify on failure (push) Successful in 3s
Test / Python Tests (pytest) (pull_request) Successful in 2m58s
Admins get a Restart modem button on the WAN / Fiber panel (needs
modem.access_code). After a confirmation it:

1. switches an Uptime Kuma maintenance window on (new kuma.py: logs in
   over Kuma 2's Socket.IO API and resumes/pauses one pre-made manual
   window, uptime_kuma.maintenance_id); if Kuma fails it stops and asks
   whether to go on without it,
2. starts Gandalf maintenance (global suppression, 20 minutes at most),
3. posts the gateway's Restart Device form (ModemAdmin.restart), undoing
   1 and 2 if that fails.

The monitor waits for the modem to answer with its WAN up and an uptime
showing it restarted, then switches Kuma off, ends the suppression and
records how long it took; after 30 minutes it ends both regardless. The
panel shows the restart in progress and the result for an hour.

New dependency: python-socketio[client].

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 19:27:25 -05:00