Bug 355922

Summary: Icon and tooltip say "charging" when on battery
Product: [Plasma] plasmashell Reporter: Antonio Rojas <arojas>
Component: Power and Battery widgetAssignee: Kai Uwe Broulik <kde>
Status: RESOLVED FIXED    
Severity: normal CC: plasma-bugs-null, vanboxem.ruben
Priority: NOR Flags: vanboxem.ruben: VisualDesign-
Version First Reported In: 5.4.95   
Target Milestone: 1.0   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 5.7.0
Sentry Crash Report:

Description Antonio Rojas 2015-11-26 08:07:01 UTC
In 5.5 beta, the icon and tooltip of the battery monitor (placed in system tray) say "Charging" (and show the plug icon) regardless of the charging state. The information in the plasmoid popup itself is correct, however. 

Reproducible: Always
Comment 1 Kai Uwe Broulik 2015-12-21 23:42:51 UTC
Do you have more than one battery (or wireless mouse) in your computer?
Can you please give me the output of upower -d
Comment 2 Antonio Rojas 2015-12-22 07:08:13 UTC
No, just one battery. 

Device: /org/freedesktop/UPower/devices/line_power_ACAD
  native-path:          ACAD
  power supply:         yes
  updated:              dom 20 dic 2015 17:56:45 CET (137342 seconds ago)
  has history:          no
  has statistics:       no
  line-power
    warning-level:       none
    online:              yes
    icon-name:          'ac-adapter-symbolic'

Device: /org/freedesktop/UPower/devices/battery_BAT1
  native-path:          BAT1
  vendor:               SONY Corp.
  model:                VGP-BPS40
  serial:               1067
  power supply:         yes
  updated:              mar 22 dic 2015 08:04:44 CET (63 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               discharging
    warning-level:       none
    energy:              47,28 Wh
    energy-empty:        0 Wh
    energy-full:         48,26 Wh
    energy-full-design:  48,75 Wh
    energy-rate:         6,12 W
    voltage:             5,215 V
    time to empty:       7,7 hours
    percentage:          97%
    capacity:            98,9949%
    technology:          lithium-ion
    icon-name:          'battery-full-symbolic'
  History (rate):
    1450767884  6,120   discharging

Device: /org/freedesktop/UPower/devices/DisplayDevice
  power supply:         yes
  updated:              mar 22 dic 2015 08:04:44 CET (63 seconds ago)
  has history:          no
  has statistics:       no
  battery
    present:             yes
    state:               discharging
    warning-level:       none
    energy:              47,28 Wh
    energy-full:         48,26 Wh
    energy-rate:         6,12 W
    time to empty:       7,7 hours
    percentage:          97%
    icon-name:          'battery-full-symbolic'

Daemon:
  daemon-version:  0.99.3
  on-battery:      no
  lid-is-closed:   no
  lid-is-present:  yes
  critical-action: PowerOff
Comment 3 vanboxem.ruben 2016-03-26 13:35:06 UTC
I can confirm on Arch Linux, KDE Frameworks 5.19, Qt 5.5.1.

Output of upower -d:

Device: /org/freedesktop/UPower/devices/line_power_ADP1                                                       
  native-path:          ADP1                                                                                  
  power supply:         yes                                                                                   
  updated:              do 24 mrt 2016 15:13:02 CET (170446 seconds ago)                                      
  has history:          no                                                                                    
  has statistics:       no                                                                                    
  line-power                                                                                                  
    warning-level:       none                                                                                 
    online:              yes                                                                                  
    icon-name:          'ac-adapter-symbolic'                                                                 

Device: /org/freedesktop/UPower/devices/battery_BAT1                                                          
  native-path:          BAT1                                                                                  
  vendor:               Sony Corporation                                                                      
  power supply:         yes                                                                                   
  updated:              za 26 mrt 2016 14:33:46 CET (2 seconds ago)                                           
  has history:          yes                                                                                   
  has statistics:       yes                                                                                   
  battery                                                                                                     
    present:             yes                                                                                  
    rechargeable:        yes                                                                                  
    state:               discharging                                                                          
    warning-level:       none                                                                                 
    energy:              17,76 Wh                                                                             
    energy-empty:        0 Wh                                                                                 
    energy-full:         32,64 Wh                                                                             
    energy-full-design:  59,5 Wh                                                                              
    energy-rate:         17,444 W                                                                             
    voltage:             10,978 V                                                                             
    time to empty:       1,0 hours                                                                            
    percentage:          54%                                                                                  
    capacity:            54,8571%                                                                             
    technology:          lithium-ion                                                                          
    icon-name:          'battery-good-symbolic'                                                               
  History (charge):                                                                                           
    1458999226  54,000  discharging                                                                           
  History (rate):                                                                                             
    1458999226  17,444  discharging                                                                           

Device: /org/freedesktop/UPower/devices/DisplayDevice
  power supply:         yes
  updated:              za 26 mrt 2016 14:33:46 CET (2 seconds ago)
  has history:          no
  has statistics:       no
  battery
    present:             yes
    state:               discharging
    warning-level:       none
    energy:              17,76 Wh
    energy-full:         32,64 Wh
    energy-rate:         17,444 W
    time to empty:       1,0 hours
    percentage:          54%
    icon-name:          'battery-good-symbolic'

Daemon:
  daemon-version:  0.99.4
  on-battery:      no
  lid-is-closed:   no
  lid-is-present:  yes
  critical-action: HybridSleep
Comment 4 Kai Uwe Broulik 2016-03-26 13:58:19 UTC
Ok, thanks. Can you run plasmaengineexplorer (part of Plasma SDK) and see in the "powermanagement" what the "State" says in "Battery" (not Battery0) ?
Comment 5 Kai Uwe Broulik 2016-03-26 14:00:37 UTC
Ok, I found the cause. It just checks whether the AC is plugged in, not the battery state.

The icon should reflect the AC state but the tooltip should perhaps have a "plugged in but not charging" state.
Comment 6 Kai Uwe Broulik 2016-03-26 14:06:29 UTC
Git commit 93daaf4c504ee2da91b5bbfc9502d0244105bd18 by Kai Uwe Broulik.
Committed on 26/03/2016 at 14:04.
Pushed by broulik into branch 'master'.

[Battery Monitor] Add a "plugged in but not charging" state for the tooltip

The tooltip would only take into account the AC adapter state and say the
battery is being charged although it isn't. This adds a "Plugged in"
state when the AC is plugged in but the battery is not charging.
FIXED-IN: 5.7.0

M  +6    -1    applets/batterymonitor/package/contents/ui/batterymonitor.qml

http://commits.kde.org/plasma-workspace/93daaf4c504ee2da91b5bbfc9502d0244105bd18
Comment 7 vanboxem.ruben 2016-03-26 14:13:02 UTC
I just verified this behaviour: go to hibernate plugged in, pull out adapter, resume, "ac adapter" state remains plugged in, and therefore icon remains on charging. The extra state you added doesn't solve this though.