Bug 374901

Summary: Battery indicator shows red icon warning 0% all the time on desktop
Product: [Plasma] plasmashell Reporter: Vasilis.Vlachoudis
Component: Battery MonitorAssignee: Kai Uwe Broulik <kde>
Status: RESOLVED WORKSFORME    
Severity: normal CC: bugseforuns, katyaberezyaka, nate, plasma-bugs
Priority: NOR    
Version: 5.8.2   
Target Milestone: 1.0   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:

Description Vasilis.Vlachoudis 2017-01-11 08:23:03 UTC
On my desktop computer with Fedora-25 (also in fedora-23 was similar) the battery indicator on the status bar flashes constantly with a red icon and shows a message "0% Plugged in, not Charging"
The only devices that I have with batteries are the APC ups and an Apple Wireless keyboard. When I click the icon it displays two entries 
"Apple keyboard with battery level 33%"
and an additional entry "Battery not present"

In Fedora-23 I could eliminate the red warning by restarting the upower.service. Not any more in fedora-25

The upower reports the following:

The ups for some reason appears twice as ups_hiddev0 and as DisplayDevice, but both reported fully-charged, however the updated time for the ups_hiddev0 as updated in 1970 (0s unix time), on the Display entry is correct.

Most probably there is a problem either with upowerd or apcupsd, but why kde is reporting 0%?

$ upower -d
Device: /org/freedesktop/UPower/devices/keyboard_hid_e4o8bo7fo20oc1o29_battery
  native-path:          hid-e4:8b:7f:20:c1:29-battery
  model:                Apple Wireless Keyboard
  power supply:         no
  updated:              Wed Jan 11 09:15:18 2017 (6 seconds ago)
  has history:          yes
  has statistics:       yes
  keyboard
    present:             yes
    rechargeable:        yes
    state:               discharging
    warning-level:       none
    percentage:          33%
    icon-name:          'battery-good-symbolic'

Device: /org/freedesktop/UPower/devices/ups_hiddev0
  native-path:          /sys/devices/pci0000:00/0000:00:14.0/usb3/3-7/3-7:1.0/usbmisc/hiddev0
  vendor:               American Power Conversion
  model:                Smart-UPS 1500 FW:COM 02.1 / UPS.05.I
  serial:               AS1048120739  
  power supply:         yes
  updated:              Thu Jan  1 01:00:00 1970 (1484122524 seconds ago)
  has history:          yes
  has statistics:       yes
  ups
    present:             yes
    state:               fully-charged
    warning-level:       none
    time to empty:       1.9 hours
    percentage:          100%
    icon-name:          'battery-full-charged-symbolic'

Device: /org/freedesktop/UPower/devices/DisplayDevice
  power supply:         yes
  updated:              Wed Jan 11 08:53:15 2017 (1329 seconds ago)
  has history:          no
  has statistics:       no
  ups
    present:             yes
    state:               fully-charged
    warning-level:       none
    time to empty:       1.9 hours
    percentage:          100%
    icon-name:          'battery-full-charged-symbolic'
Comment 1 Kai Uwe Broulik 2018-01-02 14:47:34 UTC
Can you check the "powermanagement" dataengine with plasmaengineexplorer (part of plasma-sdk). I suspect the "Battery" source (that is created by combining the power supply ones) is buggy.

Please check what it says in "Battery" for "Has Cumulative" and "Has Battery" and the "Percent". I don't have an UPS, unfortunately, can you perhaps test a patch?
Comment 2 Kai Uwe Broulik 2018-01-02 14:49:12 UTC
Ok I think I have it.

The combined source uses the energy (Wh) of the batteries to determin percentage. "This property is only valid if the property type has the value "battery"." And battery != ups, so this is why it breaks for you.
Comment 3 Kai Uwe Broulik 2018-01-02 14:50:31 UTC
However, I already have a case for exactly this here:

if (count == 1) {
        // Energy is sometimes way off causing us to show rubbish; this is a UPower issue
        // but anyway having just one battery and the tooltip showing strange readings
        // compared to the popup doesn't look polished.

(we don't count the display device, so this code path should be hit on your machine :/)
Comment 4 Nate Graham 2021-04-23 04:55:54 UTC
Can you reproduce this issue with the latest Fedora version?
Comment 5 Bug Janitor Service 2021-05-08 04:33:30 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 6 Bug Janitor Service 2021-05-23 04:33:45 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!