From f4d2a23e8aeda47bac8864c751abc1ad2c99d742 Mon Sep 17 00:00:00 2001 From: Thomas Faour Date: Wed, 22 Jul 2026 11:29:17 -0400 Subject: [PATCH] Drop "On battery for", clarify the remaining-estimate label "On battery for" was clutter next to the actual number people care about. Relabeled "Est. remaining" to "Est. battery life left" and dropped the now-unused on_battery_since field from the /queue response. battery_estimate_s itself is unchanged -- it still needs 2h of span and a 2% drop within the current discharge cycle (reset on any 5%+ jump, i.e. a recharge or reflash) before it'll show anything. A frame that's been power-cycled/reflashed recently won't have an estimate yet; that's expected, not a regression. --- server/app/routers/api_frames.py | 2 -- server/app/static/device_status_bar.js | 10 +++------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/server/app/routers/api_frames.py b/server/app/routers/api_frames.py index e4c5844..9ac16cf 100644 --- a/server/app/routers/api_frames.py +++ b/server/app/routers/api_frames.py @@ -207,7 +207,6 @@ def api_queue( "firmware_available": cfg.firmware_available_version, "battery_percent": cfg.battery_percent, "battery_as_of": cfg.battery_as_of, - "on_battery_since": cfg.battery_history[0][0] if cfg.battery_history else None, "battery_estimate_s": battery_estimate_s(cfg), "controller_id": cfg.controlled_by_user_id, "controller": ( @@ -240,7 +239,6 @@ def api_queue( if snapshot["battery_percent"] >= 0 else None ), - "on_battery_since": snapshot["on_battery_since"], "battery_estimate_s": snapshot["battery_estimate_s"], }, } diff --git a/server/app/static/device_status_bar.js b/server/app/static/device_status_bar.js index 382ac0e..79657ea 100644 --- a/server/app/static/device_status_bar.js +++ b/server/app/static/device_status_bar.js @@ -27,11 +27,8 @@ function renderDeviceStatusBar(device) { if (device.battery) { rows.push(['Battery', `${device.battery.percent}%`, false]); } - if (device.on_battery_since) { - rows.push(['On battery for', formatDuration(now - device.on_battery_since), false]); - } if (device.battery_estimate_s !== null && device.battery_estimate_s !== undefined) { - rows.push(['Est. remaining', `~${formatDuration(device.battery_estimate_s)}`, false]); + rows.push(['Est. battery life left', `~${formatDuration(device.battery_estimate_s)}`, false]); } for (const [label, value, alert] of rows) { const stat = document.createElement('span'); @@ -65,9 +62,8 @@ document.addEventListener('themechange', () => { } }); -// Fast tick: re-renders "Last seen"/"On battery for" from already- -// fetched data every second so they count up smoothly without hitting -// the server that often. +// Fast tick: re-renders "Last seen" from already-fetched data every +// second so it counts up smoothly without hitting the server that often. setInterval(() => { if (lastDeviceStatus) { renderDeviceStatusBar(lastDeviceStatus);