You are not logged in.

#1 2009-03-15 04:54:10

genisis300
Member
From: Uk
Registered: 2008-01-15
Posts: 284

Batterymon -- a simple battery monitor ideal for openbox etc

Hi All,

Just added a PKGBUILD for a simple battery monitor that i've been working on.

http://aur.archlinux.org/packages.php?ID=24694

i want to thank everyone that has helped me here
http://bbs.archlinux.org/viewtopic.php?id=67270

let me know if you have any problems
there are still lots of things i need to work on but it does work.

let me know if you have any problems
http://code.google.com/p/batterymon/


"is adult entertainment killing our children or is killing our children entertaining adults?" Marilyn Manson

Offline

#2 2009-03-15 05:31:53

MarCustomized
Member
From: Detroit, MI
Registered: 2008-09-05
Posts: 116

Re: Batterymon -- a simple battery monitor ideal for openbox etc

It installed fine, but I can't seem to get any real info from it.  Running "batterymon.py" and left clicking the panel icon does nothing.  I get this error message.

One battery found
/sys/class/power_supply/BAT1/status
Discharging

Traceback (most recent call last):
  File "/usr/bin/batterymon.py", line 94, in activate
    perc            = self.percent()
  File "/usr/bin/batterymon.py", line 84, in percent
    FILE=open(batpath+"BAT0/charge_now","r")
IOError: [Errno 2] No such file or directory: '/sys/class/power_supply/BAT0/charge_now'
/sys/class/power_supply/BAT1/status
Discharging

Traceback (most recent call last):
  File "/usr/bin/batterymon.py", line 133, in update
    per = int(round(self.percent()))
  File "/usr/bin/battrymon.py", line 84, in percent
    FILE=open(batpath+"BAT0/charge_now","r")
IOError: [Errno 2] No such file or directory: '/sys/class/power_supply/BAT0/charge_now'

Running "batterymon.py -b BAT1" gives me the following error when clicking it.

Traceback (most recent call last):
  File "/usr/bin/batterymon.py", line 93, in activate
    stat            = self.status()
  File "/usr/bin/batterymon.py", line 72, in status
    FILE=open(batpath+BATnumber + "/status","r")
IOError: [Errno 2] No such file or directory: '/sys/class/power_supply//status'

Right clicking brings up a window which asks if I want to close the program.

Last edited by MarCustomized (2009-03-15 05:38:30)

Offline

#3 2009-03-15 06:40:10

jason_f
Member
Registered: 2006-08-18
Posts: 78

Re: Batterymon -- a simple battery monitor ideal for openbox etc

Thanks for this! The alternative programs out there dont seem to work at all. so this fills a big gap for me.

couple things..
Please add x86_64 to the pkgbuild, it works for me..

I often remove the battery if I'm going to be on AC for extended periods of time. Console logs an error when I remove the battery. doesnt seem to cause any big problems but just a heads up in case you want to make a handler for this type of event, for icon change, etc.

