Holiday mode Please asist

Discussion in 'General Discussion' started by ADL, Mar 4, 2008.

  1. ADL

    ADL

    Joined:
    May 31, 2007
    Messages:
    18
    Likes Received:
    0
    OK guys i have a job that has being running for fare too long the clients have become paranoid that someone is going to break in and take the invisible plasma screen tv.... but moving on

    i need some ideas on how to great a holiday mode that will turn light on and off in the house randomly if possible..the installation has a black and white touch screen and standard switches that is all please get back to me as soon as possible..:confused:
     
    ADL, Mar 4, 2008
    #1
  2. ADL

    froop

    Joined:
    Dec 23, 2007
    Messages:
    124
    Likes Received:
    0
    Location:
    Melbourne, Australia
    Here's mine (still a work in progress). There's a fair bit in it, and its definitely the most complex Cbus logic I've worked on, so I've been trying a few different things to find the best compromise between CBus efficiency (ticks, program space, and mem used) and good programming practice :). Particularly cleaning up the HolidayMode module without breaking functionality or reliability.

    I'm controlling 6 lighting groups for holiday mode. Any more, and you could find yourself eating up a fair few scan cycles and heap space.

    You can get the details by reading the comments, but the general gist is to set up up to three sequences per light per day, within a specified ruleset which is different for each group.

    Constant definitions
    Code:
    {Set up sequences for included groups}
    Porch = 1;
    Dining = 2;
    Master = 3;
    Ensuite = 4;
    Kitchen = 5;
    Family = 6;
    
    {Constants for pre-defined time periods. Could remove to save mem }
    HM15 = 900;
    HM30 = 1800;
    HM1hr = 3600;
    HM90 = 5400;
    HM2hrs = 7200;
    HM3hrs = 10800;
    HM4hrs = 14400;
    
    Type definitions
    Code:
    { Arrays allow up to three "on" periods per light per day }
    HolidaySetType = record
       GroupID: Integer;  {Lighting group no}
       Active: Array[1..3] of Boolean; {Is this group active for today's sequences}
       OnTime: Array[1..3] of Integer; {Times to turn on}
       OffTime: Array[1..3] of Integer; {Times to turn off }
       Level: Array[1..3] of Integer; {Levels to turn on to}
    End;
    
    Variable Definitions
    Code:
    {TODO: Cleanup unused vars}
    HMcnt, HMinit, HMi, HMj : Integer;
    HolidayLight : Array[1..6] Of HolidaySetType;
    
    hr1, hr2, mn1, mn2, sc1, sc2 : integer;
    
    ScanCount : integer;
    
    Here's the big one. Running this proc sets up all the timing arrays.
    Code:
    Procedure SetHolidayTimes (SetID : Integer);
    Begin
        If (SetID = Porch) Then
        With HolidayLight[Porch] Do
        Begin
           GroupID := 20;
           Level[1] := PercentToLevel(100%);
           { 1 in 5 chance of being activated first time period}
           If (Random(4) = 0) Then Active[1] := True Else Active[1] := False;
    
           { No chance of being activated a second or third time}
           Active[2] := False;
           Active[3] := False;
    
           {Turn on within 1hr on Sunset}
           OnTime[1] := Sunset + Random(HM1hr);
    
           {turn off after at least 2hrs, but no more than 3 hrs}
           OffTime[1] := OnTime[1] + HM2hrs + Random(HM1hr);
        End
        Else If (SetID = Dining) Then
        With HolidayLight[Dining] Do
        Begin
           GroupID := 23;
           { 2 in 3 chance of being activated }
           If (Random(2) = 0) Then Active[1] := False Else Active[1] := True;
    
           {Turn on within 1hr on Sunset}
           OnTime[1] := Sunset + Random(HM1hr);
           Level[1]  := PercentToLevel(75%);
    
           {turn off after at least 30 mins, but no more than 2.5 hrs}
           OffTime[1] := OnTime[1] + HM30 + Random(HM2hrs);
    
           {If there is at least 1hr before midnight, 1 in 3 chance of turning on again}
           If("11:59pm" - OffTime[1] > HM1hr) Then
           Begin
              If(Random(2) = 0) Then Active[2] := True Else Active[2] := False;
    
              {Turn the light back on between 15 and 45 minutes of turning off}
              OnTime[2] := OffTime[1] + HM15 + Random(HM30);
              Level[2]  := PercentToLevel(30%);
    
              {Turn the light off any time within 15 minutes of turning it on, up to midnight}
              OffTime[2] := OntIme[2] + HM15 + Random("11:59pm" - HM15 - OnTime[2]);
           End;
    
           {No chance of being activated a third time}
           Active[3] := False;
        End
        Else If (SetID = Master) Then
        With HolidayLight[Master] Do
        Begin
           GroupID := 7;
           { Always activated only once }
           Active[1] := True;
           Active[2] := False;
           Active[3] := False;
    
           {Turn on between 9pm and 10pm}
           OnTime[1] := "09:00pm" + Random(HM1hr);
           Level[1]  := PercentToLevel(25%);
    
           {turn off between 10:30pm and Midnight}
           OffTime[1] := "10:30pm" + Random(HM90);
        End
        Else If (SetID = Ensuite) Then
        With HolidayLight[Ensuite] Do
        Begin
           GroupID := 12;
           { 9 in 10 chance of being activated }
           If (Random(9) = 0) Then Active[1] := False Else Active[1] := True;
    
           {For Mon-Fri, turn on between 5:30am and 6:30am, and off before 8:30am}
           {For Sat,Sun, turn on between 8:30am and 10am, and off after less than 1hr}
           If ((DayOfWeek = "Saturday") Or (DayOfWeek = "Sunday")) Then
           Begin
              OnTime[1] := "08:30am" + Random(HM90);
              OffTime[1] := OnTime[1] + Random(HM1hr);
           End
           Else
           Begin
              OnTime[1] := "05:30am" + Random(HM1hr);
              OffTime[1] := "07:30am" + Random(HM1hr);
           End;
           Level[1]  := PercentToLevel(100%);
    
           { 4 in 5 chance of turning on or 15 minutes early in the evening }
           If (Random(4) = 0) Then Active[2] := False Else Active[2] := True;
           OnTime[2] := Sunset + Random(HM1hr);
           OffTime[2] := OnTime[2] + HM15 + Random(HM15);
           Level[2] := PercentToLevel(100%);
    
           { 4 in 5 chance of turning on or 15 minutes late in the evening }
           If (Random(4) = 0) Then Active[3] := False Else Active[3] := True;
           OnTime[3] := OffTime[2] + Random(HM1hr);
           OffTime[3] := OnTime[3] + HM15 + Random(HM15);
           Level[3] := PercentToLevel(100%);
        End
        Else If (SetID = Kitchen) Then
        With HolidayLight[Kitchen] Do
        Begin
           GroupID := 31;
           { 3 in 7 chance of being activated on a weekday morning}
           If (Random(6) < 3) Then Active[1] := True Else Active[1] := False;
    
           { On Weekdays if SunRise is after 7am, turn on lights up to 15mins before sunrise}
           If Not ((DayOfWeek = "Saturday") Or (DayOfWeek = "Sunday")) Then
              If SunRise > "07:00am" Then
              Begin
                 OnTime[1] := SunRise - HM15 + Random(HM30);
                 Level[1] := PercentToLevel(75%);
              End;
    
           { 5 in 7 chance of turning on early in the evening }
           If (Random(6) < 5 ) Then Active[2] := True Else Active[2] := True;
           OnTime[2] := Sunset - HM15 + Random(HM30);
    
           {Turn off at least 30 minutes, up to 2.5hrs after turning on}
           OffTime[2] := OnTime[2] + HM30 + Random(HM2hrs);
           Level[2] := PercentToLevel(100%);
    
           { 4 in 7 chance of turning on late in the evening }
           If (Random(7) < 4) Then Active[3] := True Else Active[3] := False;
    
           { If lights are off within 2hrs of midnight, turn them on again }
           If ("11:59pm" - OffTime[2] > HM2hrs) Then
           Begin
              OnTime[3] := OffTime[2] + Random(HM30);
              OffTime[3] := OnTime[3] + Random(HM90);
           End;
           Level[3] := PercentToLevel(50%);
        End
        Else If (SetID = Family) Then
        With HolidayLight[Family] Do
        Begin
           GroupID := 37;
           { Always set on just onces in the evening }
           Active[1] := True;
           Active[2] := False;
           Active[3] := False;
    
           {Turn on within 1hr on Sunset}
           OnTime[1] := Sunset + Random(HM1hr);
           Level[1]  := PercentToLevel(25%);
    
           {turn off after at least 90 mins, but no more than 3.5 hrs}
           OffTime[1] := OnTime[1] + HM90 + Random(HM2hrs);
        End;
    End;
    
    Initialisation
    Code:
    HMinit := 1;
    HMcnt := 1;
    
    ScanCount := 1;
    
    HolidayMode module.
    Code:
    {
    
    This mode randomly turns various lights on and off during
    evening hours. It will run every cycle, so should be enabled
    via EnableModule("HolidayMode") when required, and disabled
    for normal operation
    }
    
    {
    Just before Sunrise occurs, trigger the Holiday Mode initialisation. This needs to happen once
    per day to randomise the times daily
    }
    Once(Time > Sunrise - HM30) Then
    Begin
         HMinit := 1;
    End;
    
    {
    Once the initialisation mode is triggered, setup one lighting group per clock tick. This
    stops the initilisation taking too much runtime at once
    }
    If ((HMinit >= 1) And (HMinit <= 6)) Then
    Begin
        SetHolidayTimes(HMinit);
        HMinit := HMinit + 1;
    End;
    
    {
    Only start checking levels once the initialisation is complete. This is not so much for
    initialisation purposes, but to keep logic steps to a minimum per scan
    }
    If (HMinit > 6) Then
    Begin
       Case HMcnt of
          Porch : Begin
             Once(Time > HolidayLight[Porch].OnTime[1])
                Then SetLightingLevel(HolidayLight[Porch].GroupID,HolidayLight[Porch].Level[1],"4s");
             Once(Time > HolidayLight[Porch].OffTime[1])
                Then SetLightingLevel(HolidayLight[Porch].GroupID,0,"4s");
          End;
          Dining : Begin
             Once(Time > HolidayLight[Dining].OnTime[1])
                Then SetLightingLevel(HolidayLight[Dining].GroupID,HolidayLight[Dining].Level[1],"4s");
             Once(Time > HolidayLight[Dining].OffTime[1])
                Then SetLightingLevel(HolidayLight[Dining].GroupID,0,"4s");
             Once(Time > HolidayLight[Dining].OnTime[2])
                Then SetLightingLevel(HolidayLight[Dining].GroupID,HolidayLight[Dining].Level[2],"4s");
             Once(Time > HolidayLight[Dining].OffTime[2])
                Then SetLightingLevel(HolidayLight[Dining].GroupID,0,"4s");
          End;
          Master : Begin
             Once(Time > HolidayLight[Master].OnTime[1])
                Then SetLightingLevel(HolidayLight[Master].GroupID,HolidayLight[Master].Level[1],"4s");
             Once(Time > HolidayLight[Master].OffTime[1])
                Then SetLightingLevel(HolidayLight[Master].GroupID,0,"4s");
          End;
          Ensuite : Begin
             Once(Time > HolidayLight[Ensuite].OnTime[1])
                Then SetLightingLevel(HolidayLight[Ensuite].GroupID,HolidayLight[Ensuite].Level[1],"4s");
             Once(Time > HolidayLight[Ensuite].OffTime[1])
                Then SetLightingLevel(HolidayLight[Ensuite].GroupID,0,"4s");
             Once(Time > HolidayLight[Ensuite].OnTime[2])
                Then SetLightingLevel(HolidayLight[Ensuite].GroupID,HolidayLight[Ensuite].Level[2],"4s");
             Once(Time > HolidayLight[Ensuite].OffTime[2])
                Then SetLightingLevel(HolidayLight[Ensuite].GroupID,0,"4s");
             Once(Time > HolidayLight[Ensuite].OnTime[3])
                Then SetLightingLevel(HolidayLight[Ensuite].GroupID,HolidayLight[Ensuite].Level[3],"4s");
             Once(Time > HolidayLight[Ensuite].OffTime[3])
                Then SetLightingLevel(HolidayLight[Ensuite].GroupID,0,"4s");
          End;
          Kitchen : Begin
             Once(Time > HolidayLight[Kitchen].OnTime[1])
                Then SetLightingLevel(HolidayLight[Kitchen].GroupID,HolidayLight[Kitchen].Level[1],"4s");
             Once(Time > HolidayLight[Kitchen].OffTime[1])
                Then SetLightingLevel(HolidayLight[Kitchen].GroupID,0,"4s");
             Once(Time > HolidayLight[Kitchen].OnTime[2])
                Then SetLightingLevel(HolidayLight[Kitchen].GroupID,HolidayLight[Kitchen].Level[2],"4s");
             Once(Time > HolidayLight[Kitchen].OffTime[2])
                Then SetLightingLevel(HolidayLight[Kitchen].GroupID,0,"4s");
             Once(Time > HolidayLight[Kitchen].OnTime[3])
                Then SetLightingLevel(HolidayLight[Kitchen].GroupID,HolidayLight[Kitchen].Level[3],"4s");
             Once(Time > HolidayLight[Kitchen].OffTime[3])
                Then SetLightingLevel(HolidayLight[Kitchen].GroupID,0,"4s");
          End;
          Family : Begin
             Once(Time > HolidayLight[Family].OnTime[1])
                Then SetLightingLevel(HolidayLight[Family].GroupID,HolidayLight[Family].Level[1],"4s");
             Once(Time > HolidayLight[Family].OffTime[1])
                Then SetLightingLevel(HolidayLight[Family].GroupID,0,"4s");
             Once(Time > HolidayLight[Family].OnTime[2])
                Then SetLightingLevel(HolidayLight[Family].GroupID,HolidayLight[Family].Level[2],"4s");
             Once(Time > HolidayLight[Family].OffTime[2])
                Then SetLightingLevel(HolidayLight[Family].GroupID,0,"4s");
          End;
       End;
    End;
    
    HMcnt := HMcnt + 1;
    If(HMcnt > 6) Then HMcnt := 1;
    
     
    Last edited by a moderator: Mar 4, 2008
    froop, Mar 4, 2008
    #2
  3. ADL

    Ingo

    Joined:
    Dec 2, 2006
    Messages:
    290
    Likes Received:
    1
    Location:
    South Africa
    This looks like something very interesting. I did a much easier version due to time constraints, one evening if I remember correctly.

    Most nights I do the same thing, get home, switch TV on, have dinner - the usual.... What I decided to do is to create three scenes, one called watch TV, the other called going to bed and the last midnight scene. Each scene has few entries, the first one is a set statement to put a light on through a 'random' statement so that the pattern cannot be "learnt". The second is a pulse statement so that lights go on/off at different times. You can expand on that..

    The 'going to bed' scene simulates me switching lights off, walking upstairs and doing the usual bathroom routine. The midnight one simulates you getting up in the middle of the night and going to the bathroom. Everything has a 'random' time generator assosiated with it so it's never the same time.

    This was a very quick and crude method, I trigger it with Minder Pro's Away Arm status and the Sunset time. It does not interfere with my usual programming of outside lights etc.
     
    Ingo, Mar 4, 2008
    #3
  4. ADL

    froop

    Joined:
    Dec 23, 2007
    Messages:
    124
    Likes Received:
    0
    Location:
    Melbourne, Australia
    That's what mine started out as.. a simple fixed sequence with random time adjustments +/-15mins. Then I got a bit carried away :)
     
    froop, Mar 4, 2008
    #4
  5. ADL

    Darpa

    Joined:
    Apr 30, 2006
    Messages:
    426
    Likes Received:
    0
    Location:
    Australia
    Damn Froop,

    You have been a busy boy! :p
     
    Darpa, Mar 4, 2008
    #5
  6. ADL

    NickD Moderator

    Joined:
    Nov 1, 2004
    Messages:
    1,420
    Likes Received:
    62
    Location:
    Adelaide
    Another good one you can throw in is using outdoor PIRs to trigger indoor lights when the security system is armed... it gives the illusion of someone inside the house reacting to activity outside.

    Of course you want to restrict it to turning on lights where you can see from outside that a light has turned on, but you can't see there is actually nobody there, for example bathrooms, toilets, upstairs rooms etc. with an appropriate degree of randomisation of group and delay..

    If you have MRA you could even trigger a few noises.. dogs barking, voices...

    Nick
     
    NickD, Mar 4, 2008
    #6
  7. ADL

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    See http://www.cbusforums.com/forums/showthread.php?t=3381 for a previous discussion.

    I personally think that the idea of genuinely random lights is silly. I recommend some schedules which switch lights on and off at certain times (not exactly on the hour) when you are away. Unless a burglar observes your house for several days noting which lights go on and off at which times, they will not be able to tell the difference.
     
    Darren, Mar 6, 2008
    #7
  8. ADL

    NickD Moderator

    Joined:
    Nov 1, 2004
    Messages:
    1,420
    Likes Received:
    62
    Location:
    Adelaide
    Haven't you seen The Italian Job, or Ocean's Eleven/Twelve?? What if Mark Wahlberg or George Clooney is trying to rob your place?

    Nick
     
    NickD, Mar 6, 2008
    #8
  9. ADL

    froop

    Joined:
    Dec 23, 2007
    Messages:
    124
    Likes Received:
    0
    Location:
    Melbourne, Australia
    I didn't write my holiday mode module because I think its the best way to fool thieves. I did it because I can. It's what geeks do :)

    Hell, most of my friends think its silly spending the extra bucks to put CBus in. They think its silly that I've got speakers and at up to 3 co-ax and up to half a dozen cat-6 runs in every room in my house.

    But I did it because I can :)
     
    froop, Mar 6, 2008
    #9
  10. ADL

    amberelectrics

    Joined:
    Aug 29, 2007
    Messages:
    114
    Likes Received:
    0
    Which if we are being really honest, is the best reason to do anything.
     
    amberelectrics, Mar 6, 2008
    #10
  11. ADL

    Mr Mark

    Joined:
    Jan 27, 2006
    Messages:
    322
    Likes Received:
    5
    Location:
    FNQ
    I second that!
     
    Mr Mark, Mar 6, 2008
    #11
  12. ADL

    Josh

    Joined:
    Aug 25, 2004
    Messages:
    240
    Likes Received:
    0
    Location:
    Pretoria, South Africa
    That you can :) .
     
    Josh, Mar 6, 2008
    #12
  13. ADL

    Darpa

    Joined:
    Apr 30, 2006
    Messages:
    426
    Likes Received:
    0
    Location:
    Australia
    Totally agree.

    The general consumer has no idea of what is possible in this day and age, and they class anything they dont understand as "stupid", "silly", etc.

    As far as I'm concerned, I want to make the most of any investment I make, and "luxuries" like C-Bus, excess numbers of cable runs to each room, excess capacity in other areas, etc, only enables me to actually do that.

    I stopped doing (most) things for the "wow" factor (for other people anyway) a long time ago. Now I do things to make myself smile at the end of the day.

    Just my thoughts on other people ridiculing technology for want of a better understanding :)

    Darpa
     
    Darpa, Mar 6, 2008
    #13
  14. ADL

    Lucky555

    Joined:
    Aug 13, 2007
    Messages:
    229
    Likes Received:
    0
    I have been licensed as a security consultant for 14 years, I know C-Bus down to the protocol, was around in the version 1 days of C-Bus and nagged a brilliant man about what the logic engine should look and feel like.

    I understand about doing stuff because you can however over time I am sure you will look for something that is clean and makes good sense.

    I have a logic program that makes the house looked occupied. I live in a cul de sac and often bluff the neighbours for days and days. My code is simple (bullet proof) about 20-30 lines. It leverages the basics like pulsing a group replacing the pulse time with a semi random variable.

    Think about it - during and evening (when you have lights on) in the earlier hours you spend time around the kitchen then the living areas. Later in the evening you move in and out of the bedrooms as you move closer to retiring. Full random sounds good in theory in reality its a bit of a w@nk.

    Straight schedules gets you pretty close, time based scripts with a plus / minus semi random value eg "once time" then pulse a group with a semi random integer for the time period is a nice clean way to achieve a real result.

    Don't have any C-Bus software on this machine will dig up some code and post it when I get a moment.
     
    Lucky555, Mar 7, 2008
    #14
  15. ADL

    Lucky555

    Joined:
    Aug 13, 2007
    Messages:
    229
    Likes Received:
    0
    Example with comments;

    Below you declare some integer variables and intialise them so they have a value in the first instance. Note I mentioned semi random times the code below will always produce a random value between 10 and 40 minutes. You dont want to turn a light on for 2 seconds...
    Code:
     
    {Advanced.var.}
    RandomTime1, RandomTime1a, RandomTime2, RandomTime2a : integer; 
    FlagSecurityArmed : boolean;  
    
    {Advanced.Initialisation.}
    RandomTime1 := random ("0:30:00") + "0:10:00";
    RandomTime2 := random ("0:30:00") + "0:10:00";
    RandomTime1a := random ("0:30:00") + "0:10:00";
    RandomTime2a := random ("0:30:00") + "0:10:00";
    
    Below we recalculate random values once a day (all you need) the rest is easy.
    Code:
    {Module}
    once (Time = "23:00:00")then
    begin
      RandomTime1 := random ("0:30:00") + "0:10:00";
      RandomTime1a := random ("0:30:00") + "0:10:00";
      RandomTime2 := random ("0:30:00") + "0:10:00";
      RandomTime2a := random ("0:30:00") + "0:10:00";
    end;
    
    {Note in the code below we are using RandomTime1 in conjunction with nominated time of 1900 hours
    also note our PulseCBusLevel code uses RandomTime1a in lieu of the standard timer time. Remember
    if the Result1 group is controlled by any other device inside the pulse duration, the pulse timer
    will be cancelled.}
    
    once (Time = "19:00:00" + RandomTime1) then
    begin
      if FlagSecurityArmed = true then
      begin
        PulseCBusLevel("Backbone", "Lighting", "Result1", 100%, "0s", RandomTime1a, 0%);
      end;
    end;
    
    once (Time = "19:30:00" + RandomTime2) then
    begin
      if FlagSecurityArmed = true then
      begin
        PulseCBusLevel("Backbone", "Lighting", "Result2", 100%, "0s", RandomTime2a, 0%);
      end;
    end;
    
    Simple stuff... ;)

    PS the above is a really simple example - importantly it shows checking a bool variable FlagSecurityArmed
    because you don't want this happening when you are at home. Another good way is to put all this type of
    code in a module then enable the module when the security system is armed (away mode activated) - if you
    don't have a security system linked you can press a "Goodbye" button at the front door etc. Disable the module
    when the security system is disarmed or the away button is turned off.

    Again simple stuff ;)
     
    Last edited by a moderator: Mar 7, 2008
    Lucky555, Mar 7, 2008
    #15
  16. ADL

    amberelectrics

    Joined:
    Aug 29, 2007
    Messages:
    114
    Likes Received:
    0
    This is much more like it. I have setup a similar thing on a project I am fixing, it uses time base to run certain areas of the house, as above, you dont just want stuff popping on and off all over the show.
     
    amberelectrics, Mar 9, 2008
    #16
  17. ADL

    inpowers

    Joined:
    Jul 1, 2007
    Messages:
    44
    Likes Received:
    0
    Location:
    Sydney
    Hi There
    I am trying to setup my Holiday/away mode at home so I can get the jest on the operation of the logic for the code set out as shown above.
    I have only done a bit of logic as being a new comer to the C bus scene.
    If possible I have a couple of question in regards to the logic code in this example.

    Code:
    {Advanced.var.}
    RandomTime1, RandomTime1a, RandomTime2, RandomTime2a : integer; 
    FlagSecurityArmed : boolean;  
    
    Here it has a (FlagSecurityArmed)code not sure what this means.
    I do have a bus coupler hooked up to relays that are triggered when the alarm system is turned on & off.
    At the moment I have lights that come on when the alarm system is turned off after sunset.

    Code:
    begin
        PulseCBusLevel("Backbone", "Lighting", "Result1", 100%, "0s", RandomTime1a, 0%);
      end;
    end;
    
    Ok with this section does the (Result1) indicate a scene or something else?

    Code:
    {Module}
    once (Time = "23:00:00")then
    begin
      RandomTime1 := random ("0:30:00") + "0:10:00";
      RandomTime1a := random ("0:30:00") + "0:10:00";
      RandomTime2 := random ("0:30:00") + "0:10:00";
      RandomTime2a := random ("0:30:00") + "0:10:00";
    end;
    
    {Note in the code below we are using RandomTime1 in conjunction with nominated time of 1900 hours
    also note our PulseCBusLevel code uses RandomTime1a in lieu of the standard timer time. Remember
    if the Result1 group is controlled by any other device inside the pulse duration, the pulse timer
    will be cancelled.}
    
    once (Time = "19:00:00" + RandomTime1) then
    begin
      if FlagSecurityArmed = true then
      begin
        PulseCBusLevel("Backbone", "Lighting", "Result1", 100%, "0s", RandomTime1a, 0%);
      end;
    end;
    
    once (Time = "19:30:00" + RandomTime2) then
    begin
      if FlagSecurityArmed = true then
      begin
        PulseCBusLevel("Backbone", "Lighting", "Result2", 100%, "0s", RandomTime2a, 0%);
      end;
    end;
    In this last section our good friend Lucky555 suggests (Another good way is to put all this type of
    code in a module then enable the module when the security system is armed (away mode activated))
    How does this change the code if I wanted to enable the logic when the alarm is activated via a bus coupler after sunset?
    Sorry to sound so vague but any help would be much appreciated.

    Regards
    Rob
     
    Last edited by a moderator: Dec 28, 2008
    inpowers, Dec 27, 2008
    #17
  18. ADL

    Pink Panther

    Joined:
    Jul 1, 2007
    Messages:
    26
    Likes Received:
    0
    Location:
    Auckland, New Zealand
    Vacation Mode

    One of the C-Bus competitors (state-side) has a Vacation Mode that records up to 14 days of system activity, which can then be replayed either "as is" or with a randomization function that slightly modifies the start and stop times.

    A bit like recording then playing back the C-Bus application log, with a few smarts thrown in. Now there's one for the list of future programming features.
     
    Pink Panther, Jan 5, 2009
    #18
  19. ADL

    inpowers

    Joined:
    Jul 1, 2007
    Messages:
    44
    Likes Received:
    0
    Location:
    Sydney
    Hi There
    Is there anyone out there the can shed some light on the questions that I have asked.:confused::confused:

    Thanks
    Rob
     
    inpowers, Jan 5, 2009
    #19
  20. ADL

    filpee

    Joined:
    May 31, 2006
    Messages:
    204
    Likes Received:
    0
    Location:
    Western Australia
    Its a flag that he is setting to enable or disable the triggering of the event.
    You could change this to GetLightingLevel(yourGASetViaAuxModule) > 0 or something to that effect.

    im guessing its a scene but it could be more logic or even a module. Only Lucky555 would know.

    What he means is to remove the if FlagSecurityArmed = true logic and change it to something like once FlagSecurityArmed > 0 then enableModule('Dont rob me im away on holidays').
    then in your Dont rob me im away on holidays module paste all that code.

    There might be more changes needed but I've not had a good look through the code.
     
    filpee, Jan 5, 2009
    #20
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.