fix: use single-shot low battery notifications#5550
Conversation
Adopt a state-change model for battery notifications instead of the previous cooldown-based approach. Each node now receives exactly one notification when its battery drops to or below 20%. The notification flag is cleared when the battery recovers above 20%, allowing a new notification on the next low-battery episode. This matches the UX pattern used by Home Assistant, Tile, and AirTag where users are informed once per low-battery episode without repeated alerts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
aaed407 to
6de8c35
Compare
🖼️ Preview staleness check — advisoryThis PR modifies UI composables but does not update any
Changed UI files: What to check:
Adding previews checklist:
If this PR does not require preview updates (e.g., logic-only change, non-visual refactor), add the |
📄 Docs staleness check — advisoryThis PR modifies user-facing UI source files but does not update any page under
Changed source files: What to check:
New page checklist (if adding a new doc page):
If this PR does not require a doc update (e.g., internal refactor, bug fix, test change), add the
|
Motivation
The previous low battery notification system was overly aggressive -- remote favorite nodes triggered a notification on every telemetry update (gated only by a 25-minute cooldown), and a "critical" threshold bypassed the cooldown entirely. This led to notification fatigue, especially for users with multiple favorite nodes in the field.
Approach
Replaced the cooldown-timer model with a single-shot, state-change approach (similar to Home Assistant, Tile, and AirTag):
notifiedNodesset. No further notifications fire while it remains below threshold.This eliminates all cooldown timers, divisor-based thresholds, and the critical-bypass logic, resulting in a much simpler and less intrusive notification experience.
Notes
shouldBatteryNotificationShowfunction signature retains its parameters for interface compatibility but the logic is now trivial (check-and-add to a set).