LinuxMCE Forums

General => Users => Topic started by: krys on February 24, 2009, 04:46:41 pm

Title: Incremental Lighting
Post by: krys on February 24, 2009, 04:46:41 pm
I had another idea last night, unfortunately I have more ideas than I do time to implement them so I thought I would share to see if anyone has already put it into use.
I have a zwave controlled light switch in my bedroom that I want to use it to help me get moving in the mornings. I thought that I could slowly turn the lights up at a rate of about 10% every minute until they were fully on. (i dont like getting slammed with full lighting all at once in the morning). I mentioned the idea this morning on IRC and Thom had a few suggestions. Here is a clip

[08:33] <krysallen> has anyone devised a neat way to slowly turn the bedroom lights up in the morning, like 10% every minute?
[08:38] <TSCHAKeee> krysallen: hmmm
[08:38] <krysallen> other than 10 seperate events
[08:38] <TSCHAKeee> you'd have to create a delay plugin
[08:38] <TSCHAKeee> which.... would intercept lighting events
[08:38] <TSCHAKeee> and delay them.
[08:39] <TSCHAKeee> something like that
[08:39] <TSCHAKeee> linuxmce plugins can intercept events
[08:39] <TSCHAKeee> and pre-process them
[08:39] <TSCHAKeee> which is what you would need to do that.
[08:41] <krysallen> so I would have a lighting event that has just 10 increases of 10%, then I would need a plugin that intercepts and says to do each increase 1 at a time every minute?
[08:41] <TSCHAKeee> yeah, something like that

Anyway, if anyone likes the idea feel free to run with it, if not I will get to it when I can and try to hammer it out.
Title: Re: Incremental Lighting
Post by: hari on February 24, 2009, 06:12:50 pm
why don't you just make a time-triggered szenario doing the following:
set level 10
set level 20

Title: Re: Incremental Lighting
Post by: krys on February 24, 2009, 06:26:03 pm
honestly, I dont know. Would that work for what I want? I tried to created a new scenario, used the advanced wizard and selected the lighting plug in from the devices. I see the set level command but I do not see anything for sleep. (I assume sleep = wait/delay). Since my hardware is not installed yet I cant access anything from the lighting wizard, is that where I will need to set this up?
Title: Re: Incremental Lighting
Post by: jondecker76 on February 25, 2009, 02:50:37 pm
yes, you could do that currently with a scenario. Execute a command to increase the light level by 10% (dim +10), followed by a dcerouter delay command (delay 60)... folowed by another dim +10... followed by another dcerouter delay 60, etc. Do this 10 times and you will get what you want. Then you can use a timed event to fire command #370 execute_command_group with a PK of the scenario you created.

But, as you and Thom discussed, a plugin which does this for you would be a bit more graceful.
Title: Re: Incremental Lighting
Post by: colinjones on February 25, 2009, 11:16:33 pm
my 2c's!

Yes, the method hari suggests works - I use it to play an Internet Radio stream each morning. Start playing, set vol 20%, wait 1 min, set vol 30%, wait 1 min, set vol 40%, wait 1 min, set vol 55%, wait 3 mins, stop media.

The delay plugin is interesting, but perhaps it could be made somewhat more flexible? Start with it intercepting and preprocessing events, then in the vein of the GSD, allows you to set up "rules" (like the command Ruby snippets) that allow you to insert Ruby code that execute on reception of the even, and do whatever you want including delays, but just about anything else as well. Then this code can delay the event, bifurcate the event into multiple separate events and send them at a time of its choosing, even modify or morph the events into other events.

So the plugin can be used as a Generic Processing Unit that hooks into LMCE's event system to receive timed or triggered events, and processes them into whatever you want, then sends them on their way - and all this without having to right a new C++ DCE device specific to purpose... just like GSD for communication with physical devices....?