Support for multiple batteries
Closed this issue · 2 comments
pedrokost commented
My laptop has two batteries, BAT0 and BAT1 (Lenovo T440s). The battery recognition system of i3xrocks/battery
only takes the first battery (in my case the smaller one), which stays charged until the second, larger battery discharges.This makes the battery indicator very misleading.
I believe it would be better to do a weighted average of the battery percentages. Something like (BAT0.energy-full * BAT0.percentage + BAT1.energy-full * BAT1.percentage) / (BAT0.energy-full + BAT1.energy-full). Alternatitely, showing two battery icons would also be fine.
Some info:
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
❯ upower --show-info "/org/freedesktop/UPower/devices/battery_BAT0"
native-path: BAT0
vendor: LGC
model: 45N1113
serial: 8426
power supply: yes
updated: sob 10 okt 2020 23:50:56 (38 seconds ago)
has history: yes
has statistics: yes
battery
present: yes
rechargeable: yes
state: discharging
warning-level: none
energy: 14,94 Wh
energy-empty: 0 Wh
energy-full: 21,4 Wh
energy-full-design: 23,48 Wh
energy-rate: 10,904 W
voltage: 11,527 V
time to empty: 1,4 hours
percentage: 69%
capacity: 91,1414%
technology: lithium-ion
icon-name: 'battery-full-symbolic'
History (charge):
1602366656 69,000 discharging
History (rate):
1602366656 10,904 discharging
❯ upower --show-info "/org/freedesktop/UPower/devices/battery_BAT1"
native-path: BAT1
vendor: LGC
model: 45N1738
serial: 203
power supply: yes
updated: sob 10 okt 2020 23:51:31 (8 seconds ago)
has history: yes
has statistics: yes
battery
present: yes
rechargeable: yes
state: discharging
warning-level: low
energy: 3,48 Wh
energy-empty: 0 Wh
energy-full: 63,54 Wh
energy-full-design: 71,1 Wh
energy-rate: 13,0444 W
voltage: 11,011 V
time to empty: 16,0 minutes
percentage: 5%
capacity: 89,3671%
technology: lithium-ion
icon-name: 'battery-caution-symbolic'
pedrokost commented
Actually, it seems that "DisplayDevice" contains the combined information for all batteries:
upower --show-info "/org/freedesktop/UPower/devices/DisplayDevice"
power supply: yes
updated: ned 11 okt 2020 00:04:56 (81 seconds ago)
has history: no
has statistics: no
battery
present: yes
state: discharging
warning-level: none
energy: 16,18 Wh
energy-full: 84,94 Wh
energy-rate: 21,4314 W
time to empty: 45,3 minutes
percentage: 19,0487%
icon-name: 'battery-low-symbolic'
moritzheiber commented
This has been fixed in the mentioned PR.