maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   [Request] Custom profile depending of the time of day (https://talk.maemo.org/showthread.php?t=38417)

backd00r 2009-12-25 20:59

[Request] Custom profile depending of the time of day
 
Hi!

I was thinking in create some tasks on crontab to customize the way my N900 behaves during the day, like:

Code:

M,W,F at 07:50 wake up alarm, start 3G + connect to Internet and start mail application.
M,W,F at 08:30 start bluetooth and link to my car handsfree.
M,W,F at 09:15 stop bluetooth.
T at 06:22 wake up alarm.

etc...etc.

Most of us know what we do during the week and would be a good idea to have an application that would allow us to automate these tasks with our N900

ruskie 2009-12-25 21:20

Re: [Request] Custom profile depending of the time of day
 
Well I really only wanted to automate the profile setting from general to silent. Built and installed fcron(because it sleeps between events) and set it all up so I actually have that :)

For the rest I haven't looked into it really. But generally you should be able to do it with dbus-send(that's how the profile setting works).

backd00r 2009-12-25 21:38

Re: [Request] Custom profile depending of the time of day
 
Thanks for you comments @ruskie.

Maybe these examples can be a good start:
http://wiki.maemo.org/Phone_control#DBUS

Regards,
Javi

mysticrokks 2009-12-25 21:51

Re: [Request] Custom profile depending of the time of day
 
your life is so samey,, i cannot believe u would really need or want to do this-- but running macro type could be usefull i suppose..

mysticrokks 2009-12-25 22:13

Re: [Request] Custom profile depending of the time of day
 
the fact taht you want things tunred on and off at times means that the nokia fails in the battery stakes-

which it certainly doies for me.. i carry two batterys

pir 2009-12-28 12:38

Re: [Request] Custom profile depending of the time of day
 
Ooh I am looking for something like this.
*pir followes this thread

Apox 2009-12-28 13:17

Re: [Request] Custom profile depending of the time of day
 
This would be an awesome feature for the N900.
I will be following this as well :)

rash.m2k 2009-12-28 14:22

Re: [Request] Custom profile depending of the time of day
 
crontab can schedule things to do at specific times.

it will be easy enough for you to create a script to set different profiles at different times of the day, assuming you are able to get access to it from the command line, closest command i've seen has been profiled however it does not seem to respond to the --help parameter.

rash.m2k 2009-12-28 14:24

Re: [Request] Custom profile depending of the time of day
 
thanks for that dbus link - I'll be able to cook something up quite easily.

pir 2009-12-28 14:31

Re: [Request] Custom profile depending of the time of day
 
Quote:

Originally Posted by rash.m2k (Post 443888)
thanks for that dbus link - I'll be able to cook something up quite easily.

http://wiki.maemo.org/Documentation/...larm_Framework

Maybe that is useful too :)

-edit- Also, here:
http://talk.maemo.org/showpost.php?p=375763&postcount=5

RevdKathy 2009-12-28 15:05

Re: [Request] Custom profile depending of the time of day
 
This is certainly a development I could get behind. It's something I would find particularly useful. If you know how to create it, then Yes Please from me. :)

rash.m2k 2009-12-28 15:08

Re: [Request] Custom profile depending of the time of day
 
heres what i get when i launch dbus monitor and change profiles:

Quote:

ethod call sender=:1.3 -> dest=com.nokia.profiled serial=85 path=/com/nokia/profiled; interface=com.nokia.profiled; member=get_values
string "silent"
method return sender=:1.1 -> dest=:1.3 reply_serial=85
array [
struct {
string "calendar.alarm.enabled"
string "Off"
string "BOOLEAN"
}
struct {
string "clock.alarm.enabled"
string "On"
string "BOOLEAN"
}
struct {
string "email.alert.tone"
string "/usr/share/sounds/Emailalert1.aac"
string "SOUNDFILE"
}
struct {
string "email.alert.volume"
string "0"
string "INTEGER 0-100"
}
struct {
string "im.alert.tone"
string "/usr/share/sounds/chat-msg_in_bg.wav"
string "SOUNDFILE"
}
struct {
string "im.alert.volume"
string "0"
string "INTEGER 0-100"
}
struct {
string "keypad.sound.level"
string "0"
string "INTEGER 0-2"
}
struct {
string "ringing.alert.tone"
string "/usr/share/sounds/NokiaTune.aac"
string "SOUNDFILE"
}
struct {
string "ringing.alert.type"
string "silent"
string "STRING "Ringing" "Silent""
}
struct {
string "ringing.alert.volume"
string "0"
string "INTEGER 0-100"
}
struct {
string "sms.alert.tone"
string "/usr/share/sounds/Message1.aac"
string "SOUNDFILE"
}
struct {
string "sms.alert.volume"
string "0"
string "INTEGER 0-100"
}
struct {
string "system.sound.level"
string "0"
string "INTEGER 0-2"
}
struct {
string "touchscreen.sound.level"
string "0"
string "INTEGER 0-2"
}
struct {
string "vibrating.alert.enabled"
string "On"
string "BOOLEAN"
}
]
method call sender=:1.66 -> dest=com.nokia.profiled serial=22 path=/com/nokia/profiled; interface=com.nokia.profiled; member=get_value
string "silent"
string "system.sound.level"
method return sender=:1.1 -> dest=:1.66 reply_serial=22
string "0"
method call sender=:1.66 -> dest=com.nokia.profiled serial=23 path=/com/nokia/profiled; interface=com.nokia.profiled; member=get_value
string "silent"
string "system.sound.level"
method return sender=:1.1 -> dest=:1.66 reply_serial=23
string "0"
^C
~ $

