maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   [Support thread] Billboard Standby Screen (https://talk.maemo.org/showthread.php?t=84507)

slarti 2013-02-13 16:19

Re: [Support thread] Billboard Standby Screen
 
You'll have to enable the time calculating first. As root:

Code:

qdbus --system org.freedesktop.Hal /org/freedesktop/Hal/devices/bme org.free desktop.Hal.Device.SetPropertyBoolean battery.remaining_time.calculate_per_time true
After a little while MK99's qdus command will give out the remaining time (in minutes, I assume).

EDIT:

Spoke too soon. I thought it worked because I got something other than 0 after setting that key to 'true'. Turns out I just plugged it in and that changed the remaining time value, not the change to the battery.remaining_time.calculate_per_time key. Sorry... :(

Soltee 2013-02-13 17:22

Re: [Support thread] Billboard Standby Screen
 
and could not be put only the path?
from Settings-Device-Battery
just guessing :rolleyes:

coderus 2013-02-13 17:42

Re: [Support thread] Billboard Standby Screen
 
MeeGo::QmBattery::getRemainingIdleTime in Qt

coderus 2013-02-13 18:20

Re: [Support thread] Billboard Standby Screen
 
depends: python-qmsystem

Code:

#!/usr/bin/python

import QmSystem

batt = QmSystem.QmBattery()
#time = batt.getRemainingIdleTime(QmSystem.QmBattery.NormalMode)
time = batt.getRemainingTalkTime(QmSystem.QmBattery.NormalMode)
hours,mod = divmod(time,3600)
mins,secs = divmod(mod,60)
result = ''
if hours>0:
        result+=str(hours)+' hour(s) '
if mins>0:
        result+=str(mins)+' minute(s) '
result+=str(secs)+' second(s)'
print result

in Billboard:
Code:

{script:/path/to/script.py 2>/dev/null}

herno24 2013-02-13 18:48

Re: [Support thread] Billboard Standby Screen
 
It doesn't work for me and the bluetooth consumtion script doesn't work for me too. But, i flashed my N9 recently, so, am i missing to install extra python packages to make it work? Thanks in advance.

coderus 2013-02-13 18:58

Re: [Support thread] Billboard Standby Screen
 
Sorry, Vanga mode is off today.

Soltee 2013-02-13 19:00

Re: [Support thread] Billboard Standby Screen
 
It's too complicated for me... :(

coderus 2013-02-13 19:03

Re: [Support thread] Billboard Standby Screen
 
Sorry, i can't help you to use copy-paste. You should born with this skill. Nobody can teach you if you can't. RI'm very sorry, really.

Soltee 2013-02-13 20:06

Re: [Support thread] Billboard Standby Screen
 
I very much thank you for trying to help you!
You're doing a great job!
I'm going to learn.

Thank you again!

jpel 2013-02-14 10:37

Re: [Support thread] Billboard Standby Screen
 
Would it be somehow possible to hook-up and extract battery information (Idle, average, active current consumption etc.) provided by battery usage app by using shell or python scripts ?

thp 2013-02-14 10:42

Re: [Support thread] Billboard Standby Screen
 
Quote:

Originally Posted by coderus (Post 1322882)
depends: python-qmsystem

Added to billboard-scripts repo (in slightly modified / simplified form):

https://github.com/harmattan/billboa...mit/babeb97e06

TMavica 2013-02-14 10:47

When billboard going to update?

coderus 2013-02-14 11:19

Re: [Support thread] Billboard Standby Screen
 
@jpel try
Code:

qdbus --system org.freedesktop.Hal /org/freedesktop/Hal/devices/bme  org.freedesktop.Hal.Device.GetAllProperties

MK99 2013-02-14 11:22

Re: [Support thread] Billboard Standby Screen
 
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.

coderus 2013-02-14 11:30

Re: [Support thread] Billboard Standby Screen
 
Code:

if batt.getChargingState()==1:
    print "charging"
else:
    print "not charging"


jpel 2013-02-14 11:50

Re: [Support thread] Billboard Standby Screen
 
Quote:

Originally Posted by coderus (Post 1322970)
@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.

slarti 2013-02-14 12:17

Re: [Support thread] Billboard Standby Screen
 
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.

slarti 2013-02-14 12:21

Re: [Support thread] Billboard Standby Screen
 
Quote:

Originally Posted by jpel (Post 1322981)
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.

coderus 2013-02-14 15:16

Re: [Support thread] Billboard Standby Screen
 
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)


herno24 2013-02-14 16:58

Re: [Support thread] Billboard Standby Screen
 
Installed qmsystem but nothing works :confused:.

coderus 2013-02-14 19:44

Re: [Support thread] Billboard Standby Screen
 
just nothing? even terminal and you cant provide extra innfo about "nothing works"? sadly :(

Boxeri 2013-02-16 12:16

Re: [Support thread] Billboard Standby Screen
 
Hello

I once again have problem that I can't solve with these scripts.

I am trying to get the "Estimated battery time" by Coderus here.

With apt-get install python

Code:

~ # apt-get install python-qmsystem
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-qmsystem is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.

Sooooo, that should be ok then, right?


But then, when I try to do sh/path/to/script

Code:

~ # sh /home/user/scripts/kayttoaika.py
/home/user/scripts/kayttoaika.py: line 3: import: not found
/home/user/scripts/kayttoaika.py: line 5: syntax error: unexpected "("


And here is the script, straight copy-paste from post of Coderus from the previous page

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)


So, what genius have I now managed to screw up :D ?




BTW, how often does the billboard update its scripts? I have come to understand that this is somewhat script related? I have noticed that my Wazapp status does not update if I shut down my internet connection and then quickly turn on the stand by screen. I have to click the phone open once again, click it to stand-by and then it has updated the status. Is this correct? I am also using the profilematic forced billboard update, is this the reason for the "lag"?

thedead1440 2013-02-16 12:18

Re: [Support thread] Billboard Standby Screen
 
Boxeri,

Its to be run as "python /path/to/script" not "sh /path/to/script" ;)

