Notices


Reply
Thread Tools
thp's Avatar
Posts: 1,391 | Thanked: 4,272 times | Joined on Sep 2007 @ Vienna, Austria
#611
Originally Posted by coderus View Post
depends: python-qmsystem
Added to billboard-scripts repo (in slightly modified / simplified form):

https://github.com/harmattan/billboa...mit/babeb97e06
 
TMavica's Avatar
Posts: 2,021 | Thanked: 1,060 times | Joined on Apr 2010 @ Hong Kong
#612
When billboard going to update?
__________________
The Glorious Lady T.Mavica
Twitter https://twitter.com/TMavica
 
coderus's Avatar
Posts: 6,436 | Thanked: 12,700 times | Joined on Nov 2011 @ Ängelholm, Sweden
#613
@jpel try
Code:
qdbus --system org.freedesktop.Hal /org/freedesktop/Hal/devices/bme  org.freedesktop.Hal.Device.GetAllProperties
__________________
Telegram | Openrepos | GitHub | Revolut donations
 
MK99's Avatar
Posts: 644 | Thanked: 480 times | Joined on Jul 2012 @ Finland
#614
There is also RemainingActiveTime.

And RemainingChargingTime:
Code:
#!/usr/bin/python

import QmSystem

batt = QmSystem.QmBattery()
time = batt.getRemainingChargingTime()
hours,mod = divmod(time,3600)
mins,secs = divmod(mod,60)
result = ''
if hours>0:
        result+=str(hours)+'h '
if mins>0:
        result+=str(mins)+'min'
if batt.getChargingState()==1:
    print result
else:
    print ""
But there is one problem: when not connected to a charger, it show all the time 59min.
Can someone fix that, because I do not know how to do it. Or is it even possible to get this to work correctly?

E: corrected and put in for testing.

Last edited by MK99; 2013-02-14 at 11:40.
 
coderus's Avatar
Posts: 6,436 | Thanked: 12,700 times | Joined on Nov 2011 @ Ängelholm, Sweden
#615
Code:
if batt.getChargingState()==1:
    print "charging"
else:
    print "not charging"
__________________
Telegram | Openrepos | GitHub | Revolut donations
 

The Following User Says Thank You to coderus For This Useful Post:
Posts: 59 | Thanked: 168 times | Joined on Mar 2010 @ Finland
#616
Originally Posted by coderus View Post
@jpel try
Code:
qdbus --system org.freedesktop.Hal /org/freedesktop/Hal/devices/bme  org.freedesktop.Hal.Device.GetAllProperties
Actually i already tried by modifying your earlier python script for determining remaining active time to following:

Code:
#!/usr/bin/python
import QmSystem
batt = QmSystem.QmBattery()
idle = batt.getAverageIdleCurrent(QmSystem.QmBattery.NormalMode)
active = batt.getAverageActiveCurrent(QmSystem.QmBattery.NormalMode)
print "Active:",active,"mA","  ","Idle:",idle,"mA"
But the problem seems to be that there is no battery usage data collected by the system default as the script returns every single time it is been run the same output: Active: 203 mA Idle: 23 mA

I guess that in order to this work and give reliable results you would have to use:
Code:
startCurrentMeasurement (Period rate)
wait some desired time to gather data and then stop measurement with
Code:
stopCurrentMeasurement ()
before requesting and displaying the desired batteryinformation.

I was thinking if there was an easy way of getting all this information from battery usage app that has already all needed data gathered since the last recharge.
 
Posts: 277 | Thanked: 319 times | Joined on Jan 2010
#617
Nice module, this QmSystem...

Power saving mode state:

Code:
#!/usr/bin/python

import QmSystem

psm = QmSystem.QmDeviceMode()
psmstate = psm.getPSMState()

if psmstate == psm.PSMStateOff:
        print 'PSM off'
if psmstate == psm.PSMStateOn:
        print 'PSM on'
@Soltee:

Install the QmSystem module (apt-get install python-qmsystem as root) and it should work.
 
Posts: 277 | Thanked: 319 times | Joined on Jan 2010
#618
Originally Posted by jpel View Post
I was thinking if there was an easy way of getting all this information from battery usage app that has already all needed data gathered since the last recharge.
Edit:

Now I read your post properly. I left the link to gitorious...

There is a python example for battery related stuff here.

Last edited by slarti; 2013-02-14 at 12:32.
 
coderus's Avatar
Posts: 6,436 | Thanked: 12,700 times | Joined on Nov 2011 @ Ängelholm, Sweden
#619
small variation.
shows remaining charging time if charger connected
shows average remaining usage time ( (idle+talk) / 2) if charger disconnected
using current psm mode to detect remaining time (powersave or not)

Code:
#!/usr/bin/python

import QmSystem

batt = QmSystem.QmBattery()

if batt.getChargingState()==1:
        time = batt.getRemainingChargingTime()
else:
        mode = QmSystem.QmBattery.NormalMode if QmSystem.QmDeviceMode().getPSMState() == 0 else QmSystem.QmBattery.PowersaveMode
        time = batt.getRemainingIdleTime(mode)
        time += batt.getRemainingTalkTime(mode)
        time = time/2
hours,mod = divmod(time,3600)
mins,secs = divmod(mod,60)

result = []
if hours == 1:
    result.append('%d hour' % hours)
elif hours > 0:
    result.append('%d hours' % hours)
if mins == 1:
    result.append('%d minute' % mins)
elif mins > 0 or not result:
    result.append('%d minutes' % mins)
print ' '.join(result)
__________________
Telegram | Openrepos | GitHub | Revolut donations
 

The Following User Says Thank You to coderus For This Useful Post:
Posts: 87 | Thanked: 14 times | Joined on Jan 2012
#620
Installed qmsystem but nothing works .
 
Reply


 
Forum Jump


All times are GMT. The time now is 08:42.