rash.m2k 2009-12-28 15:23

Re: [Request] Custom profile depending of the time of day
 
solved!!!!

Heres the command to change profies:

Quote:

dbus-send --type=method_call --dest=com.nokia.profiled /com/nokia/profiled --print-reply com.nokia.profiled.set_profile string:"silent"
However it appears there is not Crontab installed on the N900!!!!

pir 2009-12-28 15:28

Re: [Request] Custom profile depending of the time of day
 
Quote:

Originally Posted by rash.m2k (Post 443958)
solved!!!!

Heres the command to change profies:



However it appears there is not Crontab installed on the N900!!!!

I noticed that too. That is why I posted that link (a few posts ago)

rash.m2k 2009-12-28 17:50

Re: [Request] Custom profile depending of the time of day
 
Quote:

Originally Posted by pir (Post 443968)
I noticed that too. That is why I posted that link (a few posts ago)

Sorry I didn't read the whole list - however this person seems to have done it, although its with Maemo 4.0

http://www.gossamer-threads.com/lists/maemo/users/35685

This here also seems promising, specifically ALARM_ACTION_TYPE_DBUS :

http://maemo.org/api_refs/5.0/5.0-fi...947313667686b2

callerid 2009-12-28 18:37

Re: [Request] Custom profile depending of the time of day
 
Will it change profile based on key words in the calendar? E.g. "meeting" will send it into silent, and end of meeting back into normal profile?

rash.m2k 2009-12-28 18:41

Re: [Request] Custom profile depending of the time of day
 
I think that would require too much parsing of data, perhaps a little too much for a script. but in place of crontab I think it may do just fine.

backd00r 2010-01-14 12:17

Re: [Request] Custom profile depending of the time of day
 
I found some applications for Android that could be implemented in Maemo:

Locale for Android
SweetDreams (nformation in Spanish)

Regards,
Javi

stobbsc 2010-01-14 12:24

Re: [Request] Custom profile depending of the time of day
 
This sounds similar to the app for symbian called best profiles.
It would be great for start if someone could create a GUI for auto profile switching from general to silent and back at predefinied time.

airjordan17 2010-01-15 01:00

Re: [Request] Custom profile depending of the time of day
 
I'd like to suggest another feature as part of this request: toggle vibrate on/off for the profile that is set at a specific time. For example, at night, set the phone to "silent" profile and also disable vibrate.

janszoon 2010-01-15 01:51

Re: [Request] Custom profile depending of the time of day
 
sounds cool. I always used to think it would have been cool to switch to '' profile based on Bluetooth or WIFI connection. i.e when detected at my work computer, silent profile activate automatically, when home computer detected, 'general' profile activated....but doing it to times would also be a good/better option.

something that triggers due to 'actual activity' i'e Bluetooth found, wifi detected etc etc would ensure you could be flexible with your time.

*subscribed*

simoneb 2010-02-03 22:29

Re: [Request] Custom profile depending of the time of day
 
I've put together the tips in this thread and some others from here (with thanks to ruskie) and I came up with this not-exactly-easy guide to setup timed profiles.

I've made two scripts, profile_general.sh and profile_silent.sh, to set the profile to general or silent, then setup fcron to run these scripts at specific times.

And this is how I did it:
Quote:

cd /home/user
mkdir Scripts
cd Scripts
create a file named "profile_general.sh", containing:
#!/bin/sh
dbus-send --type=method_call --dest=com.nokia.profiled /com/nokia/profiled com.nokia.profiled.set_profile string:"general"

and "profile_silent.sh", containing
#!/bin/sh
dbus-send --type=method_call --dest=com.nokia.profiled /com/nokia/profiled com.nokia.profiled.set_profile string:"silent"


cd /home/user/MyDocs/.documents
wget https://repo.codemages.net/opt/fcron..._armel_opt.deb --no-check-certificate
dpkg -i fcron_3.0.1-2_armel_opt.deb

sudo gainroot

I haven't tested it, but I think you can create a fcron user with:
useradd fcron
if that doesn't work, then install adduser:
apt-get install adduser --allow-unauthenticated
adduser fcron

setup fcrontab:
chown fcron:fcron /etc/fcron.*
chown -R fcron:fcron /var/spool/fcron

EDIT --- editing rcS-late is generally a bad idea and should be avoided. The script will break across upgrades, for instance. See instead the setup of the startup script here: http://wiki.maemo.org/Fcron#Installation
if you still want to edit /etc/event.d/rcS-late, after "initctl emit MOUNTS_OK", add:
/etc/init.d/fcron start
--- from here on everything should be ok.