Boxeri 2013-02-16 12:30

Re: [Support thread] Billboard Standby Screen
 
So, the genius that I managed to do to screw this up was that for ONCE I actually decided to check first what I was doing. :p If I had just put it to Billboard everything would have been fine.

Everything was correct and it is working now.

Could it be possible to add somekind of "Charging" or "Remaining" text depending on the situation?

echo something?

coderus 2013-02-16 13:02

Re: [Support thread] Billboard Standby Screen
 
Code:

#!/usr/bin/python

import QmSystem

batt = QmSystem.QmBattery()
result = []

if batt.getChargingState()==1:
        time = batt.getRemainingChargingTime()
        result.append('Charging')
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
        result.append('Remaining')
hours,mod = divmod(time,3600)
mins,secs = divmod(mod,60)

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)

something like that

Boxeri 2013-02-16 13:18

Re: [Support thread] Billboard Standby Screen
 
Much appreciated!

How about my old question, anyone?

"how often does the billboard update its scripts? I have come to understand that this is somewhat script related? I have noticed that my Wazapp status does not update if I shut down my internet connection and then quickly turn on the stand by screen. I have to click the phone open once again, click it to stand-by and then it has updated the status. Is this correct? I am also using the profilematic forced billboard update, is this the reason for the "lag"?"

MK99 2013-02-16 22:19

Re: [Support thread] Billboard Standby Screen
 
1 Attachment(s)
Code:

#!/usr/bin/python

import QmSystem

batt = QmSystem.QmBattery()
if batt.getBatteryState()==3:
    print "FULL"

elif batt.getChargingState()==1:
        time = batt.getRemainingChargingTime()
        result = '+ '
else:
        #time = batt.getRemainingIdleTime(QmSystem.QmBattery.NormalMode)
        #time = QmSystem.QmBattery.getRemainingTalkTime(QmSystem.QmBattery.NormalMode)
        time = batt.getRemainingActiveTime(QmSystem.QmBattery.NormalMode)
        result = '~ '
hours,mod = divmod(time,3600)
mins,secs = divmod(mod,60)

if hours>0:
        result+=str(hours)+':'
elif hours == 0:
        result+=str(hours)+':'
