Restart modem: pause Smart Power auto power-cycle until the modem is back
Lint / JS (eslint) (push) Successful in 14s
Lint / Python (flake8) (push) Successful in 1m5s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Security / Python Security (bandit) (push) Successful in 1m13s
Lint / Python (flake8) (pull_request) Successful in 1m14s
Test / Python Tests (pytest) (push) Successful in 1m51s
Security / Python Security (bandit) (pull_request) Successful in 1m25s
Lint / JS (eslint) (pull_request) Successful in 19s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Test / Python Tests (pytest) (pull_request) Successful in 1m32s

UniFi Smart Power on the RPDU's modem outlet saw the internet down while
the modem rebooted and cut its power mid-boot: once during the 11-20
restart and twice after the 11-24 AT&T-app reboot. UniFi only exposes
auto power-cycle as on or off, so the button now turns it off for every
outlet that has it on, and the monitor turns it back on when the restart
ends (back, or after 30 minutes).

- UnifiClient.auto_power_cycle_outlets / set_auto_power_cycle: sends the
  device's outlet_overrides back with only cycle_enabled changed, then
  reads them again to confirm. The only UniFi setting Gandalf changes.
- A failed pause doesn't stop the restart; a failed restart turns it back
  on. A failed restore is retried every cycle and shown as broken in
  Needs attention until it works.
- The panel note and confirm text mention the pause.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jaredandClaude Opus 5.5 committed 2026-11-24 00:13:46 -05:00
1 parent a7792063ba
commit a5d4fc3156
9 files changed
+304 -19

No files matched your search

+10 -3
View File
@@ -474,9 +474,16 @@ function _modemQuality(q) {
function _modemRestartNote(r) {
if (!r || !r.at) return '';
const who = r.by ? ` by ${r.by}` : '';
const paused = (r.smart_power_paused || []).length;
if (!r.finished_at) {
const sp = paused ? ' Smart Power auto power-cycle is paused so it can\'t cut power mid-boot.' : '';
return `<div class="modem-restart-note">Restart requested${lt.escHtml(who)} ${lt.escHtml(_modemWhen(r.at))}. ` +
`Alerts are silenced${r.kuma ? ' here and in Uptime Kuma' : ''} until the modem is back.</div>`;
`Alerts are silenced${r.kuma ? ' here and in Uptime Kuma' : ''} until the modem is back.${sp}</div>`;
}
if (paused && !r.smart_power_restored) {
return `<div class="modem-restart-note modem-restart-warn">Restarted${lt.escHtml(who)} ` +
`${lt.escHtml(_modemWhen(r.at))}, but Smart Power auto power-cycle is still off. ` +
`Gandalf keeps trying to turn it back on.</div>`;
}
if (Date.now() / 1000 - r.finished_at > 3600) return '';
const how = r.back ? `back after ${_modemDuration(r.back_after_s)}` : 'did not come back within 30 minutes';
@@ -486,8 +493,8 @@ function _modemRestartNote(r) {
async function restartModem(btn) {
const msg = 'Restart the AT&T modem?\n\nThe internet will be down for about 3 to 5 minutes. ' +
'Gandalf alerts and the Uptime Kuma maintenance window are switched on first, and switched off ' +
'again when the modem is back.';
'Gandalf alerts, the Uptime Kuma maintenance window and a Smart Power auto power-cycle pause ' +
'are switched on first, and switched off again when the modem is back.';
if (!window.confirm(msg)) return;
btn.disabled = true;
try {