and now, the cron jobs:
export EDITOR=vim
fcrontab -e
i have entered the following jobs:
0 8 * * 1-5 run-standalone.sh /home/user/Scripts/profile_general.sh
0 9 * * 1-5 run-standalone.sh /home/user/Scripts/profile_silent.sh
30 12 * * 1-5 run-standalone.sh /home/user/Scripts/profile_general.sh
30 13 * * 1-5 run-standalone.sh /home/user/Scripts/profile_silent.sh
0 18 * * 1-5 run-standalone.sh /home/user/Scripts/profile_general.sh
59 23 * * 0-4 run-standalone.sh /home/user/Scripts/profile_silent.sh
0 11 * * 6,0 run-standalone.sh /home/user/Scripts/profile_general.sh
0 2 * * 6,0 run-standalone.sh /home/user/Scripts/profile_silent.sh

back to the shell, type:
/etc/init.d/fcron start
it is set up to be silent from 8:00 to 18:00 (with a pause from 12:30 to 13:30) and from 00:00 to 8:00, except on saturday and sunday when it will be silent from 2:00 to 11:00.

The "export EDITOR=vim" is needed because fcrontab -e will look for vi in /scratchbox/tools/bin/vi and I don't have it there.
*maybe* you can use an editor other than vim. maybe also one with a GUI.

Frank Banul 2010-02-03 23:05

Re: [Request] Custom profile depending of the time of day
 
You sir, are my hero. I was threatening to write an application last night when I turned my phone off before bed.

Here are some additional calls others may find handy. Someone adding bluetooth would make this complete I think.

Turn off cellular:
dbus-send --system --type=method_call --dest=com.nokia.phone.SSC /com/nokia/phone/SSC com.nokia.phone.SSC.set_radio boolean:false

Turn on cellular:
dbus-send --system --type=method_call --dest=com.nokia.phone.SSC /com/nokia/phone/SSC com.nokia.phone.SSC.set_radio boolean:true

Turn off WiFi:
dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true

Flight mode:
dbus-send --system --type=signal /com/nokia/mce/signal com.nokia.mce.signal.sig_device_mode_ind string:"flight"

Normal mode:
dbus-send --system --type=signal /com/nokia/mce/signal com.nokia.mce.signal.sig_device_mode_ind string:"normal"

Frank

dsawhney 2010-02-03 23:12

Re: [Request] Custom profile depending of the time of day
 
There is already an app for this - http://maemo.org/packages/view/ses/

pyllyukko 2010-02-04 07:20

Re: [Request] Custom profile depending of the time of day
 
Quote:

Originally Posted by dsawhney (Post 509532)
There is already an app for this - http://maemo.org/packages/view/ses/

Simon here has even written a blog post on how to use it: http://knownokia.ca/2010/02/02/autom...-for-the-n900/.

rooted 2010-02-04 09:09

Re: [Request] Custom profile depending of the time of day
 
But ses has LOTS of bugs. First its portrait UI. It's a bug not a feature, because it's not consistent with current Maemo and doesn't work properly. For example when you tap the dashboard button too much is highlighted and so on. Also sometimes when you add an entry it displays wrong hour in the list. For example I added an entry with 8.00 and ses added it to list as 7.26. And it doesn't even uninstall properly. For me it was still switching profiles after the uninstall so I had to delete it manually.

I'll use fcron as it also doesn't limit me. I can schedule just about anything...

pir 2010-02-06 09:31

Re: [Request] Custom profile depending of the time of day
 
The cron solution works well!

rooted 2010-02-07 18:25

Re: [Request] Custom profile depending of the time of day
 
I'm using fcron too and I have a question. fcron needs user "fcron" to be run. However, when I added fcron user with "adduser fcron" its home directory was created. My question is if I can safely remove /home/fcron/ or is it needed by fcron/Maemo?

ruskie 2010-02-07 19:12

Re: [Request] Custom profile depending of the time of day
 
You should be safe to remove it. Or point it to /var/run/fcron that's where it usually goes.

rooted 2010-02-12 23:29

Re: [Request] Custom profile depending of the time of day
 
I have another question. Why did you use "adduser", which had to be downloaded and installed instead of already-present "useradd"?

ruskie 2010-02-13 14:10

Re: [Request] Custom profile depending of the time of day
 
I just mentioned one... hell the first time I added it by hand nothing really hard there. You can use whichever you want.

rooted 2010-03-14 20:34

Re: [Request] Custom profile depending of the time of day
 
http://talk.maemo.org/showthread.php?t=47369
http://wiki.maemo.org/Fcron

lemmyslender 2010-03-15 00:32

Re: [Request] Custom profile depending of the time of day
 
i know that alarmed is mentioned in the wiki linked to in the previous post, but as of the next build (one little bug to be fixed once the autobuilder is working) it should support profile switching built in. With the GUI it is a great option for thos leary of the command line.


All times are GMT. The time now is 16:17.

vBulletin® Version 3.8.8