![]() |
Mini how-to: displaying current prepaid balance on desktop (e-plus, germany)
First of all I should mention that I don't have a clue where to post this how-to. So I put it to General. If it's not the right place, please move it. :o
OK, in germany there is a provider called e-plus who changed the way of telling the current balance in last summer. Actually, when querying *100# (thanks god for ussd-widget!!) the user gets a message saying, that the balance will be sent by SMS within the next moments. The SMS arrives, but ussd-widget of course still shows the intermediate message. This was very annoying for me so I figured out a way to get the balance right on the desktop. All you need is the packages ussd-widget and desktop-command-execution. Please keep in mind that installing 3rd-party software and executing this how-to might kill a randomly selected kitten somewhere in the suburbs. But probably not :rolleyes: Step 1: install and configure one instance of ussd-widget. At least you need to fill in the field for the ussd code; it must contain '*100#' (without the quotes). Make sure it works and you receive the SMS containing the balance. There must be at least one of these SMSs stored on your phone to get this how-to to work. Step 2: install desktop-command-execution. There is no need to put one of the pre-defined commands on your desktop if you don't want to. Step 3: create a file in your home folder (should not be placed in MyDocs as this is a sometimes-unmounted-FAT-filesystem and I just don't know if a script can get executed from there reliable) copy the following code to it and make it executable. Step-by-step: Assumed the file is called /home/user/Guthaben.sh type the following into the terminal (as user, not root): Code:
cat > /home/user/Guthaben.shCode:
#!/bin/shInstead of the described command you might use any other editor or whatever-tool-you-like, as long as it is able to write a standard textfile. Now make the script executable (again: in terminal): Code:
chmod u+x /home/user/Guthaben.shCode:
/home/user/Guthaben.sh <enter>Last step: put one instance of desktop-command-execution on your desktop and go to the settings. Push "add cmd" and enter the path and filename to your script (i.e.: /home/user/Guthaben.sh) into the field "Command:". In the field "Title:" you may put whatever you like, I used 'Guthaben'. You just have to remember it :rolleyes:. Save the settings. The just added command should now be selected. If not, open the command list and select it (now you need to remember the name you gave it). Adjust the other options to your needs and save the widget. If nothing went bad, you should see your actual balance on desktop. :D For convenience I modified the output of ussd-widget, as the complete answer from e-plus is too ugly to have it on desktop all day. Now the answer is displayed in a short note and the widget just changes it's name. This is what I did (just the names of the fields I changed and their value): Name: Guthaben Parser for widget: echo "Kto abgefragt" Enable banner: yes Parser: echo "%" Font: Nokia Sans Cn Regular 16 Have fun! :) |
Re: Mini how-to: displaying current prepaid balance on desktop (e-plus, germany)
I think the remaining balance will be displayed in the next public Maemo5 update after you have called somebody in case the mobile provider sends out a short message about the remaining money after a call.
At least it works here so far (but I use Vodafone CZ and run a non-public version)... |
Re: Mini how-to: displaying current prepaid balance on desktop (e-plus, germany)
Quote:
Quote:
would be nice to hear wether this also works for other providers or even in other countries. didn't think about it til now. |
Re: Mini how-to: displaying current prepaid balance on desktop (e-plus, germany)
I wonder how Nokia forgot to add this!
- Where I live, after I make a call I get a sms showing the last call charge and remaining balance left, and this phone doesn't seem to do that. - I also would like to know how I can send a USSD sms. I could not understand the techie stuff you said in the above posts. Sorry :( |
Re: Mini how-to: displaying current prepaid balance on desktop (e-plus, germany)
Quote:
What I was talking about is another constellation: my provider doesn't send me a SMS after each call I make, I have to query it by sending a special USSD code. Formerly the answer -- containing the actual balance -- was send as reply to this code but it was changed to the described behaviour. Quote:
|
Re: Mini how-to: displaying current prepaid balance on desktop (e-plus, germany)
I think, that this task can be done in a better way. You can use ussd-widget's parser option to start some script after the query was made. In that script you can wait for SMS and show balance on widget itself. The only issue is that parser invocation is sinchronous and would cause hildon-home to freese unil it runs. But, if you are intereted in this scenario, I can make is asinchronous.
Quote:
|
Re: Mini how-to: displaying current prepaid balance on desktop (e-plus, germany)
Quote:
|
Re: Mini how-to: displaying current prepaid balance on desktop (e-plus, germany)
If your operator don't charge you for requesting your balance, why should you bother send or not to send one more query. While implementing widgetI've sent more than 1000 queries. And main advantage is that you don't need to click twice. You even don't need to click at all if you set automatic update functionality (but then you wouldneed to find a way to make a phone to be silent and not to wibrate, whan you expect SMS from operator).
|
Re: Mini how-to: displaying current prepaid balance on desktop (e-plus, germany)
Quote:
Why should I ask for my balance every day when I know, my last fee requiring action was some days ago and there is no difference to display? The reason for having it always displayed on screen is an obvious one: If the balance is near zero I get reminded to spend some money again. I don't like automatic charging or charge by time interval. If I would want this I wouldn't use prepaid. |
Re: Mini how-to: displaying current prepaid balance on desktop (e-plus, germany)
As there just has been the question of how to adapt this script to his own needs, I'll try to explain by example how the extraction of the neccessary information works.
First of all: it all depends on the structure of the SMS you receive with the account balance or data plan balance (you lucky guys, I have no chance to get the data plan usage by SMS). As an example, this is the SMS I receive when calling *100#: Code:
Ihr Guthaben für <HEREISMYPHONENUMBER> berträgt <XX,YY> EUR.We are using the database from RTCOM eventlogger, where the SMS are stored: Code:
sqlite3 -separator ": " /home/user/.rtcom-eventlogger/el.dbCode:
SELECT strftime('%d.%m.%Y',storage_time,'unixepoch','localtime'), free_textCode:
FROM Events WHERE event_type_id = '7' AND free_text LIKE 'Ihr Guthaben%' ORDER BY end_time DESC LIMIT 1"Code:
sed s/Ihr.*gt\ //Code:
sed s/.EUR./€/The output in this example looks as follows: Code:
04.03.2010: 17.21€ |
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.Code:
CHF 1.20 - 122.19 MBCode:
sqlite3 -separator ": " /home/user/.rtcom-eventlogger/el.db \ |
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? |
Re: Mini how-to: displaying current prepaid balance on desktop (e-plus, germany)
Quote:
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! |
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 ;) |
Re: Mini how-to: displaying current prepaid balance on desktop (e-plus, germany)
Quote:
Quote:
Quote:
Quote:
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 ;) |
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...." |
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. |
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. |
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 |
Re: Mini how-to: displaying current prepaid balance on desktop (e-plus, germany)
Quote:
|
Re: Mini how-to: displaying current prepaid balance on desktop (e-plus, germany)
Quote:
But reply filtration is done in another way. So you would have to figure out what regular expression you need if you want show only necessary information from the SMS. |
| All times are GMT. The time now is 07:07. |
vBulletin® Version 3.8.8