What Battery monitor do you recommend?

Forum Forums New users New Users and General Questions What Battery monitor do you recommend?

  • This topic has 12 replies, 7 voices, and was last updated Dec 2-8:32 pm by DaveW.
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #13732
    Member
    DaveW

      Hi,
      Please forgive, if this is a duplicate. I posted this topic. But after making an edit, it disappeared.

      I’m running Antix 17 on an eeepc 900. It has a new 6600 mah battery, which keeps it going for a few hours. But, I would like more detail from a battery monitor.

      At present, there is an graph bar icon on the right end of the bottom bar. It is green when charging, and yellow when discharging. (I don’t know what program drives this indicator. With Left or right click on icon, there is no popup info.) I also configured Conky to show battery status (charge/discharge, and percentage). Both show battery charge in 10% increments, until below 10%, when it goes to 1% increments.

      I don’t know what program does the actual monitoring. The system includes acpid (but not acpi, apm, or upower).

      I did install yacpi, which also reads in 10% increments. But it runs in a terminal window, and apparently must be polled periodically. So it is not a continual monitor.

      Questions:
      1. With the present system, is there a way to reconfigure, for 1% charge increments?
      2. With the present system, is there a way to set a low battery alarm? (The eeepc seems to have a hardware alarm… an LED blinks when below 20% charge. But I haven’t found a way to set the limits.)

      3. What Battery monitor do you recommend? Conky provides all the monitoring I need… except for more detail on the battery. So, I would avoid a monitor that depends on a whole suite of software.

      Thanks, Dave

      #13734
      Anonymous
        #13736
        Anonymous
          Helpful
          Up
          0
          ::

          if you install the debian “acpi” package (its payload is only 46kb) and, test, from the commandline: acpi -b
          you’ll see that it does provide suitably granular reporting of remaining battery percent.
          This granular output can be put to use into the battery-related line of your .conkyrc
          execi 500. . .blablah Batt: . . . acpi -b | grep -P -o ‘[0-9]+(?=%)’ . . . pct

          For an audio alarm, a l’il bash script can handle the task. If you already have a long-running bash script (runs all session long), can avoid the overhead of spawning an additional shell for the new alarm script by including this snippet within that existing script.

          #!/usr/bin/env bash
          while true
          do
              battery_level="acpi -b | grep -P -o '[0-9]+(?=%)'"
              if [ $battery_level -le 15 ]; then                  ### whatever threshhold you prefer
                  mpv /home/demo/myaudio_file.ogg
              fi
              sleep 300              ### 300sec, aka 5 minutes
          done

          checking here (this is applicable to our conky version?) http://conky.sourceforge.net/variables.html
          conky may natively be able to display: battery, battery_short, battery_percent, battery_bar, battery_time

          #13738
          Forum Admin
          Dave
            Helpful
            Up
            0
            ::

            You could also execute the core line of that script via conky. However to avoid it playing on every conky refresh every second you would likely have to play with it a bit more.

            Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown

            #13741
            Forum Admin
            rokytnji
              Helpful
              Up
              0
              ::

              Taskbar or Fluxbox slit I use batti-gtk. Works in JWM Taskbar also. xbattery is OK also.

              https://antixlinux.com/forum-archive/batti-gtk-solved-t4662.html

              Battery line in Conky on this laptop has

              ${execi 1000 acpi 2>/dev/null | grep -q . && echo "Batt: "}${execi 10 acpi -b 2>/dev/null | cut -d" " -f3,4 | sed 's/,$//'}

              Misc ref:
              https://antixlinux.com/forum-archive/battery-monitor-solved-t4968.html

              Sometimes I drive a crooked road to get my mind straight.
              Not all who Wander are Lost.
              I'm not outa place. I'm from outer space.

              Linux Registered User # 475019
              How to Search for AntiX solutions to your problems

              #13746
              Member
              DaveW
                Helpful
                Up
                0
                ::

                Wow! Thank you all for your quick response.

                I have looked in to several of the suggested ideas. I have installed acpi and upower.
                I also modified conkyrc to present battery charge level with color coded bar graph (copied the script give by Dave in https://antixlinux.com/forum-archive/batti-gtk-solved-t4662-s15.html

                I might give batti a try, if I can find it.

                Skidoo – For me, acpi is showing 10% steps. and also says rate information unavailable. upower also reports in 10% steps.
                Perhaps there are config files somewhere, where the acpi or upower resolution can be adjusted?

                The conky bar is set to turn red below 15%. But with 10% steps, it must get down to 10%.

                Thank you all.

                #13748
                Moderator
                BobC
                  Helpful
                  Up
                  0
                  ::

                  I run xbattbar. I modified xbattbar to improve the output for conky to grab. I also have a script to popup and sound a low battery warning, which was an idea fron Dave.

                  If you search for xbattbar you can see my setup and that mroot originally posted the idea.

                  https://www.antixforum.com/forums/search/xbattbar/

                  • This reply was modified 4 years, 5 months ago by BobC.
                  • This reply was modified 4 years, 5 months ago by BobC.
                  #13764
                  Member
                  DaveW
                    Helpful
                    Up
                    0
                    ::

                    BobC – Thanks for the xbattbar info. It looks like it provides similar info as the existing icon on my Taskbar… although you have configured xbattbar to trigger alarms.

                    I guess I would be satisfied with the Conky color bar graph… if acpi would read in 1% increments. (Perhaps the 10% steps are a limitation of the eeepc?) The color change is sufficient alarm (no audio needed).

                    Of course, Conky is sometimes covered by open windows. So, the small battery icon in the Taskbar is a backup.
                    Does anyone know what program is behind that icon… and whether it might be configurable (eg., for color change at low level)?
                    So far, all I know is that it is toggled on or off by a line in the Preferences file (TaskBarShowAPMAuto=1).

                    Also, do you know what config file might set the alarm level for the existing low battery warning LED (adjacent to keyboard, not on screen)?

                    The eeepc bios settings are pretty minimal. Unless I missed something, it looks like Power Monitoring is either on or off.

                    #13766
                    Moderator
                    BobC
                      Helpful
                      Up
                      0
                      ::

                      DaveW, With minimal apps running, why not go to a terminal, and type

                      sudo ps_mem.py -s

                      and paste what it says here so we can see what programs are currently running if you aren’t sure.

                      My lowbattery alarm is running from a script, run from the conky, not from xbattbar. My mod to xbattbar was to provide better output to a log file /tmp/xbattbar.log that could be parsed by the conky-battery.sh script without needing to focus the mouse over the bar. I sent the revised code to the maintainer, asking for him to consider including it, but never got a reply, I don’t think.

                      PS: I am not a Linux coder, so my code is not likely optimal, lol, and I’m open to constructive criticism if it shows me how it should be done better.

                      From the .conkyrc

                      ${color2}Batt: ${color}${battery_short BAT0}-${execi 10 conky-battery.sh}\
                      ${if_match "${battery_short BAT0}" >= "D"}${if_match "${battery_short BAT0}" < "E"}${if_match ${battery_percent BAT0} <= 33}\
                      ${if_match ${battery_percent BAT0} >= 1}${execi 10 lowbattery}${endif}${endif}${endif}${endif}

                      The conky-battery.sh script

                      #!/bin/bash
                      
                      # conky-battery.sh - build battery string to return to conky
                      #   can't pass parm from conky, so get status byte from acpi -b (should be same as 1st char of battery_short), nothing comes back if not present
                      
                      # requires: acpitool, xbattbar
                      
                      # BobC - bcurrey99 at yahoo.com
                      
                      FILE='/home/bobc/.conky-battery.tmp'
                      DFILE='home/bobc/.conky-battery_debug.tmp'
                      if [ -f $FILE ]; then
                      	printf "File $FILE exists." > $DFILE
                      else
                      	printf "File $FILE does not exist." > $DFILE
                      fi
                      today=<code>date '+%Y_%m_%d__%H_%M_%S'</code>;
                      printf "conky-battery.sh, Run $today \n" >> $DFILE
                      OUTPUT="$(acpi -b | tr '\n' ' ' | sed -e 's/Battery 0: //g')"
                      printf $OUTPUT >> $DFILE
                      STATUS1="$(acpi -b | tr '\n' ' ' | sed -e 's/Battery 0: //g' | cut -c1-1)"
                      if [[ -z "STATUS1" ]]; then
                      	STATUS1=N
                      fi
                      printf "STATUS1 =$STATUS1 \n" >> $DFILE
                      #C is displayed instead of charging, D for discharging, F for full, N for not present, E for empty and U for unknown
                      case $STATUS1 in
                      	F|E|U )
                      		printf "acpi bi output =" >> $DFILE
                      		acpi -bi | tr '\n' ' ' | sed -e 's/Battery 0://g' -e 's/, rate information unavailable//' -e 's/ Full, //' -e 's/ full / /' \
                      			-e 's/ design //' -e 's/last capacity //' -e 's/ capacity / = /' -e 's/100% =/Full, Cap/' -e 's/mAh,/mAh, Last Full/' \
                      			-e 's/Discharging,/Draining,/' > $FILE
                      		printf "" >> $DFILE
                      		;;
                      	N )
                      		printf "No Battery" > $FILE
                      		;;
                      	* )
                      		printf "xbattbar output =" >> $DFILE
                      		tail -n 1 /tmp/xbattbar.log | sed -e 's/^.*\(line\:.*min\.\).*$/\1/' -e 's/line\: //' > $FILE
                      		printf "" >> $DFILE
                      		;;
                      esac
                      cat $FILE >> $DFILE
                      cat $FILE
                      

                      The lowbattery script

                      #!/bin/bash
                      
                      # lowbattery - sends noisy error if battery low with option to shut down
                      
                      # Idea (probably code too) came from Dave at antix - BobC - bcurrey99 at yahoo.com
                      
                      play /usr/share/sounds/error.wav
                      play /usr/share/sounds/error.wav
                      play /usr/share/sounds/error.wav
                      
                      MESSAGE="The System Battery is Extremely low! Shut Down Now?"
                      TITLE="BATTERY EXTREMELY LOW!"
                      
                      FLAG_FILE="/tmp/batterylow"
                      
                      if [ ! -f $FLAG_FILE ]; then
                      	touch $FLAG_FILE
                      	yad --image='error' --text="$MESSAGE" #--button='ok:0' --button='cancel:1'
                      	case $? in
                                  0)    rm $FLAG_FILE && desktop-session -s    ;;
                                  1)    rm $FLAG_FILE && exit                  ;;
                                  *)    echo "Not an option" && exit                ;;
                      	esac
                      fi
                      • This reply was modified 4 years, 5 months ago by BobC.
                      • This reply was modified 4 years, 5 months ago by BobC.
                      #13770
                      Member
                      DaveW
                        Helpful
                        Up
                        0
                        ::

                        BobC – Thank you for the code for your xbattbar. I’ll work through it… and may do little experimentation.

                        Meanwhile, as you suggested… Here is what’s running. I understand some of it… but I don’t see whatever monitors the battery.

                        root@antix-eeepc:/home/my3epc# ps_mem.py -s
                        Private + Shared = RAM used Program

                        124.0 KiB + 43.0 KiB = 167.0 KiB /usr/sbin/ifplugd -i eth0 -q -f -u0 -d10 -w -I
                        136.0 KiB + 49.5 KiB = 185.5 KiB gnome-pty-helper
                        116.0 KiB + 83.5 KiB = 199.5 KiB /sbin/getty 38400 tty5
                        112.0 KiB + 88.5 KiB = 200.5 KiB /sbin/getty –noclear 38400 tty1
                        112.0 KiB + 91.5 KiB = 203.5 KiB /sbin/getty 38400 tty3
                        164.0 KiB + 41.0 KiB = 205.0 KiB /usr/sbin/acpid
                        124.0 KiB + 83.5 KiB = 207.5 KiB /sbin/getty 38400 tty2
                        168.0 KiB + 41.0 KiB = 209.0 KiB /usr/sbin/gpm -m /dev/input/mice -t exps2
                        116.0 KiB + 101.5 KiB = 217.5 KiB /sbin/getty 38400 tty6
                        124.0 KiB + 103.5 KiB = 227.5 KiB /sbin/getty 38400 tty4
                        192.0 KiB + 39.5 KiB = 231.5 KiB /usr/bin/icewm-session
                        248.0 KiB + 63.5 KiB = 311.5 KiB init [5]
                        84.0 KiB + 262.5 KiB = 346.5 KiB avahi-daemon: chroot helper
                        256.0 KiB + 108.5 KiB = 364.5 KiB /usr/sbin/cron
                        316.0 KiB + 120.0 KiB = 436.0 KiB dbus-launch –autolaunch 7827a888d6d3eac5755e3eb63c319158 –binary-syntax –close-stderr
                        176.0 KiB + 260.5 KiB = 436.5 KiB /bin/bash /home/my3epc/.desktop-session/startup
                        236.0 KiB + 241.0 KiB = 477.0 KiB /usr/bin/dbus-daemon –fork –print-pid 5 –print-address 7 –session
                        184.0 KiB + 302.5 KiB = 486.5 KiB avahi-daemon: running [antix-eeepc.local]
                        348.0 KiB + 152.0 KiB = 500.0 KiB /sbin/rpcbind -w
                        464.0 KiB + 48.0 KiB = 512.0 KiB /usr/sbin/rpc.idmapd
                        344.0 KiB + 226.0 KiB = 570.0 KiB /usr/bin/udevil –monitor
                        376.0 KiB + 230.5 KiB = 606.5 KiB /usr/bin/dbus-daemon –system
                        520.0 KiB + 328.5 KiB = 848.5 KiB /bin/bash /usr/bin/devmon –exec-on-drive desktop-defaults-run -fm “%d” –exec-on-disc desktop-defaults-run -fm “%d”
                        488.0 KiB + 379.0 KiB = 867.0 KiB /usr/lib/i386-linux-gnu/gconf/gconfd-2
                        572.0 KiB + 386.5 KiB = 958.5 KiB /bin/bash /usr/local/bin/desktop-session
                        804.0 KiB + 245.5 KiB = 1.0 MiB /usr/bin/gnome-keyring-daemon –daemonize –login
                        840.0 KiB + 219.5 KiB = 1.0 MiB /sbin/rpc.statd
                        1.1 MiB + 67.5 KiB = 1.1 MiB udevd –daemon
                        804.0 KiB + 381.0 KiB = 1.2 MiB icewmbg
                        1.2 MiB + 37.5 KiB = 1.2 MiB /sbin/dhclient -4 -v -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases -I -df /var/lib/dhcp/dhclient6.eth0.leases eth0
                        880.0 KiB + 456.5 KiB = 1.3 MiB icewmtray –notify
                        1.3 MiB + 83.0 KiB = 1.4 MiB /usr/sbin/rsyslogd
                        820.0 KiB + 704.5 KiB = 1.5 MiB /usr/lib/policykit-1/polkitd –no-debug
                        1.4 MiB + 330.5 KiB = 1.7 MiB bash
                        1.4 MiB + 531.0 KiB = 1.9 MiB /usr/sbin/console-kit-daemon –no-daemon
                        1.3 MiB + 746.0 KiB = 2.0 MiB /usr/bin/sudo -H -S -p GNOME_SUDO_PASS -u root — /usr/bin/x-terminal-emulator
                        2.6 MiB + 427.5 KiB = 3.0 MiB /usr/sbin/cupsd -C /etc/cups/cupsd.conf -s /etc/cups/cups-files.conf
                        1.9 MiB + 1.9 MiB = 3.7 MiB volumeicon
                        2.5 MiB + 1.4 MiB = 4.0 MiB /usr/bin/slim -d
                        3.3 MiB + 977.5 KiB = 4.2 MiB icewm –notify
                        3.1 MiB + 1.3 MiB = 4.4 MiB conky
                        2.7 MiB + 2.9 MiB = 5.6 MiB gksu /usr/bin/x-terminal-emulator
                        3.2 MiB + 2.8 MiB = 6.0 MiB /usr/bin/x-terminal-emulator
                        4.6 MiB + 1.9 MiB = 6.4 MiB /usr/bin/python -O /usr/share/wicd/daemon/monitor.py
                        5.6 MiB + 1.0 MiB = 6.6 MiB /usr/bin/python -O /usr/share/wicd/daemon/wicd-daemon.py –keep-connection
                        4.1 MiB + 3.3 MiB = 7.5 MiB rox –pinboard=antiX-icewm
                        11.4 MiB + 3.7 MiB = 15.2 MiB /usr/bin/python -O /usr/share/wicd/gtk/wicd-client.py -t
                        14.4 MiB + 1.6 MiB = 16.0 MiB /usr/lib/xorg/Xorg -nolisten tcp -auth /var/run/slim.auth vt07
                        ———————————
                        107.9 MiB

                        #13772
                        Moderator
                        BobC
                          Helpful
                          Up
                          0
                          ::

                          It looks to me like the battery monitor bar you are seeing is the tray icon one that comes with IceWM. On my HP laptop its dropping 2% at a time before the one on my conky drops. If yours is dropping 10% at a time, a workaround solution would be to test for a value <= 20% as an alarm point so that you know you get an alarm at 20% instead of waiting till too late. It might be possible to get a more accurate reading with one of the other programs available if it is checking something different in the system or doing it a different way.

                          There are many possible solutions.

                          If you want a popup window for it like I did, the lowbattery conky test and lowbattery script I posted might be useful. You would need to have whatever sound file you want played on the system, obviously. You wouldn’t need to load any other programs for that.

                          One thing you might want to experiment with is the acpi command used by skidoo, roki and myself as part of the basis of a solution.

                          You basically have to live within the limits of what your hardware is willing to provide, but it can still be made tolerable with a bit of creativity

                          #13776
                          Member
                          fatmac
                            Helpful
                            Up
                            0
                            ::

                            I just use conky on this distro, but I use flit on another distro (TinyCore), you might like it.

                            Linux (& BSD) since 1999

                            #13837
                            Member
                            DaveW
                              Helpful
                              Up
                              0
                              ::

                              Thanks to everyone, for your input.

                              I’m going to settle for the Conky bar display with color changes at defined levels. The basic battery indicator in the IceWM taskbar is a good backup, since it is not covered by open windows.

                              Although I would prefer to see battery level decline in 1% steps rather than 10%, it looks like this is a limitation of the eeepc 900. Acpi and upower have the same issue. Most battery monitors reference either acpi, upower or apm. (I did not try apm, since it is not supported by the current kernel.) So, I’m guessing this is the resolution that is possible with this computer. Its good enough.

                              Thanks again for all your helpful ideas!

                            Viewing 13 posts - 1 through 13 (of 13 total)
                            • You must be logged in to reply to this topic.