-
Notifications
You must be signed in to change notification settings - Fork 434
[Bug] battery.status gives an error. #743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @Samuel-de-Oliveira ! Does this device have a battery? |
Yes, it actually has. About the device:
I hope this usefully. |
Ok, since looks like we're unable to convert the output into a valid value, and I can't reproduce on my side, can you manually read the output from a console? See: https://github.com/kivy/plyer/blob/master/plyer/platforms/linux/battery.py for the actual implementation. |
Well, what I got in console is this: so I tried to do something and I remove (commented) this following lines: percentage = float(
percentage.replace(',', '.')
) and i Got this: then I concluded that the library doesn't identify my laptop battery. I've tried solve it by myself but I don't have any idea what to do. |
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have the means to take action. Please reach out if you have or find the answers we need so that we can investigate further. |
I think I know why @Samuel-de-Oliveira gets the I checked the source code and it seems BAT0 is hardcoded to be the default battery for Linux platforms. However, for some distribution this is not the case, it seems Arch Linux is one of this distros (at least for me). This is the line that gives that hardcodes the problem. A similar issue was raise for psutil and it got fixed. I have the same problem in my Arch Linux system, and if I check the primary battery with ❯ upower -e
/org/freedesktop/UPower/devices/battery_BAT1
/org/freedesktop/UPower/devices/line_power_ACAD
/org/freedesktop/UPower/devices/DisplayDevice If I forcefully check BAT0, it seems to exist but ❯ upower -i /org/freedesktop/UPower/devices/battery_BAT0
native-path: (null)
power supply: no
updated: Thu 01 Jan 1970 01:00:00 BST (1744376463 seconds ago)
has history: no
has statistics: no
unknown
warning-level: unknown
battery-level: unknown
percentage: 0% (should be ignored)
icon-name: '(null)' While if check BAT1, then you can see it's the primary battery. ❯ upower -i /org/freedesktop/UPower/devices/battery_BAT1
native-path: BAT1
....
power supply: yes
updated: Fri 11 Apr 2025 14:00:52 BST (8 seconds ago)
has history: yes
has statistics: yes
battery
present: yes
rechargeable: yes
state: discharging
warning-level: none
energy: 27.653 Wh
energy-empty: 0 Wh
energy-full: 33.532 Wh
energy-full-design: 41.4279 Wh
energy-rate: 7.7355 W
voltage: 11.984 V
charge-cycles: 701
time to empty: 3.6 hours
percentage: 82%
capacity: 80.9405%
technology: lithium-ion
charge-start-threshold: 75%
charge-end-threshold: 80%
charge-threshold-supported: yes
icon-name: 'battery-full-symbolic'
History (charge):
1744376380 82.000 discharging
History (rate):
1744376452 7.736 discharging
1744376440 7.575 discharging
1744376410 7.438 discharging
1744376380 8.114 discharging
1744376350 7.266 discharging @misl6 I am comfortable to start working on this issue, could you please reopen it? |
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have the means to take action. Please reach out if you have or find the answers we need so that we can investigate further. |
Is in title, for any reason when I write
battery.status
the following error appears:Edit: I'm using Arch Linux
The text was updated successfully, but these errors were encountered: