Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simulate being at home (random lights on/off)
#1
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
Reply
#2
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
Reply
#3
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
Reply
#4
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
Reply
#5
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
Reply
#6
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
Reply
#7
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
Reply
#8
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
Reply
#9
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  An Idea - CQC as Front End for Home Assistant znelbok 7 1,263 01-03-2023, 05:43 AM
Last Post: kfly
  WebRiva add to home screen fix NishanF 2 1,925 11-16-2020, 08:54 AM
Last Post: sic0048
  What is the best way to have a widgit reflect whether all lights are on/off? ghurty 4 1,452 04-27-2020, 07:44 AM
Last Post: gReatAutomation
  Generate Random Number in a Trigger batwater 1 1,721 12-10-2017, 12:43 PM
Last Post: Dean Roddey
  Polk XRT12 random disconnects - Solved kfly 0 1,658 04-13-2017, 05:40 AM
Last Post: kfly
  Is there a random algorithm? ghurty 3 2,603 04-08-2017, 07:41 PM
Last Post: Dean Roddey
  Which one of the CQC simulator drivers would be the best to simulate sonos? ghurty 1 2,653 04-02-2017, 07:41 PM
Last Post: Dean Roddey
Brick Lights through Elk Quit Working George M 8 6,411 12-31-2016, 12:21 PM
Last Post: Dean Roddey
  Google Home Integration using Amazon Echo Approach? Jnetto 4 4,994 12-21-2016, 02:04 PM
Last Post: Jnetto
  Philips Hue Phoenix Lights karenlee 26 11,345 11-27-2016, 01:54 PM
Last Post: jkmonroe

Forum Jump:


Users browsing this thread: 1 Guest(s)