i3pystatus
i3pystatus copied to clipboard
Battery displaying incorrect information when fully charged.
When my laptop is plugged in and fully charged, the battery status displays as "Battery Checker: CHARGE_NOW". As soon as the power supply is unplugged, it displays the correct discharging value. When plugged back in, the status will display as FULL for a few seconds before changing colour to BatteryChecker: 'CHARGE_NOW' indefinitely.
- Which i3pystatus version?
- If git, any errors logged in
~/.i3pystatus-<pid>
?
- If git, any errors logged in
- What does
cat /sys/class/power_supply/BAT0/uevent
say? - Laptop make / model?
Same issue here.
- i3pystatus version 3.33
- Laptop Dell XPS 15
-
/sys/class/power_supply/BAT1/uevent
says:
POWER_SUPPLY_NAME=BAT1
POWER_SUPPLY_STATUS=Full
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11370000
POWER_SUPPLY_VOLTAGE_NOW=12782000
POWER_SUPPLY_ENERGY_FULL_DESIGN=91000000
POWER_SUPPLY_ENERGY_FULL=89210000
POWER_SUPPLY_ENERGY_NOW=89210000
POWER_SUPPLY_CAPACITY=100
POWER_SUPPLY_CAPACITY_LEVEL=Full
POWER_SUPPLY_MODEL_NAME=PABAS0241231
POWER_SUPPLY_MANUFACTURER=Simplo
POWER_SUPPLY_SERIAL_NUMBER=41167
Note the absence of POWER_SUPPLY_POWER_NOW
. Right after plugin the AC back, this value is present and set to 0. i3pystatus then displays correct info. This value then quickly vanishes and i3pystatus says BatteryChecker: 'CHARGE_NOW'
.
FYI, ~/.i3pystatus-$pid is full of:
> Exception in Thread-4 at Fri 03 Jul 2015 03:20:25 PM CEST, module BatteryChecker
Traceback (most recent call last):
File "/usr/lib/python3.4/site-packages/i3pystatus/core/threading.py", line 68, in __call__
self.workload()
File "/usr/lib/python3.4/site-packages/i3pystatus/core/modules.py", line 158, in __call__
self.run()
File "/usr/lib/python3.4/site-packages/i3pystatus/battery.py", line 249, in run
batteries.append(Battery.create(path))
File "/usr/lib/python3.4/site-packages/i3pystatus/battery.py", line 35, in create
return BatteryCharge(battery_info)
File "/usr/lib/python3.4/site-packages/i3pystatus/battery.py", line 65, in __init__
bi["CHARGE_FULL"] = bi["CHARGE_FULL_DESIGN"] if bi["CHARGE_NOW"] > bi["CHARGE_FULL"] else bi["CHARGE_FULL"]
KeyError: 'CHARGE_NOW'
An estimate is a bit hard for these batteries (since they don't give current power or current consumption, although we could differentiate ENERGY/CHARGE_NOW numerically), but it shouldn't crash. I'll look into it.
When battery is charging/discharging, everything is OK. It is just when AC is plugged and battery is fully charged that this value disappears. Shouldn't we thus assume "no value" means "fully charged"?
I mean I can't figure out whether this value should be present in /sys
– this would thus be a battery
module bug – or if it can be absent – this would thus be a i3pystatus bug.
Ok, I'll look into it again
Alright, I just ran into this and managed to track it down.
As shown by the above uevent example, POWER_NOW can disappear when the battery is fully charged. This causes Battery.create
to use BatteryCharge
in place of BatteryEnergy
which means all the CHARGE_*
keys don't exist.
@belak would you have a fix for this?
I'm also getting the output BatteryChecker: Keyerror: 'CHARGE_NOW'
.
I'm not sure if it's the same bug, or something similar but not quite the same.
$ cat /sys/class/power_supply/BAT1/uevent
POWER_SUPPLY_NAME=BAT1
POWER_SUPPLY_STATUS=Full
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Unknown
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_VOLTAGE_NOW=10000000
POWER_SUPPLY_ENERGY_FULL_DESIGN=50000000
POWER_SUPPLY_ENERGY_FULL=50000000
POWER_SUPPLY_ENERGY_NOW=50000000
POWER_SUPPLY_CAPACITY=100
POWER_SUPPLY_CAPACITY_LEVEL=Full
POWER_SUPPLY_MODEL_NAME=VMware Virtual Battery
POWER_SUPPLY_MANUFACTURER=
POWER_SUPPLY_SERIAL_NUMBER=
Hello guys. Any update on the issue?
Me too, getting the output BatteryChecker: Keyerror: 'CHARGE_NOW'
And this issue is already 4 years old. So yeah - any updates?
I moved away from i3/i3pystatus so can't say. Sorry.
I've never seen this bug, and I haven't worked on this code before, but it seems like the POWER_SUPPLY_STATUS line of the uevent file would be more reliable to determine whether or not the battery is currently charging, than relying on POWER_SUPPLY_POWER_NOW.
❯ grep POWER_SUPPLY_STATUS /sys/class/power_supply/BAT0/uevent
POWER_SUPPLY_STATUS=Charging