Posts: 310
Threads: 12
Joined: Feb 2013
We'll be going on vacation soon and I'd like to use CQC to simulate occupancy by randomly turning lights on and off periodically during the evening. I did a search and I saw a recommendation to use CML but that was from 2008. My question is what component of CQC should I use to develop this, the simpler the better?
I essentially want to set a random time for a light to be on followed by a random time until it turns on again. Repeat for each room between sunset and a specified go to sleep time.
Thanks.
David
Posts: 40,483
Threads: 491
Joined: Aug 2002
That's something that would certainly require the level of smarts that would indicate CML. Optimally it would be a driver probably so that it could always be running and maintain state easily. A pseudo driver of course, it wouldn't talk to an actual device.
It could be done without, using the time field write command. A scheduled event that runs every 15 minutes or some such, which sets up an enumerated variable, each value of which is a lighting field you want to affect. Each time it wakes up, it would move the enumerated variable forward, get the current value, and do a timed field write to that field, turning it on for some amount of time.
You can generate a random number using the System::GenRandomNum command. You could use that to set the time each time around. Tell it to generate a number less than 30 minutes worth of seconds.
If you wake up every 15 minutes and turn lights on for 30 minutes or less, that would tend to leave you with a couple on at a time. You could always stop it between particular hours at night.
Dean Roddey
Explorans limites defectum
Posts: 310
Threads: 12
Joined: Feb 2013
Here is the simple code that I came up with using a Scheduled Event for each light that I wanted to control. The only thing I wasn't able to figure out was how to get the sunset time so I could use that as the start of when my scheduled event should start working. One enhancement I could see is to change the randomization based on time of night so that simulating getting ready for bed would have the lights on longer than say a late night trip to the bathroom. But I'd say I'm good for a first test and am fully functional at this point. Thanks for the feedback Dean!
David
Code:
// Get sunset time. Use for start of lights on.
// ????????? Not surei how to get sunset time
// Check if between the sunset and specified time
If System::IsInTimeRange
P1=2020
P2=0201
[INDENT]// Set a random time for lights to be on
System::GenRandNum
P1=6
P2=LVar:TimeLightON
// Set the light to on for a random time
Devices::TimedFldChange
P1=LutronRadioRa2.Switch_Garage
P2=True
P3=False
P4=%(LVar:TimeLightON)[/INDENT]
End
Posts: 40,483
Threads: 491
Joined: Aug 2002
You could do the thing I was mentioning before and use a single event and just rotate through them. But of course doing separate ones allows you to control them differently in terms of when and how long.
Dean Roddey
Explorans limites defectum
Posts: 848
Threads: 177
Joined: Aug 2004
I have done something similar, but rather than random lights, I have used a series of scheduled events to simulate a typical evening. Starting with the kitchen lights for cooking, then the lounge for relaxing in the evening, followed by bathroom and bedroom. I could introduce a little randomness in the sequence, but I have not bothered yet.
PJG
Posts: 4,225
Threads: 365
Joined: May 2005
Thats exactly what I did as well, just a simple, turn the TV on and low lights in the living area, and then ramped them off with the bedroom lights on for a short time - something that mimicked what we would do on a typical nigh
Some randomness around the timing would be all that is required, but that is only minor as a typical weekday night is very consistent.
Too random and it is too obvious
Mick
Mykel Koblenz
Illawarra Smart Home
Posts: 166
Threads: 29
Joined: Apr 2007
What I have done is similar to PJ where I have 3 different scenarios of lighting time and brightness to each light according to our daily routine kicking off at sundown.
I use the system GenRndNum function to generate a random number from 1 to 3 and I have lighting scenarios assigned to each random number. Each of the 3 scenarios has different brightness and lengths of time each light is on but each scenario follows our normal routine...kitchen, living room, foyer, upstairs, bed, sleep.
I use Pause to simulate moving room to room. I use a CDTimer to count down to turn everything off at bedtime that counts down from different lengths of time depending on the time of day the scenarios started...if in summer lights don't go on until 7-8pm, so using IsInTimeRange 19-20, the CDTimer counts down for 2 hours and some odd minutes. When it hits zero, a triggered event is started and then randomly turns off lights that were not turned off in the first go round.
System: WHS, UPB, Plex, Elk
Drivers: Autopatch, DataLog DB, DTV IP, GC-100, IRA, Logic Server, Variable Driver, Weather Underground
Posts: 310
Threads: 12
Joined: Feb 2013
Thanks for the feedback everyone. I also have the opportunity to use the Lutron RadioRa 2 system's vacation mode, which allows up to 99 on/off events per day. There isn't any randomness on the start/end times so they expect you will create events for each day with slightly different times. This way each Monday is the same but slightly different from each Tuesday, etc.
http://resi.lutron.com/LinkClick.aspx?fi...17&mid=679
Posts: 1,193
Threads: 32
Joined: Dec 2003
I'm not sure that randomness is truly needed. If the house was under surveillance sure but then there would be other indications of no one home. For someone just driving by checking for a house that's always dark they would produce their own randomness. At least as long as its not the same single light and always on.
What I haven't found a solution for is the useless advertising 'newspapers' that get tossed into every driveway without ordering it. No way to have it held as they're started by simply having a driveway. Then again maybe your neighbors have a better memory.
Les