diff --git a/server/app/static/device_status_bar.js b/server/app/static/device_status_bar.js index 79657ea..3c53b79 100644 --- a/server/app/static/device_status_bar.js +++ b/server/app/static/device_status_bar.js @@ -26,9 +26,16 @@ function renderDeviceStatusBar(device) { } if (device.battery) { rows.push(['Battery', `${device.battery.percent}%`, false]); - } - if (device.battery_estimate_s !== null && device.battery_estimate_s !== undefined) { - rows.push(['Est. battery life left', `~${formatDuration(device.battery_estimate_s)}`, false]); + // Shown as soon as there's any battery reading at all, even before + // battery_estimate_s can compute a rate (needs 2h+ span and a 2%+ + // drop within the current discharge cycle -- see common.py) -- so + // it's clear the number is coming, not that the feature is broken. + const hasEstimate = device.battery_estimate_s !== null && device.battery_estimate_s !== undefined; + rows.push([ + 'Est. battery life left', + hasEstimate ? `~${formatDuration(device.battery_estimate_s)}` : 'Not enough data yet', + false, + ]); } for (const [label, value, alert] of rows) { const stat = document.createElement('span');