maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   N900 as internet alarm clock radio (https://talk.maemo.org/showthread.php?t=64519)

rotoflex 2010-10-27 21:59

N900 as internet alarm clock radio
 
This sets up the N900 as an internet alarm clock radio, connecting to home Wi-Fi & starting PyRadio at a desired time.

It requires the applications Alarmed and PyRadio.
Thanks to Nicolai for indicating the command line solutions at
http://wiki.maemo.org/Phone_control#Networking

The basic setup is:
1. Determine the Internet Access Point ID of your home ID
2. Create a timed command in Alarmed to connect to Wi-Fi at that IAP_ID
3. Create a timed command in Alarmed to start PyRadio shortly after connecting to Wi-Fi
4. Create a standard alarm in Alarmed for 10 or 30 minutes later, in case Wi-Fi or Pandora is down, for safety

-- Details of procedure:-

1. Discover the ID for your home wi-fi in the saved connections:

1a. In XTerminal type
gconftool -R /system/osso/connectivity/IAP

1b. Look in the text which returns for the line
name = [name of your home wi-fi]

1c. look a couple of lines lower for the line
/system/ossoconnectivity/IAP/ [then a long string of characters]

1d. The long string of characters is the IAP_ID of your home Wi-Fi.

1e. Copy & paste may not work from XTerminal, so minimize it so that you may refer to it again for the IAP_ID in a later step

2. Create a timed command in Alarmed to connect to Wi-Fi at that IAP_ID:

2a. Open Alarmed, then New Event

2b. Change Event Type from "Alarm" to "Command Execution"

2c. Change interval from "Every Minute" to "Daily"

2d. Name it "Clockradio Wi-Fi connect" or something

2e. Change "Time" to 5 minutes *before* you want the radio to play

2f. Change "Enter Command" to
dbus-send --system --type=method_call --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:* uint32:0

(All on one line, note the spaces, substitute your IAP_ID for *)

2g. Save the Event.

3. Create a timed command in Alarmed to start PyRadio

3a. Open Alarmed, then New Event

3b. Change Event Type from "Alarm" to "Command Execution"

3c. Change interval from "Every Minute" to "Daily"

3d. Name it "Daily ClockRadio" or something

3e. Change "Time" to the time you want the radio to play

3f. Change "Enter Command" to
/opt/pyRadio/pyRadio.py

3g. Save the Event.

4. Create a standard alarm in Alarmed for 10 or 30 minutes later, in case Wi-Fi or Pandora is down, for safety

If no typos, etc., at the set times connection to wi-fi will be made, and pyRadio will start up, on your last Pandora station at whatever volume you have left it. X minutes later a regular alarm will go off, just in case.

sixwheeledbeast 2010-11-15 18:22

Re: N900 as internet alarm clock radio
 
Loved the idea of having a radio alarm clock on my N900. I adapted the idea to make it easier and also install less applications.

It also works on multiple WiFi connections, if you leave your WiFi on auto-connect!

Instead of using PyRadio I used the alarmed app to start my favourite local (internet) radio site via the media player.

I did the following...

In the Alarmed app Create a new event 'Command execution'
Select 'Weekly' and tick 'Mon-Fri' or work days
Select the 'time' to start the radio alarm
Select a name for the alarm 'Rock Radio Alarm'

I entered the following command:-

dbus-send --print-reply --dest=com.nokia.mediaplayer /com/nokia/mediaplayer com.nokia.mediaplayer.mime_open string:http://streaming.gmgradio.com/rockradiomanchester.m3u > /dev/null

If you copy this correctly you can wake up to Rock Radio Manchester in the morning.

Alternatively replace:-

http://streaming.gmgradio.com/rockradiomanchester.m3u

...for another stations address.

Examples:-

BBC Radio 1
http://sradio.tv/stream/1827.m3u

Kerrang Radio
http://sradio.tv/stream/979.m3u

Planet Rock
http://sradio.tv/stream/1828.m3u

I would also recommend using the alarmed app to create a 'Alarm' 10-15 minutes after your radio starts, incase there is no internet connection available.

fedor 2010-11-15 23:03

Re: N900 as internet alarm clock radio
 
Great work!
I was just wondering...is it possible doing all these wonderful things while the phone is off?
I mean, is it possible to create an event that triggers the phone to boot up and just then connects to wifi and later to the radio station?

RobbieThe1st 2010-11-15 23:41

Re: N900 as internet alarm clock radio
 
I'd simply keep it in "offline" mode instead of fully off - it doesn't take much battery this way, and trying to enable wifi is going to be easier than waking the whole device.

fraaaaanka 2010-11-16 12:17

Re: N900 as internet alarm clock radio
 
brilliant work sixwheeledbeast i have got the planet rock one working by copy/pasting the string but every time i try and replce the radio1 version in when it loads up i get a message stating playlist corrupted?

can anyone help by giving me the full string to copy/paste for radio1

cheers

rotoflex 2010-11-16 13:18

Re: N900 as internet alarm clock radio
 
BBC1 stream:
http://www.bbc.co.uk/radio/listen/live/r1.asx

Other BBC radio streams:
http://talk.maemo.org/showpost.php?p=548896&postcount=4

fraaaaanka 2010-11-16 13:43

Re: N900 as internet alarm clock radio
 
thanks rotoflex but im still having problems ... will try again when i get home and see how it works on my wifi

berlinermaxe 2010-11-16 14:22

Re: N900 as internet alarm clock radio
 
1 Attachment(s)
i also use alarmed application, but i run a short script to slowly increase the volume up to 70 %

the comand in alarmed looks like:
sh /home/user/MyDocs/.documents/Internetradio.sh

you can edit the file to get another radio station.

thanks

fraaaaanka 2010-11-16 22:55

Re: N900 as internet alarm clock radio
 
BRILLIANTllll

Thanks to the rotoflex for creating this really useful post with the extra info on radio1 links and thanks to ixwheeledbeast for coming up with a simple way to run it.

great work guys!!!

sixwheeledbeast 2010-12-01 17:58

Re: N900 as internet alarm clock radio
 
Update on my internet radio alarm clock.
Bit long winded, hope this helps.

I have added a few extra command executions thanks to "berlinermaxe's" idea.

The following is all the commands to create an internet radio alarm clock that increases volume over time.
-

Firstly set the volume of the device to a nice level.
This ensures the radio will start at the correct volume every day.

In the Alarmed app Create a new event 'Command execution'
Select 'Weekly' and tick 'Mon-Fri' or work days.
Set the 'time' to one minute before the radio alarm is to start.
Select a name for the alarm 'Volume Set 55'

Enter the following command:-
Code:

dbus-send --type=method_call --dest=com.nokia.mafw.renderer.Mafw-Gst-Renderer-Plugin.gstrenderer /com/nokia/mafw/renderer/gstrenderer com.nokia.mafw.extension.set_extension_property string:volume variant:uint32:55
-

Then we need to start the media player, as mentioned before "http://streaming.gmgradio.com/rockradiomanchester.m3u" can be replaced with your choice.

In the Alarmed app Create a new event 'Command execution'
Select 'Weekly' and tick 'Mon-Fri' or work days
Select the 'time' to start the radio alarm
Select a name for the alarm 'Radio Alarm'

Enter the following command:-

Code:

dbus-send --print-reply --dest=com.nokia.mediaplayer /com/nokia/mediaplayer com.nokia.mediaplayer.mime_open string:http://streaming.gmgradio.com/rockradiomanchester.m3u > /dev/null
-

Then to increase the volume, so I have set this command 5 minutes after the radio start time.

In the Alarmed app Create a new event 'Command execution'
Select 'Weekly' and tick 'Mon-Fri' or work days
Select the 'time' to increase the volume
Select a name for the alarm 'Set Volume 65'

Enter the following command:-
Code:

dbus-send --type=method_call --dest=com.nokia.mafw.renderer.Mafw-Gst-Renderer-Plugin.gstrenderer /com/nokia/mafw/renderer/gstrenderer com.nokia.mafw.extension.set_extension_property string:volume variant:uint32:65
-

Then to increase the volume again, so I have set this command 10 minutes after the radio start time.

In the Alarmed app Create a new event 'Command execution'
Select 'Weekly' and tick 'Mon-Fri' or work days
Select the 'time' to increase the volume again
Select a name for the alarm 'Set Volume 75'

Enter the following command:-
Code:

dbus-send --type=method_call --dest=com.nokia.mafw.renderer.Mafw-Gst-Renderer-Plugin.gstrenderer /com/nokia/mafw/renderer/gstrenderer com.nokia.mafw.extension.set_extension_property string:volume variant:uint32:75
-

Okay so now the radio starts and slowly you are awakening.
I now have a command to stop the radio, a command to start the alarm clock and then a command to put the volume back to full.
This then means I don't have to manually change the volume and stop the radio playing.
So in the morning; I wake up, stop the alarm and then my clever little N900 puts the volume back so the volume is correct for my car kit.

So....

To stop the radio

In the Alarmed app Create a new event 'Command execution'
Select 'Weekly' and tick 'Mon-Fri' or work days.
Select the 'time' to stop the radio.
Select a name for the alarm 'Radio Stop'

Enter the following command:-
Code:

dbus-send --type=method_call --dest=com.nokia.mafw.renderer.Mafw-Gst-Renderer-Plugin.gstrenderer /com/nokia/mafw/renderer/gstrenderer com.nokia.mafw.renderer.stop
-

To start the alarm

In the Alarmed app Create a new event 'Alarm'
Select 'Weekly' and tick 'Mon-Fri' or work days.
Select the 'time' start the alarm.

-

To put the volume to full again.

In the Alarmed app Create a new event 'Command execution'
Select 'Weekly' and tick 'Mon-Fri' or work days.
Select the 'time' to two minutes after the radio alarm will stop.
Select a name for the alarm 'Volume Set Full'

Enter the following command:-
Code:

dbus-send --type=method_call --dest=com.nokia.mafw.renderer.Mafw-Gst-Renderer-Plugin.gstrenderer /com/nokia/mafw/renderer/gstrenderer com.nokia.mafw.extension.set_extension_property string:volume variant:uint32:100
All these commands can be tweaked to personal preference's e.g.... You could have the alarm start but without the stop command, the radio will then continue to play after you silence the alarm. Or leave the radio playing and not have the alarm at all.


Hope all this helps getting your N900 radio alarm clock working.

solbrit 2011-01-17 10:13

Re: N900 as internet alarm clock radio
 
I conclude: brilliant!

Thanks to Sixwheeledbeast for easy explanation on getting the alarm set up, and thanks to Berlinermaxe for the alternative setup, allowing a smooooth wake up... No more risk of heart attack in the morning, sweet...

juahan 2011-01-27 14:42

Re: N900 as internet alarm clock radio
 
I've been waiting for a proper internet radio alarm clock application for some time, and this topic is the closest if have come to finding a proper app.

Everything in this topic is great, but still a bit hard to use compared to proper application. Would there be need for an application? I can't really write any code myself, but I would really happy to for example designing the UI (and even the program) and doing testing.

Anyone interesting in this kind of project?

Edit:

Some thoughts, that are mostly from this topic:

some specifications:
- alarm sounds:
- regular alarm-tone
- using a song/artist/album/playlist/random song (built-in player library?)
- internet radio (built-in player library, custom url)
- ability to use wlan or 3G for internet radio
- daily alarms, recurring alarms by weekday
- etc.

I admit that I got a bit carried away there, the most simple option would be:
- choosing Wlan/3G
- setting an alarm time and the internet radio stream address (maybe using the built in player channel list?)
- under the hood the program sets the time for starting up the connection
- when the alarm goes off, the program starts up the internet some time before sending a play command and address to the built in player
- then there should be checks that the internet connection is up and the radio is playing, and if not, the program would play back-up alarmtone
- I'm thinking there is no need for snooze function
- All this with a simple and sleek user interface


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

vBulletin® Version 3.8.8