Bug 408279 - Battery and brightness widget doesn't show correct time remaining estimate
Summary: Battery and brightness widget doesn't show correct time remaining estimate
Status: RESOLVED WORKSFORME
Alias: None
Product: plasmashell
Classification: Plasma
Component: Battery Monitor (show other bugs)
Version: 5.16.1
Platform: unspecified Linux
: NOR normal
Target Milestone: 1.0
Assignee: Kai Uwe Broulik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-04 08:10 UTC by Michael D
Modified: 2022-12-18 05:16 UTC (History)
10 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael D 2019-06-04 08:10:48 UTC
"acpi -ib" shows a correct estimate of time remaining until full discharge. However, the battery and brightness widget shows something far less plausible, and often doesn't update after hours of use.

Part of the problem might be that I switch from an internal to an external display, but this causes no problem for acpi, so I am wondering how the widget is getting its estimate of remaining time.
Comment 1 Kai Uwe Broulik 2019-06-04 08:35:26 UTC
The widget gets it from UPower, check the output of upower -d
Comment 2 Michael D 2019-06-04 08:59:22 UTC
Thanks. I see that the two methods yield slightly different estimates, and the widget reports neither of them, so there is something wrong with the widget. The problem seems to be that the widget fails to update. If I restart plasma it correctly displays what upower -d shows.
Comment 3 Kai Uwe Broulik 2019-06-04 09:02:52 UTC
Can you check if upower signals changes properly?

dbus-monitor --system interface=org.freedesktop.UPower interface=org.freedesktop.UPower.Device

What Solid (KDE Frameworks) and UPower version are you on?
Comment 4 Kai Uwe Broulik 2019-06-04 09:04:19 UTC
or rather just the service

dbus-monitor --system sender=org.freedesktop.UPower

since property change are announced on the property interface
Comment 5 Michael D 2019-06-04 09:37:49 UTC
Solid version 5.58.0, upower version 0.99.10

This is the output from the console after switching from battery to AC, back to battery, and from external to internal display.

[michael@michael-pc ~]$ dbus-monitor --system sender=org.freedesktop.UPower
dbus-monitor: unable to enable new-style monitoring: org.freedesktop.DBus.Error.AccessDenied: "Rejected send message, 1 matched rules; type="method_call", sender=":1.8848" (uid=1000 pid=26381 comm="dbus-monitor --system sender=org.freedesktop.UPowe") interface="org.freedesktop.DBus.Monitoring" member="BecomeMonitor" error name="(unset)" requested_reply="0" destination="org.freedesktop.DBus" (bus)". Falling back to eavesdropping.
signal time=1559640732.714090 sender=org.freedesktop.DBus -> destination=:1.8848 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
   string ":1.8848"
signal time=1559640797.939507 sender=:1.46 -> destination=(null destination) serial=9527 path=/org/freedesktop/UPower/devices/battery_BAT1; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
   string "org.freedesktop.UPower.Device"
   array [
      dict entry(
         string "UpdateTime"
         variant             uint64 1559640797
      )
      dict entry(
         string "IconName"
         variant             string "battery-full-charging-symbolic"
      )
      dict entry(
         string "TimeToFull"
         variant             int64 3559
      )
      dict entry(
         string "TimeToEmpty"
         variant             int64 0
      )
      dict entry(
         string "Voltage"
         variant             double 8.091
      )
      dict entry(
         string "State"
         variant             uint32 1
      )
      dict entry(
         string "EnergyRate"
         variant             double 8.697
      )
      dict entry(
         string "Energy"
         variant             double 43.14
      )
   ]
   array [
   ]
signal time=1559640797.939883 sender=:1.46 -> destination=(null destination) serial=9528 path=/org/freedesktop/UPower; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
   string "org.freedesktop.UPower"
   array [
      dict entry(
         string "OnBattery"
         variant             boolean false
      )
   ]
   array [
   ]
