Skip to content
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

The blocklet battery-poly isn't working #448

Open
bound-variable opened this issue Feb 5, 2022 · 2 comments
Open

The blocklet battery-poly isn't working #448

bound-variable opened this issue Feb 5, 2022 · 2 comments

Comments

@bound-variable
Copy link

Actual behavior

It doesn't appear in the bar.

i3blocks config relevant to blocklet(s)

(The default)

[battery-poly]
command=$SCRIPT_DIR/battery-poly
LABEL=BAT
interval=5

Output of blocklet(s) when run from command line

Traceback (most recent call last):
  File "/home/alan/.config/i3blocks/scripts/./battery-poly", line 170, in <module>
    main()
  File "/home/alan/.config/i3blocks/scripts/./battery-poly", line 166, in main
    print_status(get_configuration())
  File "/home/alan/.config/i3blocks/scripts/./battery-poly", line 81, in get_configuration
    get_current_charge(bat_name),
  File "/home/alan/.config/i3blocks/scripts/./battery-poly", line 112, in get_current_charge
    return int(Path(f"{PSEUDO_FS_PATH}{bat_name}/{CURRENT_CHARGE_FILENAME}").open().read().strip())
  File "/usr/lib/python3.10/pathlib.py", line 1117, in open
    return self._accessor.open(self, mode, buffering, encoding, errors,
FileNotFoundError: [Errno 2] No such file or directory: '/sys/class/power_supply/BAT0/energy_now'

Output of any relevant other commands that might help diagnostics

python 3.10.2-1
sysfsutils 2.1.1-1

@schwukas
Copy link

Not really the blocklet's fault. It just tries to read the file /sys/class/power_supply/BAT0/energy_now which doesn't seem to be available on your system. Not sure why.

Post the output of ls -la /sys/class/power_supply so I can try some debugging.

@bound-variable
Copy link
Author

bound-variable commented Mar 16, 2023

I don't run this anymore, but I don't mind following up.

Here's the output of the command you asked for:

total 0
drwxr-xr-x  2 root root 0 Mar 16 05:47 .
drwxr-xr-x 73 root root 0 Mar 16 05:47 ..
lrwxrwxrwx  1 root root 0 Mar 16 05:47 AC -> ../../devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0003:00/power_supply/AC
lrwxrwxrwx  1 root root 0 Mar 16 05:47 BAT0 -> ../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0

And inside of BAT0 I don't have energy_now, I have instead charge_now. My directory listings:

device
hwmon2
power
subsystem
alarm
capacity
capacity_level
charge_full
charge_full_design
charge_now
current_now
cycle_count
manufacturer
model_name
present
serial_number
status
technology
type
uevent
voltage_min_design
voltage_now

By the way, I personally use cat /sys/class/power_supply/BAT0/capacity to read my battery's charge level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants