maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Alternatives (https://talk.maemo.org/forumdisplay.php?f=36)
-   -   [KDE] battery monitor (https://talk.maemo.org/showthread.php?t=17090)

albright 2008-02-23 17:52

[KDE] battery monitor
 
There's another thread that shows how to use python
to control the LEDs; this can be easily integrated into
a battery monitor script so that when your battery gets
below a certain level the LEDs start blinking red.

For example, here's my battery monitor script:

Code:

#!/bin/sh
X=`battery-status | awk '{print $4}'`
if [ ${#X} -lt 5 ]
then
  play-sound /usr/local/kde/share/sounds/KDE_Notify.wav &
  kdialog --title "Battery Status" --msgbox ". . . . . . . . .  $X  . . . . . . . . ." &
  python /home/user/blinkenlight &
fi

This runs every 10 minutes via cron (yes, if you look you
can find a cron that runs on the n810).

the python script looks like this (thanks to eber42):

Code:

#! /usr/bin/python

import time
import dbus
bus = dbus.SystemBus()
obj = bus.get_object('com.nokia.mce','/com/nokia/mce/request')
iface = dbus.Interface(obj,dbus_interface='com.nokia.mce.request')
led_pattern = 'PatternError'

# led on
iface.req_led_pattern_activate(led_pattern)

# wait 5s
time.sleep(5)

# led off
iface.req_led_pattern_deactivate(led_pattern)

Well, it's fun if nothing else ...

Duncan 2008-02-23 21:25

Re: battery monitor
 
You can control the LED from a shell script: no need for Python for something this simple. See Changing the led colour indicators?

albright 2008-02-23 22:26

Re: battery monitor
 
thanks for that - much "cleaner"

Is there any central collection of "how to control your
tablet" tutorials and such that deals with things like
controlling LEDs etc?

jamesc760 2008-03-03 21:45

Re: battery monitor
 
no, there's not a central place for these types of info. you have search/google/hunt for them all over the interweb. i know it sux, but iiwii and it's something we all learn to tolerate.

tso 2008-03-03 22:49

Re: battery monitor
 
sadly...

there is a wiki on this page, dropping it there would be a nice start. or at the very least a link.

hmm, a gui front end for cron is maybe something this
tablet could make use off...


All times are GMT. The time now is 23:52.

vBulletin® Version 3.8.8