signal time=1559640797.939918 sender=:1.46 -> destination=(null destination) serial=9529 path=/org/freedesktop/UPower/devices/DisplayDevice; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
   string "org.freedesktop.UPower.Device"
   array [
      dict entry(
         string "IconName"
         variant             string "battery-full-charging-symbolic"
      )
      dict entry(
         string "UpdateTime"
         variant             uint64 1559640797
      )
      dict entry(
         string "TimeToFull"
         variant             int64 3559
      )
      dict entry(
         string "TimeToEmpty"
         variant             int64 0
      )
      dict entry(
         string "EnergyRate"
         variant             double 8.697
      )
      dict entry(
         string "Energy"
         variant             double 43.14
      )
      dict entry(
         string "State"
         variant             uint32 1
      )
   ]
   array [
   ]
signal time=1559640797.940006 sender=:1.46 -> destination=(null destination) serial=9530 path=/org/freedesktop/UPower/devices/line_power_ACAD; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
   string "org.freedesktop.UPower.Device"
   array [
      dict entry(
         string "UpdateTime"
         variant             uint64 1559640797
      )
      dict entry(
         string "Online"
         variant             boolean true
      )
   ]
   array [
   ]
signal time=1559640798.343956 sender=:1.46 -> destination=(null destination) serial=9545 path=/org/freedesktop/UPower/devices/battery_BAT1; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
   string "org.freedesktop.UPower.Device"
   array [
      dict entry(
         string "UpdateTime"
         variant             uint64 1559640798
      )
   ]
   array [
   ]
signal time=1559640799.415757 sender=:1.46 -> destination=(null destination) serial=9551 path=/org/freedesktop/UPower/devices/battery_BAT1; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
   string "org.freedesktop.UPower.Device"
   array [
      dict entry(
         string "UpdateTime"
         variant             uint64 1559640799
      )
   ]
   array [
   ]
signal time=1559640806.890551 sender=:1.46 -> destination=(null destination) serial=9557 path=/org/freedesktop/UPower/devices/battery_BAT1; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
   string "org.freedesktop.UPower.Device"
   array [
      dict entry(
         string "UpdateTime"
         variant             uint64 1559640806
      )
      dict entry(
         string "IconName"
         variant             string "battery-full-symbolic"
      )
      dict entry(
         string "TimeToFull"
         variant             int64 0
      )
      dict entry(
         string "TimeToEmpty"
         variant             int64 16388
      )
      dict entry(
         string "Voltage"
         variant             double 8.445
      )
      dict entry(
         string "State"
         variant             uint32 2
      )
      dict entry(
         string "EnergyRate"
         variant             double 9.483
      )
      dict entry(
         string "Energy"
         variant             double 43.17
      )
   ]
   array [
   ]
signal time=1559640806.890643 sender=:1.46 -> destination=(null destination) serial=9558 path=/org/freedesktop/UPower/devices/DisplayDevice; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
   string "org.freedesktop.UPower.Device"
   array [
      dict entry(
         string "IconName"
         variant             string "battery-full-symbolic"
      )
      dict entry(
         string "UpdateTime"
         variant             uint64 1559640806
      )
      dict entry(
         string "TimeToFull"
         variant             int64 0
      )
      dict entry(
         string "TimeToEmpty"
         variant             int64 16388
      )
      dict entry(
         string "EnergyRate"
         variant             double 9.483
      )
      dict entry(
         string "Energy"
         variant             double 43.17
      )
      dict entry(
         string "State"
         variant             uint32 2
      )
   ]
   array [
   ]
signal time=1559640806.890701 sender=:1.46 -> destination=(null destination) serial=9559 path=/org/freedesktop/UPower/devices/line_power_ACAD; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
   string "org.freedesktop.UPower.Device"
   array [
      dict entry(
         string "UpdateTime"
         variant             uint64 1559640806
      )
      dict entry(
         string "Online"
         variant             boolean false
      )
   ]
   array [
   ]
signal time=1559640806.890725 sender=:1.46 -> destination=(null destination) serial=9560 path=/org/freedesktop/UPower; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
   string "org.freedesktop.UPower"
   array [
      dict entry(
         string "OnBattery"
         variant             boolean true
      )
   ]
   array [
   ]
signal time=1559640807.885542 sender=:1.46 -> destination=(null destination) serial=9575 path=/org/freedesktop/UPower/devices/battery_BAT1; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
   string "org.freedesktop.UPower.Device"
   array [
      dict entry(
         string "UpdateTime"
         variant             uint64 1559640807
      )
   ]
   array [
   ]
