NetBSD 11 introduced new battery controls for thinkpads (I can’t actually find them documented properly, I just stumbled across them because of this post). On their own I don’t think they are that useful, i.e. I can set these in /etc/sysctl.conf:

hw.acpi.thinkpad0.bat0.charge_start=75
hw.acpi.thinkpad0.bat0.charge_stop=80
hw.acpi.thinkpad0.bat1.charge_start=75
hw.acpi.thinkpad0.bat1.charge_stop=80

But this just means whenever I unplug it I’m already at 80% battery and even with two of the things I only get about three and a half hours usage from that point. So instead I’m trying to eek out a bit more and mimicking the “optimised battery charging” approach and using those in combination with a crontab entries of:

0       7       *       *       *       /sbin/sysctl -w hw.acpi.thinkpad0.bat0.charge_start=85 hw.acpi.thinkpad0.bat1.charge_start=85 hw.acpi.thinkpad0.bat0.charge_stop=95 hw.acpi.thinkpad0.bat1.charge_stop=95
0       8       *       *       *       /sbin/sysctl -w hw.acpi.thinkpad0.bat0.charge_start=75 hw.acpi.thinkpad0.bat1.charge_start=75 /sbin/sysctl -w hw.acpi.thinkpad0.bat0.charge_stop=80 hw.acpi.thinkpad0.bat1.charge_stop=80

I.e. so overnight when plugged in it’ll charge to 80% and sit at that until the morning when it’ll then charge up to 95%. I can adjust those times to suit. I’m probably not unplugging it that early in the morning, I’ll just be sat in front of it plugged in. So I might push those out by a couple of hours. This does mean this is only a one-shot kind of thing - if I re-plug it in in the daytime it’ll just charge to 80%, but that’s fair enough.

I did wonder if instead of using a second crontab entry to drop back down to 80 whether I could make use of /etc/powerd/scripts/sensor_battery, but the batteries don’t seem to have default entries for warning-capacity, high-capacity, etc and I would need to figure out setting those via envstat which seems more hassle than it’s worth if a simple cron entry does the trick.