Skip to content

Instantly share code, notes, and snippets.

@sebastianwagner
Created August 4, 2023 17:39
Show Gist options
  • Save sebastianwagner/6425949604824cfa800918e163c0b6ef to your computer and use it in GitHub Desktop.
Save sebastianwagner/6425949604824cfa800918e163c0b6ef to your computer and use it in GitHub Desktop.

battery charge threshold

macsmc-battery selects different values anyways but those seem close enough.

install

sudo cp battery-charge-threshold-start.service battery-charge-threshold.service /etc/systemd/system/

enable

sudo systemctl enable battery-charge-threshold-start.service
sudo systemctl enable battery-charge-threshold.service
sudo systemctl start battery-charge-threshold-start.service
sudo systemctl start battery-charge-threshold.service
[Unit]
Description=Set the battery charge threshold start
After=multi-user.target
StartLimitBurst=0
[Service]
Type=oneshot
Restart=on-failure
ExecStart=/bin/bash -c 'echo 65 > /sys/class/power_supply/macsmc-battery/charge_control_start_threshold'
[Install]
WantedBy=multi-user.target
[Unit]
Description=Set the battery charge threshold
After=multi-user.target
StartLimitBurst=0
[Service]
Type=oneshot
Restart=on-failure
ExecStart=/bin/bash -c 'echo 83 > /sys/class/power_supply/macsmc-battery/charge_control_end_threshold'
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment