Topic: Set alarms remotely

I see that this has been discussed in the past, but just seemed to die out.  I would LOVE the ability to set alarms when I'm away from home.  Is there any way to do this currently via web browser or SSH?  I would love to see this as a standard feature in a future release.

Re: Set alarms remotely

It's funny, I was just thinking about adding or editing alarms through the web instead of fumbling around the touchscreen.

Since widgets are added, configured, and rearranged using "My Channels" on Chumby.com, it seems like it shouldn't be too terribly difficult to be able to set alarms from the web as well.  But I'm not a programmer, so I don't know all the ins and outs of how to make it possible.

Re: Set alarms remotely

I was talking with ChumbyLurker earlier to today about whacking out a couple of simple scripts and HTML pages for the built-in webserver that could be used to edit the alarms.  It's not a huge project - would probably take a day or so for someone with the interest and skills.

Re: Set alarms remotely

I certainly have the interest, just dont have the programming skills.  Any takers?  I will certainly help if I can....

Re: Set alarms remotely

I took a bit of time and hacked together at least something that parses the alarms file and generates a web page from it.  Tomorrow I'll look into writing the alarms file back out.

Re: Set alarms remotely

Your ROCK ChumbyLurker, thank you!  Let me know when you are ready and what I need to do to test it.

Re: Set alarms remotely

ChumbyLurker wrote:

I took a bit of time and hacked together at least something that parses the alarms file and generates a web page from it.  Tomorrow I'll look into writing the alarms file back out.

Me too, me too!  love to test.  I've played with editing the files in the raw form, but that's it.

Re: Set alarms remotely

Looks like the file to write to and how to get the control panel to reload your updated alarm settings can be found here: http://forum.chumby.com/viewtopic.php?pid=21571

9 (edited by josep 2009-05-21 08:29:06)

Re: Set alarms remotely

I could also help out if you need another programming hand. Doesn't sound too hard.

Jose

10 (edited by ChumbyLurker 2009-05-26 20:19:52)

Re: Set alarms remotely

Give this a shot.  I've ended up writing everything in pure perl, rather than trying to get an XML library working.  Not using CGI was also a challenge, and I'm not proud of the hacked up multipart/form-data parsing I'm doing smile

It supports basic editing/creation of alarms, as well as uploading and downloading the alarm file.  It doesn't support the more exotic alarm sources, but it supports editing them, so if you have an alarm that plays Pandora, you ought to be able to update that alarm from the web.

I've added classes to several of the tags, and bundled a style.css file that gets loaded.  I've had to do some trickery to get it to live in the cgi-bin directory, but this means that it can all safely live within /psp, and be available as soon as your Chumby starts up.  I'd be interested in seeing what people can do with this file, and would welcome its beautification.

There isn't a debugchumby installer, so to get it working you'll have to enable SSH, then copy everything to /psp/cgi-bin, and mark alarms.pl and alarms-style.sh as executable.  From a console, you can run "chmod a+x /psp/cgi-bin/*".

http://files.chumby.com/hacks/alarm-web-02.zip

Edit: Now uses the correct field for e.g. Weekends, Weekdays, Wednesdays, etc.

Re: Set alarms remotely

How exciting!  What a great project idea!

Re: Set alarms remotely

I've got the files uploaded and chmoded, but I don't know how to execute it -- do I do it from a web browser,  and if so, what is the address or do I do it by ssh?

Re: Set alarms remotely

Once you have the software installed, you open up a browser on your computer, and point it to:

http://ip.of.your.chumby/cgi-bin/custom/alarms.pl

...where you'd substitute the IP of your chumby from the Settings->Chumby Info panel.

Re: Set alarms remotely

Super!  Works like a champ!

Re: Set alarms remotely

can't browsers do flash? why not just put the same flash program that you use on chumby on the internet?

Re: Set alarms remotely

The panels you see in the Control Panel are manipulating the internal state of the device they're running on - but in the browser, they'd be running on your desktop, not the chumby.

It *might* be possible to refactor them a bit and present a similar interface for some things, for music in particular this is problematic.  For instance, setting a Pandora audio source for the alarm requires some information that would not be directly accessible to the Flash movie running in your browser since only the chumby itself (more particularly, the Control Panel) has the required information.

One reason for doing this in the first place is to replace a somewhat tedious process on the small-touchscreen chumby with something that a bit easier because it's now presented on a large screen with a keyboard and better pointing device.  Simply reproducing the small screen experience in the browser might not be the best way to exploit the available capabilities.

Re: Set alarms remotely

ChumbyLurker wrote:

Give this a shot.  I've ended up writing everything in pure perl, rather than trying to get an XML library working.  Not using CGI was also a challenge, and I'm not proud of the hacked up multipart/form-data parsing I'm doing smile

It supports basic editing/creation of alarms, as well as uploading and downloading the alarm file.  It doesn't support the more exotic alarm sources, but it supports editing them, so if you have an alarm that plays Pandora, you ought to be able to update that alarm from the web.

http://files.chumby.com/hacks/alarm-web.zip

This is working beautifully thogh I noticed that you are missing on field when it comes time to update -- after alarm.  Was that on purpose?

I love it by the way.

Re: Set alarms remotely

I did leave out the field that asks the user whether they want the alarm screen to show, which can be useful for setting up triggers to e.g. change channels at specific times, or to go into or out of nightmode.  It could easily be added to the edit-alarm screen, just make sure to fix it up in the validate_alarm subroutine.  I didn't add it because it adds some more complexity.  If you notice, the Control Panel will only ask you if you want the alarm panel to be displayed if it's feasible not to.  That is, if it's a silent alarm, you have the option to not display the "Sleep / Dismiss" screen.  In order to cleanly do this in the web page, I'd want to use Javascript to hide/show the field when it is/isn't applicable.  Of course, I'd /like/ something similar for the "Audio" section, which should only be visible when the appropriate radio button is selected, but I felt that was a necessary evil.

You ought to have four options to choose from for after-alarm activities: nightmode on, nightmode off, power off, and nothing.  Unfortunately, it's not possible to switch channels through such an interface, mostly because I couldn't find a way to get a listing of available channels, with IDs.  Just like it's not possible to come up with the arguments to an audio source through the web, because it requires information that only the Control Panel can know.

It is, however, possible to create alarms through the web and set their name and frequency, and then go back through on the Chumby and set up the audio to play and the channel to switch to.

One of the reasons I created it the way I did, namely entirely in perl, is because I wanted it to be hackable.  Everything from the CGI manipulation to the file parsing is done in pure perl, enclosed within two files.  As Duane pointed out to me, this could easily be extended to handle editing My Streams.  If someone wants to extend this to work on editing that, I encourage them to do so.  Or, really, anything else.

Re: Set alarms remotely

Followed the instructions and I'm able to access the site and see the alarms I already have set and options to create new.  I tested setting up a new alarm for the weekends and everything looks OK from the web side, but when I look at the alarm info on the Chumby it just shows the time and ignored the setting for weekend.  Did I do something wrong, or anyone else seen this?

P.S. - This is truly awesome!  Thanks ChumbyLuker.

Re: Set alarms remotely

Whoops, good catch.  It looks like the Control Panel uses 'when="weekend"' rather than 'when="weekends"' like I thought.  I uploaded a fixed version at http://files.chumby.com/hacks/alarm-web-02.zip

Re: Set alarms remotely

This may be somewhat off topic, but definately related.

I would like the ability to make a more complex alarm. For example I would like to have one alarm at night that would dim the screen, set the channel and put it into night mode. I know it would get complicated to do this on the small chumby screen, but much more feasible on a web based entry method.

Is something like this possible?

-HuckFinn

Re: Set alarms remotely

I've been looking into chaining of actions - not sure where to go with that just yet.  It's pretty complicated to have a useable UI and enforcing the various conditions and restrictions that one must put in place to avoid meaningless or silly sequences.

Re: Set alarms remotely

ChumbyLurker wrote:

Whoops, good catch.  It looks like the Control Panel uses 'when="weekend"' rather than 'when="weekends"' like I thought.  I uploaded a fixed version at http://files.chumby.com/hacks/alarm-web-02.zip

ChumbyLurker,
   took me 5 minutes to install this last night - nice code, easy to use, functional and helps build up the box of tools that makes Chumby managable - thanks and keep up the good work.

cheers

Nigel

smile smile smile

Re: Set alarms remotely

ChumbyLurker - love your work, this is great!

One small feature request though ;-)

The front page shows if the "Alarm/snooze screen" is enabled for the already defined alarms, but this feature can not be set from the edit alarm screen. Would you be able to add that to your scripts?

tia,
Clippy

Re: Set alarms remotely

I wrote a small list of commands so download and enable the alarm scripts from a ssh prompt.
Hopefully it will help others that may have trouble copying over the scripts.

cd /mnt/storage
wget http://files.chumby.com/hacks/alarm-web-02.zip
unzip alarm-web-02.zip -d /psp/cgi-bin
rm alarm-web-02.zip
cd /psp/cgi-bin/alarm-web
mv * ..
cd ..
rmdir alarm-web
chmod a+x *