Comment 6 Vic Venti 2019-06-18 16:48:45 UTC
I'm having this same issue, now. I'm not sure when it started -- sometime after the update to 5.16. I'm using KDE neon (user edition, all latest updates as of this writing) on a Dell XPS 13 9360.

upower reports the time remaining just fine, but the battery indicator doesn't.

After unplugging my laptop for a while to let the battery discharge and running:

dbus-monitor --system sender=org.freedesktop.UPower

I see "TimeToEmpty" being reported, it just doesn't seem to be picked up by the battery indicator.

Also, it says I can confirm bugs and edit aspects of bugs -- this is my first interaction on here so I'm not sure if I'm supposed to, but I'll just mark the status as confirmed and change the platform from Manjaro to unspecified Linux, since I'm having the same issue on neon. Sorry if I'm stepping on any toes or if I'm not supposed to touch anything like that!

Pasted output from dbus-monitor is down over yonder!

---

vic@drywall:~$ dbus-monitor --system sender=org.freedesktop.UPower
dbus-monitor: unable to enable new-style monitoring: org.freedesktop.DBus.Error.AccessDenied: "Rejected send message, 1 matched rules; type="method_call", sender=":1.255" (uid=1000 pid=5276 comm="dbus-monitor --system sender=org.freedesktop.UPowe" label="unconfined") interface="org.freedesktop.DBus.Monitoring" member="BecomeMonitor" error name="(unset)" requested_reply="0" destination="org.freedesktop.DBus" (bus)". Falling back to eavesdropping.
signal time=1560875496.665061 sender=org.freedesktop.DBus -> destination=:1.255 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
   string ":1.255"
signal time=1560875586.002114 sender=:1.27 -> destination=(null destination) serial=1880 path=/org/freedesktop/UPower/devices/battery_BAT0; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
   string "org.freedesktop.UPower.Device"
   array [
      dict entry(
         string "UpdateTime"
         variant             uint64 1560875586
      )
      dict entry(
         string "TimeToEmpty"
         variant             int64 26533
      )
      dict entry(
         string "Voltage"
         variant             double 8.368
      )
      dict entry(
         string "Percentage"
         variant             double 99
      )
      dict entry(
         string "EnergyRate"
         variant             double 7.7748
      )
      dict entry(
         string "Energy"
         variant             double 57.304
      )
   ]
   array [
   ]
signal time=1560875586.002604 sender=:1.27 -> destination=(null destination) serial=1881 path=/org/freedesktop/UPower/devices/DisplayDevice; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
   string "org.freedesktop.UPower.Device"
   array [
      dict entry(
         string "UpdateTime"
         variant             uint64 1560875586
      )
      dict entry(
         string "Percentage"
         variant             double 99
      )
      dict entry(
         string "TimeToEmpty"
         variant             int64 26533
      )
      dict entry(
         string "EnergyRate"
         variant             double 7.7748
      )
      dict entry(
         string "Energy"
         variant             double 57.304
      )
   ]
   array [
   ]
^C
Comment 7 Vic Venti 2019-06-18 17:12:18 UTC
Oops, forgot to bump the version up to 5.16.1. I found out I was still on 5.16.0, and I wanted to see if the recent Powerdevil changes somehow fixed it. Same issue -- it still reports the correct time in dbus-monitor but not on the battery monitor widget.
Comment 8 Vic Venti 2019-06-26 17:32:50 UTC
I'm not sure what did it (because I didn't do anything) but the battery monitor is fixed in KDE neon for me again. It continued being broken through maybe half a dozen reboots, but some update must have resolved it (for me at least). Hopefully it's fixed for the original reporter as well!
Comment 9 Michael D 2019-06-26 19:12:20 UTC
I've checked a few times recently and it did seem to be reporting the right estimate. However, I have not been checking at all frequently because it's been inaccurate, so I'll keep my eye on it more closely now.
Comment 10 Vic Venti 2019-06-30 11:05:42 UTC
Actually no, it's unfortunately still happening for me.

