hoelzro / obvious

Widget library for the awesome window manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Two batteries support

abcdw opened this issue · comments

Add support for two batteries to battery widget please.
My thinkpad x250 laptop has built-in battery and external battery.

upower -e
/org/freedesktop/UPower/devices/line_power_AC
/org/freedesktop/UPower/devices/battery_BAT0
/org/freedesktop/UPower/devices/battery_BAT1
/org/freedesktop/UPower/devices/DisplayDevice

@abcdw I'm probably going to be redoing a lot of the battery stuff soon, so I'll make sure to think about this while I do it. Thanks for the input!

@abcdw Sorry, I haven't had a lot of time for obvious lately; I'll try to get to it soon. If you get impatient and do it yourself, feel free to submit a PR and I'll merge it in!

@abcdw Just a status report: I'm working on this right now, should have this ready soon!

It's very cool : )
Thanks a lot for your work.

пт, 20 нояб. 2015 г., 7:53, Rob Hoelz notifications@github.com:

@abcdw https://github.com/abcdw Just a status report: I'm working on
this right now, should have this ready soon!


Reply to this email directly or view it on GitHub
#19 (comment).

@abcdw Thanks for your patience; I just finished adding support. Could you try out the code in the battery-refactor branch and let me know if that works for you? Thanks!

Curses! @abcdw Would you mind sending me the output for upower -i /org/freedesktop/UPower/devices/battery_BAT0 and upower -i /org/freedesktop/UPower/devices/battery_BAT1?

  native-path:          BAT0
  vendor:               SANYO
  model:                45N1773
  serial:               331
  power supply:         yes
  updated:              Пт 27 ноя 2015 21:56:30 (110 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               charging
    warning-level:       none
    energy:              16,98 Wh
    energy-empty:        0 Wh
    energy-full:         22,56 Wh
    energy-full-design:  23,2 Wh
    energy-rate:         0 W
    voltage:             11,363 V
    percentage:          75%
    capacity:            97,2414%
    technology:          lithium-ion
    icon-name:          'battery-full-charging-symbolic'
  native-path:          BAT1
  vendor:               LGC
  model:                45N1738
  serial:               2890
  power supply:         yes
  updated:              Пт 27 ноя 2015 21:58:30 (27 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               fully-charged
    warning-level:       none
    energy:              68,7 Wh
    energy-empty:        0 Wh
    energy-full:         69,06 Wh
    energy-full-design:  71,1 Wh
    energy-rate:         1,319 W
    voltage:             12,92 V
    percentage:          99%
    capacity:            96,6526%
    technology:          lithium-ion
    icon-name:          'battery-full-charged-symbolic'

@abcdw It looks like the error was caused by some upower output not matching "time to full" or "time to empty" in the way I've seen. Would you mind posting upower's output while a battery is discharging?

upower -i $(upower -e | grep 'BAT0')
  native-path:          BAT0
  vendor:               SANYO
  model:                45N1773
  serial:               331
  power supply:         yes
  updated:              Пн 30 ноя 2015 20:38:45 (51 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               discharging
    warning-level:       none
    energy:              16,86 Wh
    energy-empty:        0 Wh
    energy-full:         22,56 Wh
    energy-full-design:  23,2 Wh
    energy-rate:         0 W
    voltage:             11,355 V
    percentage:          74%
    capacity:            97,2414%
    technology:          lithium-ion
    icon-name:          'battery-full-symbolic'
upower -i $(upower -e | grep 'BAT1')
  native-path:          BAT1
  vendor:               LGC
  model:                45N1738
  serial:               2890
  power supply:         yes
  updated:              Пн 30 ноя 2015 20:41:51 (9 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               discharging
    warning-level:       none
    energy:              20,62 Wh
    energy-empty:        0 Wh
    energy-full:         69,06 Wh
    energy-full-design:  71,1 Wh
    energy-rate:         9,473 W
    voltage:             12,256 V
    time to empty:       2,2 hours
    percentage:          93%
    capacity:            96,6526%
    technology:          lithium-ion
    icon-name:          'battery-full-symbolic'
  History (charge):
    1448905311  93,000  discharging
  History (rate):
    1448905311  9,473   discharging

Thanks @abcdw; I'll dig into this after work tonight!

Thank you @hoelzro =)

@abcdw Alright, try again; hopefully I got it right this time!

It works well, thanks a lot 😃

Awesome, thanks for testing out the branch!