also the status doesnt seem to be updating for me on its own. if I click on the icon, the status will update (example, i unplug power. i dont see any console output and the icon/tool tip dont change to show discharging. until I click the icon, then it updates right away and dumps the status to the console. I've even tried re-running with insanely high update interval. It just seems its not calling the check routine until I manually click the icon.

Thanks again for releasing this..

Offline

#4 2009-03-15 16:52:33

genisis300
Member
From: Uk
Registered: 2008-01-15
Posts: 284

Re: Batterymon -- a simple battery monitor ideal for openbox etc

MarCustomized wrote:

It installed fine, but I can't seem to get any real info from it.  Running "batterymon.py" and left clicking the panel icon does nothing.  I get this error message.

One battery found
/sys/class/power_supply/BAT1/status
Discharging

Traceback (most recent call last):
  File "/usr/bin/batterymon.py", line 94, in activate
    perc            = self.percent()
  File "/usr/bin/batterymon.py", line 84, in percent
    FILE=open(batpath+"BAT0/charge_now","r")
IOError: [Errno 2] No such file or directory: '/sys/class/power_supply/BAT0/charge_now'
/sys/class/power_supply/BAT1/status
Discharging

Traceback (most recent call last):
  File "/usr/bin/batterymon.py", line 133, in update
    per = int(round(self.percent()))
  File "/usr/bin/battrymon.py", line 84, in percent
    FILE=open(batpath+"BAT0/charge_now","r")
IOError: [Errno 2] No such file or directory: '/sys/class/power_supply/BAT0/charge_now'

Running "batterymon.py -b BAT1" gives me the following error when clicking it.

Traceback (most recent call last):
  File "/usr/bin/batterymon.py", line 93, in activate
    stat            = self.status()
  File "/usr/bin/batterymon.py", line 72, in status
    FILE=open(batpath+BATnumber + "/status","r")
IOError: [Errno 2] No such file or directory: '/sys/class/power_supply//status'

Right clicking brings up a window which asks if I want to close the program.

i've just worked out what this is i will post a new version shortly.


"is adult entertainment killing our children or is killing our children entertaining adults?" Marilyn Manson

Offline

#5 2009-03-15 20:57:38

genisis300
Member
From: Uk
Registered: 2008-01-15
Posts: 284

Re: Batterymon -- a simple battery monitor ideal for openbox etc

Just to let you know i have fixed the problem you where having when passing -b BAT1
http://aur.archlinux.org/packages.php?ID=24694
Jason_f any chance you could post the output you get so i can try and fix it?

let me know how you get on.

Regards
Matthew


"is adult entertainment killing our children or is killing our children entertaining adults?" Marilyn Manson

Offline

#6 2009-03-15 21:14:51

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: Batterymon -- a simple battery monitor ideal for openbox etc

How about some screenshots ? We have no idea what it looks like...


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#7 2009-03-16 00:15:01

MarCustomized
Member
From: Detroit, MI
Registered: 2008-09-05
Posts: 116

Re: Batterymon -- a simple battery monitor ideal for openbox etc

It works perfectly fine now. Hovering over the panel icon shows the battery status.  Left click brings up a small window with the battery status.  Right click brings up another window which asks if I want to close the app.  The charging/discharging/full status updates as it should.  Zero error messages. 

This is my new favorite app!  I was using a battery app within xfcepanel on my netbook.  Using this with Docker is SO much lighter.  Great job! big_smile

Small suggestion: make the command to run it simply "batterymon" rather than "batterymon.py".

Edit:  When I click the icon, the window says my current charge is 95%.  Hovering over the panel icon says I'm still at 100%.  I'm currently unplugged, so it can't possibly be at 100%.  The icon itself is also still blue (battery_power.png) instead of turning green.  No error messages.

moljac024 wrote:

How about some screenshots ? We have no idea what it looks like...

Panel Icon
batterymon_icon.png

Hovering Over Panel Icon
batterymon_hover.png

Left Click Window
batterymon_status.png

Right Click Window
batterymon_exit.png

All Status Icons
batterymon_icons.png

Last edited by MarCustomized (2009-03-16 00:52:15)

Offline

#8 2009-03-16 00:46:57

genisis300
Member
From: Uk
Registered: 2008-01-15
Posts: 284

Re: Batterymon -- a simple battery monitor ideal for openbox etc

i was going to put  a screenshot but it is just an icon in the systray,,, should i still post one?


"is adult entertainment killing our children or is killing our children entertaining adults?" Marilyn Manson

Offline

#9 2009-03-16 00:48:12

genisis300
Member
From: Uk
Registered: 2008-01-15
Posts: 284

Re: Batterymon -- a simple battery monitor ideal for openbox etc

there is a small issue with the ac polling that is my next fix. i will also check on the status message.
if i remove the .py externsion will that cause any problems with the commandline?


Thanks for the feedback.
Matthew

Last edited by genisis300 (2009-03-16 00:49:35)


"is adult entertainment killing our children or is killing our children entertaining adults?" Marilyn Manson

Offline

#10 2009-03-16 00:57:23

MarCustomized
Member
From: Detroit, MI
Registered: 2008-09-05
Posts: 116

Re: Batterymon -- a simple battery monitor ideal for openbox etc

You could put the actual "batterymon.py" file in /usr/share/batterymon and have /usr/bin/batterymon be a shell script or symbolic link that points to it.

Last edited by MarCustomized (2009-03-16 00:57:46)

Offline

#11 2009-03-16 19:09:27

nsb
Member
From: Switzerland
Registered: 2008-03-26
Posts: 57

Re: Batterymon -- a simple battery monitor ideal for openbox etc

Thank you for your work.

I tried to use gbatt, but it didn't work for me, batterymon seems better. But still there is something strange:
When I do a right mouse click, it shows me a different number then by holding the cursor over the symbol.

I even had once a 123% charged battery tongue. So maybe the battery wasn't detected right.

Greetings

nsb

Offline

#12 2009-03-16 19:19:53

XFire
Member
From: UK
Registered: 2008-05-11
Posts: 192

Re: Batterymon -- a simple battery monitor ideal for openbox etc

You have made my day. It has replaced GBatt, which pulls a lot of gnome deps. Thank you a great deal. Do you intend on it informing you of the battery status on hover, or are you going by click only?


There is a difference between bleeding [edge] and haemorrhaging. - Allan

Offline

#13 2009-03-16 19:45:03

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,059

Re: Batterymon -- a simple battery monitor ideal for openbox etc

I will try this out tonight. This just sits in the systray, correct?

By the way -- if you named is Battmon (Batman-- get it?) -- that would be just awesome wink

hahah


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#14 2009-03-16 23:35:25

genisis300
Member
From: Uk
Registered: 2008-01-15
Posts: 284

Re: Batterymon -- a simple battery monitor ideal for openbox etc

it was called batman but someone has that name on googlecode smile

it should already give you battery status on hover i will check to make sure it's still working.

i will also look into the 123% battery status although i suspect its more to-do with what your battery is reporting. have you had the same problem before?
the symlink idea would actualy solve another problem i've been having smile i'll do that on the next update.. probably later tonight smile
regards
Matthew


"is adult entertainment killing our children or is killing our children entertaining adults?" Marilyn Manson

Offline

#15 2009-03-17 01:27:24

genisis300
Member
From: Uk
Registered: 2008-01-15
Posts: 284

Re: Batterymon -- a simple battery monitor ideal for openbox etc

Just to let you know that i have update the PKGBUILD with the symlink idea as suggested i've also fixed a problem with the timer that wasn't udating icons as it should.

it should also now show the current icon when charging.

let me know if you have any issues.

regards
Matthew


"is adult entertainment killing our children or is killing our children entertaining adults?" Marilyn Manson

Offline

#16 2009-03-17 05:39:42

nsb
Member
From: Switzerland
Registered: 2008-03-26
Posts: 57

Re: Batterymon -- a simple battery monitor ideal for openbox etc

I updated the package, but it stills shows 113% charged. Bevor I used conky and never had any problems.

At least both values, the one in  the Infobox after left clinking and the other one after hovering the mouse over the symbol, are now the same.

regards

nsb

Last edited by nsb (2009-03-17 05:40:54)

Offline

#17 2009-03-17 12:30:16

genisis300
Member
From: Uk
Registered: 2008-01-15
Posts: 284

Re: Batterymon -- a simple battery monitor ideal for openbox etc

NSB
could you post the output of the following 2 commands
cat /sys/class/power_supply/BAT0/charge_now
and
cat /sys/class/power_supply/BAT0/charge_full

regards
Matthew


"is adult entertainment killing our children or is killing our children entertaining adults?" Marilyn Manson

Offline

#18 2009-03-17 13:40:43

jerryluc
Member
From: Trondheim, Norway
Registered: 2008-05-20
Posts: 95

Re: Batterymon -- a simple battery monitor ideal for openbox etc

nsb wrote:

I updated the package, but it stills shows 113% charged. Bevor I used conky and never had any problems.

Mine show 161%, i never had any problem with conky or the gnome battery monitor.

Last edited by jerryluc (2009-03-17 13:41:16)

Offline

#19 2009-03-17 13:57:44

nsb
Member
From: Switzerland
Registered: 2008-03-26
Posts: 57

Re: Batterymon -- a simple battery monitor ideal for openbox etc

Here you have my output:

[noah@silverstar ~]$ cat /sys/class/power_supply/BAT0/charge_now 
7650000
[noah@silverstar ~]$ cat /sys/class/power_supply/BAT0/charge_full
6790000
[noah@silverstar ~]$

The battery should be fully charged.

Regards

nsb

EDIT:

Just found that:

[noah@silverstar BAT0]$ cat charge_full_design 
7650000

Is this right, that batterymon uses charge_full as a refrence?
So it might be better to use cahrge_full_design as a refrence, right?

Last edited by nsb (2009-03-17 14:09:56)

Offline

#20 2009-03-17 14:55:04

MarCustomized
Member
From: Detroit, MI
Registered: 2008-09-05
Posts: 116

Re: Batterymon -- a simple battery monitor ideal for openbox etc

Everything is fine on my end with the latest PKGBUILD. smile

Offline

#21 2009-03-17 20:00:04

genisis300
Member
From: Uk
Registered: 2008-01-15
Posts: 284

Re: Batterymon -- a simple battery monitor ideal for openbox etc

it's as i though for some reason your battery is showing more charge than it seem to think it can hold.
the charge_full is supposed to show how much the battery can hold at full charge as the battery gets older the charge_now is supposed to get slowly lower at full charge.

i'll add a section in to cover this on the next update which will be later tonight.

Thanks for helping.

Regards
Matthew


"is adult entertainment killing our children or is killing our children entertaining adults?" Marilyn Manson

Offline

#22 2009-03-20 16:55:38

nsb
Member
From: Switzerland
Registered: 2008-03-26
Posts: 57

Re: Batterymon -- a simple battery monitor ideal for openbox etc

I changed the line 82 form

 FILE=open(batpath+BATnumber+"/charge_full","r")

into

 FILE=open(batpath+BATnumber+"/charge_full_design","r")

It works now pretty well, but I dont know, if this change would mess up the programm for those, who have no problem with it.

Regards

nsb

Last edited by nsb (2009-03-20 16:56:38)

Offline

#23 2009-03-20 21:25:50

genisis300
Member
From: Uk
Registered: 2008-01-15
Posts: 284

Re: Batterymon -- a simple battery monitor ideal for openbox etc

i fixed the issus by just doing a sanity check on per if it's more than 100% then bring it back to 100% and the same for less than 0%

i've uploaded the changes and will release an update for this later.

Another bug that has crept up is with a thinkpad. for some reason it uses engery_now and engery_full is that standard across Thinkpads?

Regards
Matthew


"is adult entertainment killing our children or is killing our children entertaining adults?" Marilyn Manson

Offline

#24 2009-03-20 21:34:04

genisis300
Member
From: Uk
Registered: 2008-01-15
Posts: 284

Re: Batterymon -- a simple battery monitor ideal for openbox etc

just uploade the new package that will fix your 113% problem.

Regards
Matthew


"is adult entertainment killing our children or is killing our children entertaining adults?" Marilyn Manson

Offline

#25 2009-03-21 08:31:33

nsb
Member
From: Switzerland
Registered: 2008-03-26
Posts: 57

Re: Batterymon -- a simple battery monitor ideal for openbox etc

But that means, that the indication of the numbers of percents lower than 100% is still wrong, right?

Regards
nsb

Offline

Board footer

Powered by FluxBB