Under Configuration -> Automation -> Security you can find the Presence simulator module, but I found that this didn't meet my needs. I wanted something more like what you have described.
I've done the following:
Created a virtual Switch named 'AwayFromHome', I can switch this on and off from the App or with a small remote control. (You don't need this though, you can just enable/disable the Programs by hand)
I then created a number of different scripts, here is an example for the bathroom lights:
Trigger code:
// Set some trigger times
if (Scheduler.IsScheduling("15 19 * * 1-7") ||
Scheduler.IsScheduling("30 21 * * 1-7") ||
Scheduler.IsScheduling("00 7 * * 1-7") ||
Scheduler.IsScheduling("10 01 * * 1-7") ||
Scheduler.IsScheduling("20 04 * * 1-7"))
{
// Only run if 'AwayFromHome''
return Modules.WithName("AwayFromHome").Get().Parameter("Status.Level").Value == "1";
}
else
{
return false;
}
Program code:
// First a random pause
Random rnd = new Random();
int myRandom = rnd.Next(1, 26); // creates a number between 1 and 25
Program.Notify("Bathroom", "Waiting " + myRandom.ToString() + " minutes");
Pause(myRandom * 60);
Modules.WithName("BathroomLight").On();
if (DateTime.Now.Hour < 6)
{
// Late at night, Lights on for a few minutes
myRandom = rnd.Next(1, 5); // creates a number between 1 and 4
}
else
{
myRandom = rnd.Next(1, 21) + 10; // creates a number between 10 and 30
}
Pause(myRandom * 60);
Modules.WithName("BathroomLight").Off();
Hope this helps