bat Is a simple command line tool to easily set and check the ASUS battery charge stop threshold (for laptops that support this feature) to help extend battery life.
According to its wiki, bat aims to “copy the function ASUS battery healthy charging A utility program for ASUS laptops on Windows designed to extend battery life”.
I have introduced how to limit battery charging (set charging threshold) for ASUS laptops on Linux, but with this tool, you will be able to easily change the charging threshold, reset it, and view the current charging threshold level. Bat can also print the current battery power and charging status.
Behind the scenes, bat uses the systemd service to keep the battery charge threshold level constant after restarting and waking up from sleep. To use bat, you need systemd 244 or newer (eg Ubuntu 20.04 and newer, Debian Bullseye and Sid, Fedora 32 or newer, openSUSE Leap 15.3, etc.), Bash and at least Linux 5.4, but for some newer ASUS laptops You will need an updated kernel (more on this in the link below).
For more details, check out my initial article on limiting battery charging in ASUS laptops.I also recommend to follow the initial steps in this article (do not create a systemd service; if so, stop and use
sudo systemctl stop battery-charge-threshold; sudo systemctl disable battery-charge-threshold ) To ensure that your ASUS laptop actually supports restricting battery charging on Linux. Not all ASUS laptops support setting the battery charging threshold, so depending on your ASUS laptop model, this may or may not be appropriate; there is no list of supported devices that I can find.
[[Edit]]This may not work properly after resuming from suspend in some cases (the charging threshold is not set) (currently only reported on Ubuntu).error report Here .
You might also like: 3 tools to display battery information on Linux laptops from the command line
Install and use bat on Linux to limit battery charging of ASUS laptops
To use bat, first install the binaries available on it GitHub release page . Download the file named “bat” and place it in your home folder.Then open a terminal and install it to
/usr/local/bin Use the following command:
sudo install bat /usr/local/bin
If you already have a binary file named bat (e.g. bat ), rename bat to another name.
To use bat to display the current charging threshold limit, use
If you have never set the battery charge threshold, this command should output “100”, indicating that the battery will be fully charged.
To use bat to set the battery charging stop threshold, use:
sudo bat -t <CHARGE_THRESHOLD>
For example, to only charge the laptop battery to 60% and then stop charging, use:
sudo bat -t 60
By default, this new battery charge threshold is only used for the current session and is reset when the system is restarted.To make the changes permanent, use
sudo bat -p
If you want to restore this, and only use the current fee threshold for the current session (to prevent it from persisting after the system restarts), use
sudo bat -r
If you want to get rid of any battery charging threshold and let the ASUS laptop fully charge (to 100%), just use the following command to set the threshold back to 100:
sudo bat -t 100
bat can also display the current battery level (
--capacity ), and print the charging status (
You may also be interested: How to embed the numeric keyboard into the touchpad of some ASUS laptops to work on Linux