Battery Indicator keeps showing charging

The battery indicator in system tray keeps showing charging even after the power cord has been unplugged. This seems to be a bug that has been around for a long time. Does anyone know how to fix it?

Distro: openSUSE Tumbleweed
Kernel: 6.5.9
Plasma: 5.27.9


Some screenshots may help me to explain the situation.

Screenshot_20231112_201023
The information it shows is wrong. It’s not plugged in.

I had a similar issue, which was fixed after a certain kernel version.

That applet reads power/battery status from powerdevil, which reads from upower, which reads from the kernel sysfs (/sys/class/power_supply).

Probably your laptop firmware’s kernel module reports wrong power status. You can run upower -d and cat /sys/class/power_supply/ACAD/online. See if the output makes sense.

Thanks for your reply! I did some upower -d and there are corresponding changes after plugging and unplugging the power supply. Funny thing is I actually found a solution now. However it’s to enroll a fingerprint and then set Plasma’s lock screen to unlock with the fingerprint according to openSUSE’s documentation, then the battery icon displays normal. And it’s reproducible.

For those who are also using openSUSE and are experiencing similar problems, this method may be useful. Link to set fingerprint: SDB:Using fingerprint authentication - openSUSE Wiki

The method I’ve already mentioned don’t always seem to work either. But now I have a clearer understanding of this issue. The upower daemon doesn’t always display properly:

Daemon:
daemon-version: 1.90.2
on-battery: no
lid-is-closed: no
lid-is-present: yes
critical-action: PowerOff

Above are the last few lines of upower -d after I’ve unplugged the power. It doesn’t show yes for on-battery, which is not normal.

The reason I’m putting this question on KDE’s forums is because I’ve never had this problem before with Gnome (same laptop). Now I’m guessing that maybe there is indeed something strange about my computer hardware, and I’ve seen that there are other’s experiencing this problem that seem to be using Dell laptops like me. But the reason why the Gnome shows normal is because it doesn’t show if it’s connected to power based on whether it’s on-battery or not (?) Rather, it just shows that the power has been disconnected because the battery is discharging, which can also be detected by KDE. So KDE displays strange messages like this: plugged in but still discharging.

This seems to be verified by another phenomenon, when I use a widget called Mac OSX Inline Battery, it displays correctly, perhaps because it detects it differently than the built-in battery applet that comes with KDE.

So perhaps the easiest solution now is to use another widget to show the power status.

When I run upower -m to monitor the battery status:

[22:04:40.691] device changed: /org/freedesktop/UPower/devices/battery_BAT0
[22:04:41.713] device changed: /org/freedesktop/UPower/devices/battery_BAT0
[22:04:41.713] device changed: /org/freedesktop/UPower/devices/battery_BAT0
[22:04:43.634] device changed: /org/freedesktop/UPower/devices/line_power_AC
[22:04:43.634] device changed: /org/freedesktop/UPower/devices/line_power_AC
[22:04:43.659] device changed: /org/freedesktop/UPower/devices/battery_BAT0
[22:04:43.659] device changed: /org/freedesktop/UPower/devices/battery_BAT0
[22:04:43.659] device changed: /org/freedesktop/UPower/devices/battery_BAT0

Under normal circumstances (which can be obtained briefly by restarting the computer without power connected), ‘daemon changed’ should be displayed between the lines when plugging in and unplugging. But it doesn’t show up here. So the problem should be that upower is unable to accurately detect the battery status of my computer.