Battery control

Hi I’m new to Fedora (and Linux).

A few days ago I was looking for a way to control the charging percentage of my laptop (Acer Spin 3, single Fedora Boot), something like the default system controller to limit the charging to, lets say, 80%.

I tried several bash scripts I found on Google but they didn’t worked, actually the last one disabled the wifi and bluetooth and have had to recover from a previous system image.

Is there a safety way to control the battery charge level?

Thanks in advance…

Theoretically, one can limit the charging percentage with the known methods such as via upower, but they don’t work on all laptops. I also have an Acer, and I could not get it to work, but it does on my Samsung.

You should include the scripts you used so we know what you have tried.

Hi again. Today I came to know that there is a bash history file on Linux, a great discovery for me. As I told in the first message I’m new to Fedora and bash scripting…

Well I could recover the commands I used trying to set de battery charge limit that broke my WiFi and Bluetooth. This is all the sequence of commands I used.

cat /sys/power/mem_sleep
sudo nano /etc/default/grub
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
sudo dnf update power-profiles-daemon
sudo dnf install power-profiles-daemon
sudo dnf install tlp tlp-rdw
sudo nmcli c modify MyNetwork 802-3-ethernet.wake-on-lan ignore
upower -i /org/freedesktop/UPower/devices/battery_BAT0
sudo systemctl mask tuned.service
sudo systemctl enable --now tlp.service
sudo systemctl unmask tuned.service
sudo systemctl enable --now tlp-pd.service
sudo systemctl disable --now power-profiles-daemon
sudo systemctl mask power-profiles-daemon
sudo systemctl disable --now tuned
sudo systemctl mask tuned
sudo dnf install --allowerasing tlp tlp-rdw
sudo systemctl enable --now tlp

I hope this will be useful. Cheers.

This worked on my Acer Aspire 15 Go.

Initially I did it without the DKMS stuff as I also had an issue with the MT7902 wifi driver, so had locked my kernel version to the one which was active when I did the fiddling. I’ve since gone back to running full upgrades including kernel from 7.2 onwards, and found I had to run the command in the section headed “Running the command below configures the module to always load with the enable_health_mode=1 parameter on boot.” to set it again after I ran a full upgrade for the first time, but since then the charging limit has stayed set to 80% with no further action required from me. Hope this helps.

TLP does aggressive power management. if i remember, it puts wireless USB and PCI devices to low power state, which might cause WIFI and bluetooth errors.