I think it's maybe related to using an external display for me as well -- it seems to stop reporting the correct time after I disconnect from my USB-C dock (HDMI out, etc.) and power adapter.
Comment 11 David 2019-10-22 17:17:02 UTC
It seems that I have the same issue with the lastest kubuntu 19.10 with kde 5.16.5.
Any idea how to fix this?
I alwasy get the same remaining time, no matter what is the percentage of the remainint battery.
Comment 12 Vic Venti 2019-11-01 21:43:16 UTC
(In reply to David from comment #11)
> It seems that I have the same issue with the lastest kubuntu 19.10 with kde
> 5.16.5.
> Any idea how to fix this?
> I alwasy get the same remaining time, no matter what is the percentage of
> the remainint battery.

No idea personally -- I'd love to hear back from someone who knows more about it. Since it's just the widget and upower still works fine, for the time being I've been running a script I saved as "batstat" from KRunner when I want to see the remaining time:

#!/bin/sh
BATINFO=`upower -i $(upower -e | grep 'BAT') | grep -E "state|to\ full|percentage|time\ to\ empty"`; kdialog --passivepopup "$BATINFO" 5
Comment 13 David 2019-11-03 00:13:36 UTC
(In reply to Vic Venti from comment #12)
> (In reply to David from comment #11)
> > It seems that I have the same issue with the lastest kubuntu 19.10 with kde
> > 5.16.5.
> > Any idea how to fix this?
> > I alwasy get the same remaining time, no matter what is the percentage of
> > the remainint battery.
> 
> No idea personally -- I'd love to hear back from someone who knows more
> about it. Since it's just the widget and upower still works fine, for the
> time being I've been running a script I saved as "batstat" from KRunner when
> I want to see the remaining time:
> 
> #!/bin/sh
> BATINFO=`upower -i $(upower -e | grep 'BAT') | grep -E "state|to\
> full|percentage|time\ to\ empty"`; kdialog --passivepopup "$BATINFO" 5

Thanks for your script, it helps.
What is very frustrating is that as I am not a developer, when I look inside of the qml files of the battery monitoring widget I do not know where the data comes.
Comment 14 marcosonoio 2019-12-09 22:43:39 UTC
i have the same issue with kde neon with kde plasma 5.17.4.
the battery widget shows the right percentage, but the remaining time, the brightness and the keyboard backlight are wrong. The widget show the correct information olny on startup, it seems that the widget does not update.
Comment 15 David 2019-12-10 08:29:01 UTC
The bug is open 6 month ago. I think no one is going to fix it :-(.
Comment 16 marcosonoio 2019-12-10 11:39:58 UTC
i have an thinkpad t460s, so with dual battery.
i ask to everybody, what are yours configuration?
Comment 17 Francisco Cribari 2019-12-13 17:46:53 UTC
I have the same problem with KDE Plasma (version 5.17.4) under both Arch Linux and Manjaro. The battery widget only informs me the percentage remaining. I no longer see the estimated remaining time.
Comment 18 Francisco Cribari 2019-12-13 18:05:23 UTC
Arch Linux, KDE Plasma 5.17.4, Samsung laptop: 

┌─[cribari @ darwin5r ~]
└─╼ acpi -ib
Battery 0: Discharging, 100%, 03:33:43 remaining
Battery 0: design capacity 3950 mAh, last full capacity 4100 mAh = 100%
┌─[cribari @ darwin5r ~]
└─╼ upower -i /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          (null)
  power supply:         no
  updated:              Wed 31 Dec 1969 09:00:00 PM -03 (1576260181 seconds ago)
  has history:          no
  has statistics:       no
  unknown
    warning-level:       unknown
    battery-level:       unknown
    icon-name:          '(null)'

┌─[cribari @ darwin5r ~]
└─╼ upower -i /org/freedesktop/UPower/devices/battery_BAT1
  native-path:          BAT1
  vendor:               SAMSUNG Electronics
  model:                SR Real Battery
  serial:               123456789
  power supply:         yes
  updated:              Fri 13 Dec 2019 03:02:41 PM -03 (29 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               discharging
    warning-level:       none
    energy:              31.16 Wh
    energy-empty:        0 Wh
    energy-full:         31.16 Wh
    energy-full-design:  30.02 Wh
    energy-rate:         8.1776 W
    voltage:             8.597 V
    time to empty:       3.8 hours
    percentage:          100%
    capacity:            100%
    technology:          lithium-ion
    icon-name:          'battery-full-symbolic'

┌─[cribari @ darwin5r ~]
└─╼ upower -i /org/freedesktop/UPower/devices/battery_BAT1 | grep "time"
    time to empty:       3.8 hours
Comment 19 Francisco Cribari 2019-12-13 18:53:05 UTC
More info... 

┌─[cribari @ darwin5r ~]
└─╼ upower -e /org/freedesktop/UPower/devices/battery_BAT0
/org/freedesktop/UPower/devices/line_power_ADP1
/org/freedesktop/UPower/devices/battery_BAT1
/org/freedesktop/UPower/devices/mouse_dev_EC_10_CC_F1_B3_3C
/org/freedesktop/UPower/devices/DisplayDevice

┌─[cribari @ darwin5r ~]
└─╼ inxi -B
Battery:
  ID-1: BAT1 charge: 31.2 Wh condition: 31.2/30.0 Wh (104%) 

┌─[cribari @ darwin5r ~]
└─╼ ls /sys/class/power_supply
ADP1  BAT1

┌─[cribari @ darwin5r ~]
└─╼ ls /sys/class/power_supply/BAT1
alarm               current_now   power          type
capacity            cycle_count   present        uevent
capacity_level      device        serial_number  voltage_min_design
charge_full         hwmon4        status         voltage_now
charge_full_design  manufacturer  subsystem
charge_now          model_name    technology
Comment 20 Armitage 2020-05-08 18:10:51 UTC
I reproduce the same bug.

The powerdevil does not show the battery remaining time, only the percentage is shown.

Sometimes (don't know how to reproduce it) the remaining time is shown but not updated (is stays stuck with the same value).

The upower shows the battery remaining time and the value is correct and gets updated.

I'm running plasma 5.17.5-r1.


I edited .config/plasmawindowedrc in order to add showBatteryString=true and showRemainingTime=true but the result is the same.

The full file contents:

[Applets][3]
immutability=1
plugin=org.kde.plasma.battery

[Applets][3][Configuration]
PreloadWeight=42
geometry=0,29,288,270
showBatteryString=true
showRemainingTime=true

Also, I can see the events with dbus-monitor --system sender=org.freedesktop.UPower and the reported remaining time is correct.
Comment 21 Armitage 2020-05-09 11:42:05 UTC
The battery remaining time is shown (but not updated) if I restart the system with the power cable unplugged.
Comment 22 Frank Kruger 2020-09-08 20:03:52 UTC
Given openSUSE Tumbleweed with Plasma 5.19.5, I am also observing a battery widget with frozen remaining time (upower shows the correct time). I could solve the issue, however, by unticking  "restore previous session" on login. Seems to be weird, but maybe it helps to pin down the culprit.
Comment 23 Armitage 2020-09-08 22:20:20 UTC
(In reply to Frank Kruger from comment #22)
> Given openSUSE Tumbleweed with Plasma 5.19.5, I am also observing a battery
> widget with frozen remaining time (upower shows the correct time). I could
> solve the issue, however, by unticking  "restore previous session" on login.
> Seems to be weird, but maybe it helps to pin down the culprit.

Thank you, it worked for me.
Comment 24 Lorenzo Bettini 2020-12-05 14:21:53 UTC
(In reply to Frank Kruger from comment #22)
> Given openSUSE Tumbleweed with Plasma 5.19.5, I am also observing a battery
> widget with frozen remaining time (upower shows the correct time). I could
> solve the issue, however, by unticking  "restore previous session" on login.
> Seems to be weird, but maybe it helps to pin down the culprit.

Still a problem with Plasma 5.20.4 (Manjaro) and your workaround seems to solve it... but this way we lose one of the cool things of Plasma :(
Comment 25 Fushan Wen 2022-11-18 08:41:44 UTC
Cannot reproduce. Can someone still be able to reproduce?
Comment 26 Lorenzo Bettini 2022-11-18 10:32:58 UTC
(In reply to Fushan Wen from comment #25)
> Cannot reproduce. Can someone still be able to reproduce?

It's been a long time, and I cannot reproduce it anymore either
Comment 27 Michael D 2022-11-18 10:46:02 UTC
same, can no longer reproduce
Comment 28 Bug Janitor Service 2022-12-03 05:18:46 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 29 Bug Janitor Service 2022-12-18 05:16:48 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now 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

Thank you for helping us make KDE software even better for everyone!