maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   General (https://talk.maemo.org/forumdisplay.php?f=7)
-   -   Mini how-to: displaying current prepaid balance on desktop (e-plus, germany) (https://talk.maemo.org/showthread.php?t=46322)

x-lette 2010-03-07 15:47

Re: Mini how-to: displaying current prepaid balance on desktop (e-plus, germany)
 
Here is an example of a SMS which also includes usage and remaining traffic of the data plan. Carrier is sunrise in switzerland, the currency is CHF which cannot be converted to a nice symbol. (I guess no one yet found out how to make a symbol for chocolate :D)

Code:

Ihre aufgelaufenen Kosten ohne Abogebühr: CHF 1.20. Limite: CHF 5,000. Stand: 27.02.2010 11:49.Verbleibende Inklusiv-Leistungen:122.19 MB (surf) gültig bis 06.03.2010.
Angaben ohne Gewähr. Details unter www.sunrise.ch/costcontrol

The output shall look like

Code:

CHF 1.20 - 122.19 MB
Here we go: USSD-Widget has to setup to using code "*133#" which is the one used by this carrier. One instance of DCE has to get installed the same way as described in post #1, using the following code:

Code:

sqlite3 -separator ": " /home/user/.rtcom-eventlogger/el.db \
 "SELECT free_text FROM Events WHERE event_type_id = '7' AND free_text LIKE 'Ihre aufgelaufenen Kosten%' ORDER BY end_time DESC LIMIT 1"\
 | sed s/Ihr.*hr:.// | sed s/..Limite.*ungen:/' - '/ | sed s/..surf.*$//


moerderameise 2010-03-07 16:25

Re: Mini how-to: displaying current prepaid balance on desktop (e-plus, germany)
 
First of all i have to say thank you for editing the script to fit with sunrise ;)
I tried it out and have a problem. When i test the script in xterm it seems to work, even when i think the displayed infos aren't right right now, but when i try to put the script in a widget it only showes "invalid command"
I wrote the chmod line as root in xterm and into the dce i wrote /home/user/Guthaben.sh (where the file is)

what can be wrong?
When i tipe in xterm as user the file can't be opened, as root it works. is that wright?

x-lette 2010-03-07 16:36

Re: Mini how-to: displaying current prepaid balance on desktop (e-plus, germany)
 
Quote:

Originally Posted by moerderameise (Post 558829)
First of all i have to say thank you for editing the script to fit with sunrise ;)
I tried it out and have a problem. When i test the script in xterm it seems to work, even when i think the displayed infos aren't right right now, but when i try to put the script in a widget it only showes "invalid command"
I wrote the chmod line as root in xterm and into the dce i wrote /home/user/Guthaben.sh (where the file is)

what can be wrong?
When i tipe in xterm as user the file can't be opened, as root it works. is that wright?

Did you follow the steps in first posting? I just described the changes you have to make to USSD-Widget and inside the script I called Guthaben.sh. Don't create this skript as root but as user, i.e. open an xterm and right begin to edit the file, don't 'root up'. If the file is already owned by root you can re-own it to user by typing (as root):

chown user Guthaben.sh

Doing an "ls -l" will show you exactly the owner of the file.

Inside DCE you just call the script, not the sqlite command or the sed commands!

moerderameise 2010-03-07 17:03

Re: Mini how-to: displaying current prepaid balance on desktop (e-plus, germany)
 
ok ok now it works ;)

but it is displayed like this:

CHF 0.00249.88 MB

so there is no "-" between the different things. how to fix it?

and another question:

now i click on the ussd widget to get the sms, then the sms arrives and the dce shows the actual costs. but the sms is still unread and so the led blinks until i read the sms. is it also possible to mark the sms as read through the script? and the incomming message desktop widget shows also the unread sms. is there also a way to fix this?
and last: is it possible to execute the script once a day automaticly? so that i have not to click onto the ussd widget? would save me space on the desktop ;)