if mins>10:
        result+=str(mins)
elif mins<10:
        result+='0'+str(mins)
elif mins == 0:
        result+='00'+str(mins)

print result


coderus 2013-02-17 09:53

Re: [Support thread] Billboard Standby Screen
 
1 Attachment(s)
my one :)

slarti 2013-02-17 11:18

Re: [Support thread] Billboard Standby Screen
 
If we are comparing:
:)
http://i.imgur.com/FVL5s4O.png

coderus 2013-02-17 11:48

Re: [Support thread] Billboard Standby Screen
 
too many calendar and alarm events :)

btw, how you making standby screen screenshot?

thedead1440 2013-02-17 11:49

Re: [Support thread] Billboard Standby Screen
 
Quote:

Originally Posted by coderus (Post 1323427)
btw, how you making standby screen screenshot?

ScreenshotMee stays active even in LPM mode just cover proximity sensor for a few seconds :p

praveenchand 2013-02-17 11:53

Re: [Support thread] Billboard Standby Screen
 
can we apply different text colour for different section?

//edit: got it - Inline color changing ({{red}}, etc...)

TMavica 2013-02-17 11:55

http://dl.dropbox.com/u/37229054/20130217195131.png

slarti 2013-02-17 12:19

Re: [Support thread] Billboard Standby Screen
 
Quote:

Originally Posted by coderus (Post 1323427)
too many calendar and alarm events :)

btw, how you making standby screen screenshot?

I sort of agree on the alarm number but two calendar events for the coming 6 days seems to hit a sweetspot.

ScreenCapture has a timer to take the screenshot. Pretty easy with that.

genchigenbutsu 2013-02-17 13:10

Re: [Support thread] Billboard Standby Screen
 
Quote:

Originally Posted by TMavica (Post 1323431)

Whatsup? has 3 new messages?

Is that cepi's new version of whatsapp?

coderus 2013-02-17 13:27

Re: [Support thread] Billboard Standby Screen
 
Quote:

Originally Posted by genchigenbutsu (Post 1323443)
Whatsup? has 3 new messages?

Is that cepi's new version of whatsapp?

exactly .

Win7Mac 2013-02-18 15:49

Re: [Support thread] Billboard Standby Screen
 
1 Attachment(s)
I'm using this script for the signal-bar:
Code:

#!/bin/sh

percent=$(qdbus --system com.nokia.csd /com/nokia/csd/csnet com.nokia.csd.CSNet.SignalStrength.SignalPercent)
if [[ $percent -ge 25 ]]
then printf "{{yellow}}{{=$(($percent/100)).$((($percent%100)/10))$(($percent%10))}}"
else if [[ $percent -le 24 ]]
then printf "{{red}}{{=$(($percent/100)).$((($percent%100)/10))$(($percent%10))}}"
fi
fi

But when I switch on flight mode it shows the line like in attached pic.
First I was like WTF... but on a 2nd thought, this is a superb way to indicate flightmode in BB instead of signal strength, as it is either or. :D
Would be great if someone could integrate this in the above script.
Thanks.

thedead1440 2013-02-18 15:55

Re: [Support thread] Billboard Standby Screen
 
Win7Mac,

Why not add another elseif condition of 0.0-1 with the printf outputting whatever you want and your second condition of -le 24 can become -le 24 && -ge 0.0-1 or something like that...

Win7Mac 2013-02-18 16:05

Re: [Support thread] Billboard Standby Screen
 
yeah... "or something like that..." call me dumb, but I can't get it to show correctly...
I would like to have the bar present all the time, even if signal-% is zero. Only if flightmode is activated it should display "flightmode" instead.

Also, it appears to me the script gets screwed because there is no value to read from when in flightmode, so it's not only a matter of numbers, but if the GPRS module is active or not.

slarti 2013-02-18 16:50

Re: [Support thread] Billboard Standby Screen
 
the condition you're looking for is:

Code:

if [$percent -eq -1]
then echo -n "flightmode on"
fi

Or something like that...:D

Edit: This actually won't work. How do you test for negative integers in sh?


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

vBulletin® Version 3.8.8