View Full Version : [Request] Custom profile depending of the time of day
backd00r
12-25-2009, 03:59 PM
Hi!
I was thinking in create some tasks on crontab to customize the way my N900 behaves during the day, like:
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
12-25-2009, 04:20 PM
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
12-25-2009, 04:38 PM
Thanks for you comments @ruskie.
Maybe these examples can be a good start:
http://wiki.maemo.org/Phone_control#DBUS
Regards,
Javi
mysticrokks
12-25-2009, 04:51 PM
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
12-25-2009, 05:13 PM
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
Ooh I am looking for something like this.
*pir followes this thread
This would be an awesome feature for the N900.
I will be following this as well :)
rash.m2k
12-28-2009, 09:22 AM
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
12-28-2009, 09:24 AM
thanks for that dbus link - I'll be able to cook something up quite easily.
thanks for that dbus link - I'll be able to cook something up quite easily.
http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Using_Generic_Platform_Components/Alarm_Framework
Maybe that is useful too :)
-edit- Also, here:
http://talk.maemo.org/showpost.php?p=375763&postcount=5
RevdKathy
12-28-2009, 10:05 AM
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
12-28-2009, 10:08 AM
heres what i get when i launch dbus monitor and change profiles:
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
12-28-2009, 10:23 AM
solved!!!!
Heres the command to change profies:
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!!!!
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
12-28-2009, 12:50 PM
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-final/libalarm/libalarm_8h.html#cc8e6f439d134448001132132476683c0 931eeb2bf1b3cd869947313667686b2
callerid
12-28-2009, 01:37 PM
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
12-28-2009, 01:41 PM
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
01-14-2010, 07:17 AM
I found some applications for Android that could be implemented in Maemo:
Locale for Android (http://www.twofortyfouram.com/)
SweetDreams (http://www.inizziativa.com/blog/sweetdreams-ganadora-absoluta-y-por-categoria-del-adc2/) (nformation in Spanish)
Regards,
Javi
stobbsc
01-14-2010, 07:24 AM
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
01-14-2010, 08:00 PM
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
01-14-2010, 08:51 PM
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
02-03-2010, 05:29 PM
I've put together the tips in this thread and some others from here (http://talk.maemo.org/showpost.php?p=467732&postcount=7) (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:
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_3.0.1-2_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
02-03-2010, 06:05 PM
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
02-03-2010, 06:12 PM
There is already an app for this - http://maemo.org/packages/view/ses/
pyllyukko
02-04-2010, 02:20 AM
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/automagic-profile-switching-for-the-n900/.
rooted
02-04-2010, 04:09 AM
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...
The cron solution works well!
rooted
02-07-2010, 01:25 PM
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
02-07-2010, 02:12 PM
You should be safe to remove it. Or point it to /var/run/fcron that's where it usually goes.
rooted
02-12-2010, 06:29 PM
I have another question. Why did you use "adduser", which had to be downloaded and installed instead of already-present "useradd"?
ruskie
02-13-2010, 09:10 AM
I just mentioned one... hell the first time I added it by hand nothing really hard there. You can use whichever you want.
rooted
03-14-2010, 04:34 PM
http://talk.maemo.org/showthread.php?t=47369
http://wiki.maemo.org/Fcron
lemmyslender
03-14-2010, 08:32 PM
i know that alarmed (http://talk.maemo.org/showthread.php?t=46594) 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.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.