x-lette 2010-03-07 17:20

Re: Mini how-to: displaying current prepaid balance on desktop (e-plus, germany)
 
Quote:

Originally Posted by moerderameise (Post 558865)
ok ok now it works ;)

but it is displayed like this:

CHF 0.00249.88 MB

so there is no "-" between the different things. how to fix it?

Ooops, my failure, didn't insert the spaces and the dash. :o Will fix it in the original post.

Quote:

and another question:
You're welcome ;)

Quote:

now i click on the ussd widget to get the sms, then the sms arrives and the dce shows the actual costs. but the sms is still unread and so the led blinks until i read the sms. is it also possible to mark the sms as read through the script? and the incomming message desktop widget shows also the unread sms. is there also a way to fix this?
In fact, I don't know. I guess there are several points where an SMS might be marked as read/unread. But even if there is only one single field in the database it would need a writing access to this database which is what I want to avoid. Until now all accesses to the database are read-only and therefore cannot be harmful in any way to the system. Implementing a read/write-access would lead to many checkings and I would have to take care about consitency all over the device. That's pretty way out of goal. Therefore: no, I won't implement a check-as-read-feature. :rolleyes:

Quote:

and last: is it possible to execute the script once a day automaticly? so that i have not to click onto the ussd widget? would save me space on the desktop ;)
There are several tools which offer you a kind of cron-like behaviour, i.e. executing a command at a defined interval. But as far as I know they all are not really stable and still reside in -devel. If you dare installing them you might set up a daily execution of a USSD command line.

But if you just want to save space, you also might shorten the title of the widget. A single character doesn't take much space on desktop ;)

moerderameise 2010-03-07 17:42

Re: Mini how-to: displaying current prepaid balance on desktop (e-plus, germany)
 
Hmm ok then lets forget my questions ;)

but to your point to make the ussd widget smaller: i did what you wrote in first post but it didn't change anythin... still the fat text "Vielen Dank für Ihre Anfrage blablabla...."

x-lette 2010-03-07 17:55

Re: Mini how-to: displaying current prepaid balance on desktop (e-plus, germany)
 
Which version of USSD-Widget do you use? Might be it was implemented in a version which still is only in -devel. In current version there is a a field called "Parser for widget" which will rewrite the output.

Here are my current settings for USSD-Widget:
USSD number: *100#
Execute query on start: no
Name: Guthaben abfragen
Parser for widget: echo "Guthaben abfragen"
Enable banner: yes
Parser: echo "%"
Chain: <empty>
Regular expression: <empty>
Update every 0 minutes
Retry pattern: 10-30-300

Most of these settings are well documented via the question sign beneath them.

Forgot to mention: the point where you can shorten the output for space saving is to replace both strings "Guthaben abfragen" by something you like.

And if you don't want to see the answer at all you might also want to disable banner, which puts the answer as a temporary banner over your desktop, just like any incoming message.

moerderameise 2010-03-07 18:09

Re: Mini how-to: displaying current prepaid balance on desktop (e-plus, germany)
 
ok now it worked. had to restart the widget and than changes took effekt.
thank you very much ;) looks good.

KiberGus 2010-03-13 11:42

Re: Mini how-to: displaying current prepaid balance on desktop (e-plus, germany)
 
New version has support for taking reply from SMS. Please test, if it works. Some instructions are available here:
http://kibergus.su/node/19

moerderameise 2010-03-15 08:56

Re: Mini how-to: displaying current prepaid balance on desktop (e-plus, germany)
 
Quote:

Originally Posted by KiberGus (Post 565961)
New version has support for taking reply from SMS. Please test, if it works. Some instructions are available here:
http://kibergus.su/node/19

Don't know how to set up... Will look at it today or tomorrow maybe i get it worked. If i understand you right, it showes the costs just like the script, so it would not longer be necessary?


All times are GMT. The time now is 07:07.

vBulletin® Version 3.8.8