SUMMARY The "battery time remaining" indicator is not working properly. The time shown seems random. STEPS TO REPRODUCE 1. always on 2. 3. OBSERVED RESULT time random EXPECTED RESULT correlation with battery % SOFTWARE/OS VERSIONS Windows: macOS: Linux/KDE Plasma: (available in About System) KDE Plasma Version: KDE Frameworks Version: Qt Version: ADDITIONAL INFORMATION When using gnome interface the battery time seems to be working
I forgot to say what the hardware is: Dell XPS 13, model 9310 Here is the OS data: Operating System: Kubuntu 20.04 KDE Plasma Version: 5.18.5 KDE Frameworks Version: 5.68.0 Qt Version: 5.12.8 Kernel Version: 5.6.0-1048-oem OS Type: 64-bit Processors: 8 × 11th Gen Intel® Core™ i7-1185G7 @ 3.00GHz Memory: 15.4 GiB of RAM
Can you attach screenshot that shows the problem?
Created attachment 136706 [details] screenshot of power panel At 74% charge the time prediction is 1:54 to empty. This number is arbitrary. I think the same time was shown at 17% battery charge.
Created attachment 136707 [details] second screenshot
After the first screentshot I logged out of plasma, logged in to gnome, then back to plasma. As you can see in the 2nd screenshot the battery is down to 73%, but now the time predicted in 4:37 hours. As I said, the time prediction in plasma appears to be random. Perhaps in gnome there is a realistic evaluation, but not sure.
Can you provide upower -d when the numbers are implausible? Admittedly we don't apply any moving average or anything so the values can vary wildly based on CPU usage in the very moment etc
Thank you!
After working for a while the battery is down to 67%, yet the time prediction is still 4:37. It seems that this time prediction is not correlated to anything. Screenshot attached.
Created attachment 136713 [details] 3rd shot
Here is the output from upower (IU've no idea what this means): amyekut@amyekut-XPS-13-9310:~$ upower -d Device: /org/freedesktop/UPower/devices/line_power_AC native-path: AC power supply: yes updated: Mon 15 Mar 2021 23:25:00 (3040 seconds ago) has history: no has statistics: no line-power warning-level: none online: no icon-name: 'ac-adapter-symbolic' Device: /org/freedesktop/UPower/devices/battery_BAT0 native-path: BAT0 vendor: BYD model: DELL FP86V09 serial: 916 power supply: yes updated: Tue 16 Mar 2021 00:15:01 (39 seconds ago) has history: yes has statistics: yes battery present: yes rechargeable: yes state: discharging warning-level: none energy: 34.314 Wh energy-empty: 0 Wh energy-full: 50.9732 Wh energy-full-design: 50.9732 Wh energy-rate: 3.306 W voltage: 7.936 V time to empty: 10.4 hours percentage: 67% capacity: 100% technology: lithium-polymer icon-name: 'battery-full-symbolic' History (rate): 1615846501 3.306 discharging Device: /org/freedesktop/UPower/devices/DisplayDevice power supply: yes updated: Tue 16 Mar 2021 00:15:01 (39 seconds ago) has history: no has statistics: no battery present: yes state: discharging warning-level: none energy: 34.314 Wh energy-full: 50.9732 Wh energy-rate: 3.306 W time to empty: 10.4 hours percentage: 67% icon-name: 'battery-full-symbolic' Daemon: daemon-version: 0.99.11 on-battery: yes lid-is-closed: no lid-is-present: yes critical-action: PowerOff
https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2338 and https://invent.kde.org/plasma/powerdevil/-/merge_requests/118
Git commit b55f85ce464be8595df70c903b19534cbe36b7c3 by Fushan Wen. Committed on 08/12/2022 at 11:48. Pushed by fusionfuture into branch 'master'. Apply exponential moving average to remaining time when unplugged This applies exponential moving average to the remaining time history records to calculate the remaining time, to mitigate the impact of a short-time heavy load on the estimation of remaining time. M +6 -0 daemon/org.kde.Solid.PowerManagement.xml M +58 -0 daemon/powerdevilbackendinterface.cpp M +15 -0 daemon/powerdevilbackendinterface.h M +11 -0 daemon/powerdevilcore.cpp M +3 -0 daemon/powerdevilcore.h https://invent.kde.org/plasma/powerdevil/commit/b55f85ce464be8595df70c903b19534cbe36b7c3
Git commit e0513a276845b36a2c0e44120a4cc5d5c37ed59c by Fushan Wen. Committed on 08/12/2022 at 11:49. Pushed by fusionfuture into branch 'master'. applets/batterymonitor: use smoothed remaining time which can mitigate the impact of short-time heavy loads on the estimation. Requires https://invent.kde.org/plasma/powerdevil/-/commit/b55f85ce464be8595df70c903b19534cbe36b7c3 M +1 -1 applets/batterymonitor/package/contents/ui/main.qml M +44 -13 dataengines/powermanagement/powermanagementengine.cpp M +1 -0 dataengines/powermanagement/powermanagementengine.h https://invent.kde.org/plasma/plasma-workspace/commit/e0513a276845b36a2c0e44120a4cc5d5c37ed59c
A possibly relevant merge request was started @ https://invent.kde.org/plasma/powerdevil/-/merge_requests/162
Git commit e6fdb5b169f3da6f08c89ee1a425f1f00ce902b7 by Stefan Brüns. Committed on 20/04/2023 at 22:43. Pushed by bruns into branch 'master'. Fix and consolidate discharge rate and remaining time calculation This fixes several issues in the current code: 1. Instead of averaging the remaining time it averages the discharge rate, and uses the rate and remaining energy to calculate the time. 2. It gets rid of the history array, an autoregressive filter only needs one history value, no point recalculating it again and again. 3. It keeps the averaged discharge rate over plug/unplug events. This reduces the error after replugging, as the first few reported rate values are often too small, while there is no intrinsic reason the old rate estimate becomes invalid. 4. It brings the legacy remaining time calculation in line with the one based on the DisplayDevice UPower object, i.e. always uses rate and remaining energy to full/empty to calculate the time. M +19 -29 daemon/backends/upower/powerdevilupowerbackend.cpp M +38 -31 daemon/powerdevilbackendinterface.cpp M +3 -1 daemon/powerdevilbackendinterface.h https://invent.kde.org/plasma/powerdevil/commit/e6fdb5b169f3da6f08c89ee1a425f1f00ce902b7
Git commit f6664808e34650512867fee817f940ab27b0097c by Stefan Brüns. Committed on 21/04/2023 at 19:38. Pushed by bruns into branch 'Plasma/5.27'. Fix and consolidate discharge rate and remaining time calculation This fixes several issues in the current code: 1. Instead of averaging the remaining time it averages the discharge rate, and uses the rate and remaining energy to calculate the time. 2. It gets rid of the history array, an autoregressive filter only needs one history value, no point recalculating it again and again. 3. It keeps the averaged discharge rate over plug/unplug events. This reduces the error after replugging, as the first few reported rate values are often too small, while there is no intrinsic reason the old rate estimate becomes invalid. 4. It brings the legacy remaining time calculation in line with the one based on the DisplayDevice UPower object, i.e. always uses rate and remaining energy to full/empty to calculate the time. (cherry picked from commit e6fdb5b169f3da6f08c89ee1a425f1f00ce902b7) M +19 -29 daemon/backends/upower/powerdevilupowerbackend.cpp M +38 -31 daemon/powerdevilbackendinterface.cpp M +3 -1 daemon/powerdevilbackendinterface.h https://invent.kde.org/plasma/powerdevil/commit/f6664808e34650512867fee817f940ab27b0097c
Not sure if this belongs here or in a new bug but running 5.2.7.5 and this issue would still look to exists. Battery = 71% charge Health = 92% Time remaining = 0:34 Querying with upower: upower -i $(upower -e | grep '/battery') | grep --color=never -E "state|to\ full|to\ empty|percentage" state: discharging time to empty: 4.3 hours percentage: 71% System Details Operating System: Debian GNU/Linux 12 KDE Plasma Version: 5.27.5 KDE Frameworks Version: 5.103.0 Qt Version: 5.15.8 Kernel Version: 6.1.0-10-amd64 (64-bit) Graphics Platform: Wayland Processors: 16 × AMD Ryzen 7 5700U with Radeon Graphics Memory: 19.4 GiB of RAM Graphics Processor: AMD Radeon Graphics Manufacturer: LENOVO Product Name: 21A2 System Version: ThinkBook 14 G3 ACL
This started happening to me as well just recently. Plasma widget shows unplausibly high or low values for the remaining time while upower shows more plausible ones. Operating System: Debian GNU/Linux KDE Plasma Version: 5.27.7 KDE Frameworks Version: 5.107.0 Qt Version: 5.15.10 Kernel Version: 6.4.0-2-amd64 (64-bit) Graphics Platform: X11 Processors: 4 × Intel® Pentium® Silver N6000 @ 1.10GHz Memory: 7.6 GiB of RAM Graphics Processor: Mesa Intel® UHD Graphics Manufacturer: Acer Product Name: Swift SF114-34 System Version: V1.03
I also have this exact same bug, with plasma 5.27.9 (archlinux). I've been having it for a while, but I couldn't say how long.
It seems this is broken for a while. In fact I don't ever recall KDE Plasma showing remaining battery time correctly for my laptops (using Fedora KDE). Plasma shows 1:04 remaining, while upower -d shows: Device: /org/freedesktop/UPower/devices/line_power_AC native-path: AC power supply: yes updated: czw, 25 sty 2024, 03:50:22 (895 seconds ago) has history: no has statistics: no line-power warning-level: none online: no icon-name: 'ac-adapter-symbolic' Device: /org/freedesktop/UPower/devices/battery_BAT0 native-path: BAT0 vendor: Hewlett-Packard model: Primary serial: 05314 2022/01/28 power supply: yes updated: czw, 25 sty 2024, 04:04:49 (28 seconds ago) has history: yes has statistics: yes battery present: yes rechargeable: yes state: discharging warning-level: none energy: 25,1328 Wh energy-empty: 0 Wh energy-full: 42,4116 Wh energy-full-design: 53,0145 Wh energy-rate: 6,38715 W voltage: 11,346 V charge-cycles: 11 time to empty: 3,9 hours percentage: 59% capacity: 80% technology: lithium-ion icon-name: 'battery-good-symbolic' History (rate): 1706151831 6,387 discharging Device: /org/freedesktop/UPower/devices/DisplayDevice power supply: yes updated: czw, 25 sty 2024, 04:04:49 (28 seconds ago) has history: no has statistics: no battery present: yes state: discharging warning-level: none energy: 25,1328 Wh energy-full: 42,4116 Wh energy-rate: 6,38715 W charge-cycles: N/A time to empty: 3,9 hours percentage: 59% icon-name: 'battery-good-symbolic' Daemon: daemon-version: 1.90.2 on-battery: yes lid-is-closed: no lid-is-present: yes critical-action: PowerOff
See also https://bugs.kde.org/show_bug.cgi?id=471010 To check if this is a bug in powerdevil or the battery monitor, you can listen to the relevant dbus events from powerdevil with $ dbus-monitor "interface='org.kde.Solid.PowerManagement'" the batteryRemainingTimeChanged and smoothedBatteryRemainingTimeChanged values are in milliseconds (as far as I can tell), so divide the printed values (e.g. "uint64 23622283") by 3600000 to get hours (note that the decimals will not be minutes, but more like percentages of an hour, i.e. 0.999 is about 60 minutes), or 60000 to get minutes. In my case it seems to be a bug in the Battery Monitor frontend, the dbus values look correct.