Posts: 347
Silent Observer
Joined: 08 Aug 2013
#1
I'm not certain this shouldn't be in the Hardware section, but it's (initially, at least) a problem with getting conky to display my battery state (Pentium II laptop ca. 1997, antiX 13.2 testing updated an hour ago, 3.13-0.bpo.1-486 kernel, fluxbox); long term, I'd like to set something up that will shut down the system before the battery gets so low it produces an unclean halt (say, 10-15% capacity), to prevent future reinstalls if I have another unplugged adapter incident or prolonged power failure. I've been able to boot without killing acpi (previously required by a spurious over temperature report during start) since my antiX reinstall a few days ago, and I've added the following line to my ~/.conkyrc:

Code: Select all

${color}Power: ${color}$acpiacadapter, ${color}Battery: ${battery_percent BAT0}% 
I know the acpi is reporting, because this correctly detects and reports the connection state for the AC adapter, but any reasonable value for battery number (BAT0, BAT1, blank) reports 0% battery charge. I know there's hardware, present and working, that detects the battery state correctly, because the laptop has a hardware status display that shows the battery charge (like the battery bars on a modern cellular phone) along with adapter state, HDD and CD-ROM activity, cap-lock and num-lock status. The documentation with ~/.conkyrc is a little sparse, while the man page is book-length; what other values could I try to get a battery state display that's actually reading my battery state (and hence will be a clue toward finding a battery monitor daemon that can shut down the system before it mucks up my OS)?
Last edited by Silent Observer on 25 May 2014, 14:07, edited 1 time in total.
Posts: 347
Silent Observer
Joined: 08 Aug 2013
#2
Silent Observer wrote:

Code: Select all

${color}Power: ${color}$acpiacadapter, ${color}Battery: ${battery_percent BAT0}% 
Found it! A dozen or so pages into the man"page" for conky, I found documentation for the acpiacadapter object, which clued me to look at /sys/class/powersupply, in which I found symlinks named AC (obvious) and CMB1. Inserting CMB1 in place of BAT0 above gives an accurate reading of battery state in the conky lists. Hence:

Code: Select all

${color}Power: ${color}$acpiacadapter, ${color}Battery: ${battery_percent CMB1}% 
Part one of this problem is solved; I'll mark this thread the same way and start a new one looking for suggestions for a utility that can monitor CMB1 and shut down the system before the battery goes flat.
Posts: 1,062
Dave
Joined: 20 Jan 2010
#3
Iirc you can find your bat id in / proc. However it has been a while since I have set up conky from scratch, so I'm going to post a link from Google that looks similar to what I have done in the past. There is also some posts on the forum here that shows conky configurations that display warning scripts and shutdown the computer when low using conky exec lines... but none of that will work without conky displaying battery... so


========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"http://crunchbang.org/forums/viewtopic.php?id=12688"
linktext was:"http://crunchbang.org/forums/viewtopic.php?id=12688"
====================================
Posts: 347
Silent Observer
Joined: 08 Aug 2013
#4
Dave, I do have conky displaying the battery state now; I'll take a look for conky setups that could potentially run a script when the battery is below, say, 10%. If that'll do the job for me, I won't have to mess with installing another monitor (a good thing, with limited space, RAM, and a slow CPU).