Browse Source

Add set-battery-charge-threshold systemd service

Bryan Roessler 8 months ago
parent
commit
bc4f6d5e3c
1 changed files with 14 additions and 0 deletions
  1. 14 0
      set-battery-charge-threshold.service

+ 14 - 0
set-battery-charge-threshold.service

@@ -0,0 +1,14 @@
+[Unit]
+Description=Set battery charge thresholds
+After=multi-user.target
+StartLimitBurst=0
+
+[Service]
+Type=oneshot
+Restart=on-failure
+RemainAfterExit=yes
+ExecStart=/bin/bash -c 'echo 80 > /sys/class/power_supply/BAT0/charge_control_start_threshold; echo 90 > /sys/class/power_supply/BAT0/charge_control_end_threshold'
+ExecStop=/bin/bash -c 'echo 100 > /sys/class/power_supply/BAT0/charge_control_end_threshold; echo 99 > /sys/class/power_supply/BAT0/charge_control_start_threshold'
+
+[Install]
+WantedBy=multi-user.target