Bug 471010 - Battery Monitor shows wrong remaining time
Summary: Battery Monitor shows wrong remaining time
Status: REOPENED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Battery Monitor (show other bugs)
Version: 5.27.5
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-14 07:12 UTC by slartibart70
Modified: 2024-09-08 20:53 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
applet (13.68 KB, image/png)
2023-06-14 07:12 UTC, slartibart70
Details
screenshot of plasma with battery information and the output of upower -d (371.92 KB, image/jpeg)
2024-03-13 16:03 UTC, Daniel Gibson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description slartibart70 2023-06-14 07:12:37 UTC
Created attachment 159644 [details]
applet

The plasma battery applet shows the remaining time (for battery power) when hovering over the icon in the taskbar and in the popup menu when clicking.

Problem:
discharging state (percentage) is shown correctly,
the estimated remaining time is 'stuck' at 1:03 hours

In contrast, upower indicates the correct estimation when dumping the BAT0 information:

Device: /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          BAT0
  vendor:               LGC
  model:                45N1136
  serial:               335
  power supply:         yes
  updated:              Mi 14 Jun 2023 09:06:36 CEST (2 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               discharging
    warning-level:       none
    energy:              48,67 Wh
    energy-empty:        0 Wh
    energy-full:         72,15 Wh
    energy-full-design:  72,15 Wh
    energy-rate:         14,167 W
    voltage:             11,06 V
    charge-cycles:       1
    time to empty:       3,4 hours
    percentage:          67%
    capacity:            100%
    technology:          lithium-ion
    icon-name:          'battery-full-symbolic'
  History (charge):
    1686726336  67,000  discharging
Comment 1 slartibart70 2023-06-14 07:14:55 UTC
Operating System: Fedora Linux 37
KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.107.0
Qt Version: 5.15.9
Kernel Version: 6.3.7-100.fc37.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i7-7820HQ CPU @ 2.90GHz
Memory: 31,1 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 630
Manufacturer: LENOVO
System Version: ThinkPad T470p
Comment 2 Nate Graham 2023-12-08 20:32:58 UTC
What this happens, does `upower -d` agree with the time shown widget, or the time shown in the BAT0 dump?
Comment 3 Bug Janitor Service 2023-12-23 03:46:21 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 4 slartibart70 2023-12-24 11:20:56 UTC
This is fairly old (KDE Plasma Version: 5.27.5, Kernel Version: 6.3.7) and i didn't encounter this any more in recent versions
Comment 5 Daniel Gibson 2024-03-13 16:01:35 UTC
I'm seeing the same bug with KUbuntu 24.04 with plasma 5.27.10-1ubuntu1 and power-profiles-daemon 0.20-3ubuntu1 and upower 1.9.2-8 and Kernel 6.6 (see below for full system info).

The battery monitor usually shows something like 2:30 or 2:48 remaining, while `upower -d` says "time to empty:  6.9 hours"

Weirdly, the Energy Information shows very similar values as `upower -d` in regards to remaining energy and current consumption and percentage, they just disagree about the remaining time (and upower shows the correct time, it's similar to that shown by `powertop`).

See also the screeenshot I'll attach.

SOFTWARE/OS VERSIONS

Operating System: Kubuntu 24.04
KDE Plasma Version: 5.27.10
KDE Frameworks Version: 5.115.0
Qt Version: 5.15.12
Kernel Version: 6.6.0-14-generic (64-bit)
Graphics Platform: X11
Processors: 12 × AMD Ryzen 5 7640U w/ Radeon 760M Graphics
Memory: 27.1 GiB of RAM
Graphics Processor: AMD Radeon Graphics
Manufacturer: Framework
Product Name: Laptop 13 (AMD Ryzen 7040Series)
System Version: A5
Comment 6 Daniel Gibson 2024-03-13 16:03:16 UTC
Created attachment 167106 [details]
screenshot of plasma with battery information and the output of upower -d
Comment 7 Daniel Gibson 2024-03-13 17:40:15 UTC
This bug might be related: https://bugs.kde.org/show_bug.cgi?id=434432

However, it seems like powerdevil (4:5.27.10-0ubuntu1) sends the correct data.
I ran `$ dbus-monitor "interface='org.kde.Solid.PowerManagement'"`
and got output like:

signal time=1710350808.162323 sender=:1.46 -> destination=(null destination) serial=1751 path=/org/kde/Solid/PowerManagement; interface=org.kde.Solid.PowerManagement; member=batteryRemainingTimeChanged
   uint64 31742192
signal time=1710350808.162364 sender=:1.46 -> destination=(null destination) serial=1752 path=/org/kde/Solid/PowerManagement; interface=org.kde.Solid.PowerManagement; member=smoothedBatteryRemainingTimeChanged
   uint64 30990825
signal time=1710350838.166760 sender=:1.46 -> destination=(null destination) serial=1753 path=/org/kde/Solid/PowerManagement; interface=org.kde.Solid.PowerManagement; member=batteryRemainingTimeChanged
   uint64 32683561
signal time=1710350838.166803 sender=:1.46 -> destination=(null destination) serial=1754 path=/org/kde/Solid/PowerManagement; interface=org.kde.Solid.PowerManagement; member=smoothedBatteryRemainingTimeChanged
   uint64 31203221

I guess those values are in ms, and e.g. 32683561 ms are 9.079h, which matches the
 time to empty:       9.1 hours
from upower -d
However, the battery monitor applet continues to show "2:48 remaining", and continues to show that value even if I turn the screen brightness up fully; while upower says "time to empty:       6.3 hours" and dbus-monitor says

signal time=1710351498.757384 sender=:1.46 -> destination=(null destination) serial=1923 path=/org/kde/Solid/PowerManagement; interface=org.kde.Solid.PowerManagement; member=batteryRemainingTimeChanged
   uint64 21700699
which is 6.0278h

So probably the bug is in the Battery Monitor itself
Comment 8 Daniel Gibson 2024-03-13 23:32:29 UTC
Just so stuff is cross-referenced: "My" other battery monitor bug (power profile selection slider always jumps back to initial value, even if the selected profile is actually set) might be related to this one https://bugs.kde.org/show_bug.cgi?id=475255

In both cases PowerDevil sends the correct values through DBus, but the Battery Monitor continues showing bogus values.

By the way:
- Both bugs happen on both X11 and Wayland
- The remaining time shown seems to change only when logging in, afterwards it never seems to change (even if the battery level and the real remaining time according to upower go change over time)