View previous topic :: View next topic |
Author |
Message |
nictki n00b
Joined: 10 Jan 2007 Posts: 63 Location: somewhere else...
|
Posted: Fri Oct 12, 2012 5:15 pm Post subject: Battmon, Simple battery monitoring program |
|
|
Hej,
napisałem mały program w pythonie, który monitoruje stan baterii.
Głównym celem napisania tego programu było posiadanie monitoringu baterii pod jakikolwiek tiling WM, który daje monity.
Najlepiej odpalić z opcją -h/--help, by zobaczyć wszystkie opcje.
Jeżeliby ktoś miałby ochote postestować, podesłać jakiekolwiek ulepszenia, czy miałby jakiekolwiek pytania, prosze śmialo pisać
a tu link:
https://github.com/nictki/Battmon |
|
Back to top |
|
|
gexcite Tux's lil' helper
Joined: 24 Sep 2005 Posts: 116
|
Posted: Fri Oct 12, 2012 8:39 pm Post subject: |
|
|
Takie tam
Code: | ./battmon.py
** (process:14726): WARNING **: Trying to register gtype 'GMountMountFlags' as enum when in fact it is of type 'GFlags'
** (process:14726): WARNING **: Trying to register gtype 'GDriveStartFlags' as enum when in fact it is of type 'GFlags'
** (process:14726): WARNING **: Trying to register gtype 'GSocketMsgFlags' as enum when in fact it is of type 'GFlags'
Unable to import pynotify module, use notify-send instead, so no popup's update.
Traceback (most recent call last):
File "./battmon.py", line 643, in <module>
notify=options.notify, critical=options.critical, sound=options.sound, timeout=options.timeout)
File "./battmon.py", line 339, in __init__
self.checkVlock()
File "./battmon.py", line 414, in checkVlock
pynotify.init("No vlock")
NameError: global name 'pynotify' is not defined
|
|
|
Back to top |
|
|
nictki n00b
Joined: 10 Jan 2007 Posts: 63 Location: somewhere else...
|
Posted: Fri Oct 12, 2012 8:53 pm Post subject: |
|
|
musisz miec zainstalowane dev-python/notify-python, albo odpal z program z -N , ale wtedy nie bedziesz mial zadnych powidomien...
na weekendzie dodam monit, co do dev-python/notify-python
dzieki |
|
Back to top |
|
|
SlashBeast Retired Dev
Joined: 23 May 2006 Posts: 2922
|
Posted: Fri Oct 12, 2012 9:02 pm Post subject: |
|
|
Przyjmujesz, ze bedzie BAT0 a na niektorych urzadzeniach moze byc po prostu BAT badz np. same numerki (mam tak na jednym hpku). Znacznie lepszym podejciem byl by loop po /sys/class/power_supply/*/type i uzycie tego, gdzie jest 'Battery'. Samo /proc/acpi w ogole nie powinienes uzywac, podobnie jak znalezienie baterii tak samo mozesz AC znalezc, w type bedzie 'Mains', a w katalogu w sys plik 'online' z 1 jak jest AC, a 0 jak odlaczone.
Last edited by SlashBeast on Fri Oct 12, 2012 9:04 pm; edited 1 time in total |
|
Back to top |
|
|
gexcite Tux's lil' helper
Joined: 24 Sep 2005 Posts: 116
|
Posted: Fri Oct 12, 2012 9:02 pm Post subject: |
|
|
po instalacji notify-python:
Code: | ./battmon.py
** (process:22167): WARNING **: Trying to register gtype 'GMountMountFlags' as enum when in fact it is of type 'GFlags'
** (process:22167): WARNING **: Trying to register gtype 'GDriveStartFlags' as enum when in fact it is of type 'GFlags'
** (process:22167): WARNING **: Trying to register gtype 'GSocketMsgFlags' as enum when in fact it is of type 'GFlags'
Traceback (most recent call last):
File "./battmon.py", line 643, in <module>
notify=options.notify, critical=options.critical, sound=options.sound, timeout=options.timeout)
File "./battmon.py", line 339, in __init__
self.checkVlock()
File "./battmon.py", line 415, in checkVlock
self.notifier.sendNofiication('Is vlock intalled ?' ,
AttributeError: Application instance has no attribute 'notifier' |
z opcją -N:
Code: | ./battmon.py -N
** (process:22170): WARNING **: Trying to register gtype 'GMountMountFlags' as enum when in fact it is of type 'GFlags'
** (process:22170): WARNING **: Trying to register gtype 'GDriveStartFlags' as enum when in fact it is of type 'GFlags'
** (process:22170): WARNING **: Trying to register gtype 'GSocketMsgFlags' as enum when in fact it is of type 'GFlags'
Traceback (most recent call last):
File "./battmon.py", line 643, in <module>
notify=options.notify, critical=options.critical, sound=options.sound, timeout=options.timeout)
File "./battmon.py", line 339, in __init__
self.checkVlock()
File "./battmon.py", line 415, in checkVlock
self.notifier.sendNofiication('Is vlock intalled ?' ,
AttributeError: Application instance has no attribute 'notifier' |
|
|
Back to top |
|
|
nictki n00b
Joined: 10 Jan 2007 Posts: 63 Location: somewhere else...
|
Posted: Fri Oct 12, 2012 9:06 pm Post subject: |
|
|
thx, za info
dodalem monit co do pynotify, powinien wyskoczyc popup, ze nie ma zainstalowanego pynotify |
|
Back to top |
|
|
nictki n00b
Joined: 10 Jan 2007 Posts: 63 Location: somewhere else...
|
Posted: Fri Oct 12, 2012 9:12 pm Post subject: |
|
|
@SlashBeast dzieki, jakos w niedziele skoryguje
@gexite wychodzi, ze brak vlock, jak tetsowalem u mnie banglalo, rzuce okiem
dzieki
Last edited by nictki on Fri Oct 12, 2012 10:14 pm; edited 1 time in total |
|
Back to top |
|
|
nictki n00b
Joined: 10 Jan 2007 Posts: 63 Location: somewhere else...
|
Posted: Fri Oct 12, 2012 9:56 pm Post subject: |
|
|
@gexite naprawione, powinno byc online |
|
Back to top |
|
|
gexcite Tux's lil' helper
Joined: 24 Sep 2005 Posts: 116
|
Posted: Sat Oct 13, 2012 10:57 am Post subject: |
|
|
Tak jak napisał SlashBeast, musisz go jeszcze doszlifować. Moje uwagi:
1. Na stacjonarce uparcie chce się dobrać do stanu baterii a jej tam przecież nie ma
2. Na lapsie baterię bada w ścieżce
Code: | /proc/acpi/ac_adapter/AC/state |
tymczasem w moim jest
Code: | /proc/acpi/ac_adapter/AC0/state |
3. Poprawiony kod aby szukał w ..AC0.. wywala z kolei Code: | Traceback (most recent call last):
File "./battmon.py", line 644, in <module>
ml.runMainLoop()
File "./battmon.py", line 535, in runMainLoop
if self.batteryValues.isAcAdapterPresent() == True and self.batteryValues.isBatteryFullyCharged() == True and self.batteryValues.isBatteryDischarging() == False:
File "./battmon.py", line 182, in isBatteryFullyCharged
fully_charged = os.popen("acpi").readlines()[0]
IndexError: list index out of range |
|
|
Back to top |
|
|
nictki n00b
Joined: 10 Jan 2007 Posts: 63 Location: somewhere else...
|
Posted: Tue Oct 16, 2012 2:03 pm Post subject: |
|
|
@SlashBeast
'szukanie' baterii i adaptera poprawione _________________ github |
|
Back to top |
|
|
nictki n00b
Joined: 10 Jan 2007 Posts: 63 Location: somewhere else...
|
Posted: Fri Oct 19, 2012 5:00 pm Post subject: |
|
|
troche poprawek dodanych...
testowalem na dwoch roznych lapach, wsio dziala ok...
i jak napisalem: sugestie, pytania, poprawiki etc. bardzo mile widziane _________________ github |
|
Back to top |
|
|
nictki n00b
Joined: 10 Jan 2007 Posts: 63 Location: somewhere else...
|
Posted: Thu Nov 15, 2012 4:27 pm Post subject: |
|
|
update: acpi nie jest juz wiecej wymagane, wszystko leci przez sysfs _________________ github |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|