wrolpi/controller/test
lrnselfreliance 1bd102c768
Warn in the navbar when a hard drive runs hot (#470)
* Warn in the navbar when a hard drive runs hot.

The navbar already warns about high CPU temperature; add the equivalent
for drive temperature, since an overheating disk risks data loss and a
user running an off-grid library won't be watching for it.

- controller/lib/smart.py: build_smart_stats() returns the per-drive list
  plus warning thresholds (55C warn / 65C critical) so the frontend stays
  dumb. Reading SMART wakes a spun-down drive, so drives in standby are
  detected with `smartctl -n standby` (which works through the USB-SATA
  bridges where `hdparm -C` only reports "unknown") and NOT read; their
  last-known reading is reused instead.
- controller/lib/status_worker.py: collect SMART on a slow 60s cadence
  (cached on app.state) rather than the 5s status loop, so the poll does
  not keep USB drives awake. The result flows into the same cached payload
  via a new collect_all_status(smart_stats=...) kwarg.
- Frontend: useDriveTemperature() reports the hottest drive; Nav.js shows
  a yellow/red `hdd` icon with a popup, mirroring the CPU warning.

Verified on hardware: smart_stats reports real temps and SMART runs once
a minute, not every 5s.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Address Greptile review on HDD temperature warning.

- _drive_is_asleep also treats SLEEP mode as asleep, not just STANDBY.
  smartctl -n standby exits "Device is in SLEEP mode, exit(2)" for the
  deeper power mode; matching only "STANDBY" meant a SLEEP drive was read
  and woken — the exact failure the check prevents.  (TDD: added a failing
  SLEEP test, then fixed.)
- useDriveTemperature uses ?? instead of || for the temperature fallback
  to express "fall back only on null/undefined".

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-11 19:46:33 -06:00
..
__init__.py Creating Controller service which will control WROLPi services, admin, SMART, disks, and status. nginx will fallback to Controller UI when React UI is unavailable (such as during upgrades). 2025-12-15 15:48:40 -07:00
test_admin.py Consolidating controller tests. Fixing controller test cleanup which slowed down tests significantly. 2026-05-15 21:10:30 -06:00
test_admin_api.py Consolidating controller tests. Fixing controller test cleanup which slowed down tests significantly. 2026-05-15 21:10:30 -06:00
test_api.py Consolidating controller tests. Fixing controller test cleanup which slowed down tests significantly. 2026-05-15 21:10:30 -06:00
test_config.py Migrating Controller from port 8087 to 80 so that it is more discoverable. Reformatting Controller dashboard to make header at the top. Reformatting navigation bar to handle the new links which prevented Admin from being visible in some screens. 2026-04-09 15:01:05 -06:00
test_defaults.py Migrating Controller from port 8087 to 80 so that it is more discoverable. Reformatting Controller dashboard to make header at the top. Reformatting navigation bar to handle the new links which prevented Admin from being visible in some screens. 2026-04-09 15:01:05 -06:00
test_disks.py Consolidating controller tests. Fixing controller test cleanup which slowed down tests significantly. 2026-05-15 21:10:30 -06:00
test_disks_api.py Controller can unmount foreign mounts; protect the primary drive. 2026-06-11 19:46:30 -06:00
test_docker_services.py Replace nginx with Caddy for TLS termination and reverse proxying. 2026-03-07 18:48:44 -07:00
test_fstab.py Setting uid/gid when mounting exfat and vfat filesystems. 2026-02-08 09:50:18 -07:00
test_fstab_migration.py Moving WROLPi-managed mounts off /etc/fstab onto a drive-resident fstab.yaml. 2026-05-24 12:44:05 -06:00
test_fstab_yaml.py Moving WROLPi-managed mounts off /etc/fstab onto a drive-resident fstab.yaml. 2026-05-24 12:44:05 -06:00
test_mount_executor.py Moving WROLPi-managed mounts off /etc/fstab onto a drive-resident fstab.yaml. 2026-05-24 12:44:05 -06:00
test_onboarding.py Warning users when files exist in mount location. Users may have accidentally downloaded files into the media directory, we want to warn them. 2026-05-14 17:02:52 -06:00
test_onboarding_api.py Consolidating controller tests. Fixing controller test cleanup which slowed down tests significantly. 2026-05-15 21:10:30 -06:00
test_readiness.py Checking readiness of main app in Controller instead of javascript requests, which break with CORS. 2026-03-08 16:05:56 -06:00
test_ready_api.py Checking readiness of main app in Controller instead of javascript requests, which break with CORS. 2026-03-08 16:05:56 -06:00
test_reconciler.py Moving WROLPi-managed mounts off /etc/fstab onto a drive-resident fstab.yaml. 2026-05-24 12:44:05 -06:00
test_samba.py Adding docker support for samba shares. 2026-03-29 11:14:38 -06:00
test_samba_api.py Adding docker support for samba shares. 2026-03-29 11:14:38 -06:00
test_schemas.py Creating Controller service which will control WROLPi services, admin, SMART, disks, and status. nginx will fallback to Controller UI when React UI is unavailable (such as during upgrades). 2025-12-15 15:48:40 -07:00
test_scripts.py Enhancing Controller to run scripts, starting with the repair and upgrade scripts for onboarding use. 2026-02-25 17:08:32 -07:00
test_scripts_api.py Consolidating controller tests. Fixing controller test cleanup which slowed down tests significantly. 2026-05-15 21:10:30 -06:00
test_services_api.py Consolidating controller tests. Fixing controller test cleanup which slowed down tests significantly. 2026-05-15 21:10:30 -06:00
test_smart.py Warn in the navbar when a hard drive runs hot (#470) 2026-06-11 19:46:33 -06:00
test_status.py Controller tracks disk bandwidth stats. 2026-01-23 15:29:18 -07:00
test_status_api.py Consolidating controller tests. Fixing controller test cleanup which slowed down tests significantly. 2026-05-15 21:10:30 -06:00
test_status_worker.py Warn in the navbar when a hard drive runs hot (#470) 2026-06-11 19:46:33 -06:00
test_systemd.py Key changes: 2026-04-04 13:48:19 -06:00
test_wrol_mode.py Creating Controller service which will control WROLPi services, admin, SMART, disks, and status. nginx will fallback to Controller UI when React UI is unavailable (such as during upgrades). 2025-12-15 15:48:40 -07:00