Skip to content

Server-driven temperature thresholds + hide unused Board card#4

Merged
Kyzcreig merged 1 commit into
mainfrom
feat/server-driven-thresholds
Jul 21, 2026
Merged

Server-driven temperature thresholds + hide unused Board card#4
Kyzcreig merged 1 commit into
mainfrom
feat/server-driven-thresholds

Conversation

@Kyzcreig

Copy link
Copy Markdown
Owner

Refactor per Ace request (#1 + #2 from the dashboard review).

What

  • feat: add fail-closed AST2600 TrueNAS fan control #1 Single source of truth for thresholds. Safety cutoffs were duplicated: the policy tripped on inline 44/70/40/60 AND dashboard.js had its own hardcoded 61,70 / 41,44 copies that could silently drift. Now truefan_control/policy.py owns named constants (HOT_DRIVE_C, HOT_CPU_C, RECOVER_*) + a THRESHOLDS map (incl. display-only warm/hot tiers for board/nvme). /status carries them; the frontend colours from them; per-device ranges preserved.
  • fix: serve control status from cached snapshot to stop UI probe timeouts #2 Hide the unused Board card. board_c is null on this AST2600 BMC — the card showed a permanent dead --°. Now data-optional cards hide when their source reports null.

Safety

No change to actual thresholds or fan behaviour — pure de-duplication. The policy trips at exactly the same numbers (locked by a new anti-drift test).

Tests

49 passed (46 existing + 3 new): threshold propagation through /status, and an anti-drift guarantee that display thresholds equal the safety constants the policy trips on. JS syntax-checked with node --check.

…h) + hide unused Board card

- policy.py: hoist safety thresholds to named constants (HOT_DRIVE_C/HOT_CPU_C/
  RECOVER_*) + a THRESHOLDS map covering display-only warm/hot tiers for every
  sensor. evaluate() now references the constants instead of inline 44/70/40/60.
- service.py: attach thresholds to every published /status snapshot.
- server.py: propagate agent thresholds through core to the browser.
- dashboard.js: colour temps from server-supplied thresholds (tier() helper);
  drop the duplicated hardcoded 61,70/41,44 literals. Falls back to defaults if
  an older agent omits them. #2: data-optional cards (Board) hide when their
  source reports null instead of showing a dead placeholder.
- tests: +3 (threshold propagation through /status; anti-drift guarantee that
  display thresholds equal the safety constants the policy trips on).
@Kyzcreig
Kyzcreig merged commit 06ece54 into main Jul 21, 2026
1 check passed
@Kyzcreig
Kyzcreig deleted the feat/server-driven-thresholds branch July 21, 2026 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant