Logic question regarding PIRs

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by daveymit, Aug 25, 2014.

  1. daveymit

    daveymit

    Joined:
    Sep 25, 2012
    Messages:
    26
    Likes Received:
    0
    Location:
    Wollongong
    Hi All,

    Just a question...

    Currently I have 2x PIRs upstairs at either end of a hallway that triggers on a group of downlights in the hallway and above the staircase.

    I would like to, after 9pm and before 6am, make these PIRs trigger some staircase and hallway footer lights and NOT the downlights.

    I can't seem to find a way to do this in a PAC that doesn't trigger the downlights first and then shuts them off. This then repeats for as long as the PIRs timing out....

    Any ideas??

    Cheers guys,
    Dave
     
    daveymit, Aug 25, 2014
    #1
  2. daveymit

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,548
    Likes Received:
    178
    Location:
    Adelaide, Australia
    There a several ways of doing this depending upon whether you still need manual control of the lights.

    If they are just to be controlled by the pir you can use the logic function in the output units to only enable the light you want triggered. Assign the pir to both lighting groups. Create two new groups called say 'Downlight enable' and 'Footer enable'. In the output unit logic screen add each of these to the appropraite main group and select the 'AND' (relay) or 'MIN' (dimmer) function. In the PAC create two schedules to turn the enable groups on and off at the appropriate times. If the enable group is off, the lighting group will be disabled, if ON it will be enabled.

    If you still want manual control, you need to get the pir to just trigger logic in the PAC. You need 3 groups. 'pir group' is assigned to the pir. 'Stair lights' to the stair lights, and 'downlights' to the downlights. Then:

    Code:
    once 'pir group' = ON then
    begin
      if (time < "06:00:00") or (time > "21:00:00") then
        setLightingLevel("Stair light", 100%, 0)
      else
        setLightingLevel(Downlights", 100%, 0);
    end;
    
    once 'pir group' = OFF then
    begin
      setLightingLevel("stair light', 0%, 0);
      setLightingLevel("Downlights", 0%, 0);
    end;
    
     
    Last edited by a moderator: Aug 25, 2014
    Ashley, Aug 25, 2014
    #2
  3. daveymit

    daveymit

    Joined:
    Sep 25, 2012
    Messages:
    26
    Likes Received:
    0
    Location:
    Wollongong
    Great thanks a lot for that one Ashley! Will try that out now ;)
     
    daveymit, Aug 26, 2014
    #3
  4. daveymit

    daveymit

    Joined:
    Sep 25, 2012
    Messages:
    26
    Likes Received:
    0
    Location:
    Wollongong
    Still having problems!!!!

    Ok so I have had time to revisit my problem and I still have had no luck. Is there any reason why the below logic shouldn't work?

    {Turn on footer lights instead of downlights between 9pm and
    6am to %40}


    once (GetLightingState("Upstairs Hall PIR NORTH") = ON) or
    (GetLightingState("Upstairs Hall PIR SOUTH") = ON) then
    begin
    if (Time > "9:00PM") and (Time < "6:00AM") then
    begin
    SetLightingLevel("Staircase Footer", 40%, "4s");
    SetLightingLevel("Upstairs Hallway Footer", 40%, "4s");
    end
    else
    begin
    SetLightingLevel("Upstairs Hallway", 100%, "4s");
    end;
    end;


    once (GetLightingState("Upstairs Hall PIR NORTH") = OFF) and
    (GetLightingState("Upstairs Hall PIR SOUTH") = OFF) then
    begin
    SetLightingLevel("Upstairs Hallway", 0%, "4s");
    SetLightingLevel("Upstairs Hallway Footer", 0%, "4s");
    SetLightingLevel("Staircase Footer", 0%, "4s");
    end;




    The "Upstairs Hallway" lights are the only ones that will come one. No matter what time of day, whether I change the time on the PACA, I cannot get this function to work at all. It is doing my head in!
    Can someone please shed some light on this situation? I have tried different ways of setting up the logic too.... but am still open for some more ways :)

    Cheers
    Dave
     
    daveymit, Apr 19, 2015
    #4
  5. daveymit

    Mr Mark

    Joined:
    Jan 27, 2006
    Messages:
    323
    Likes Received:
    5
    Location:
    FNQ
    Hello Dave.

    After a quick look, change:
    if (Time > "9:00PM") and (Time < "6:00AM") then
    To:
    if (Time > "9:00PM") or (Time < "6:00AM") then

    Regards,

    Mark
     
    Mr Mark, Apr 19, 2015
    #5
  6. daveymit

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,548
    Likes Received:
    178
    Location:
    Adelaide, Australia
    As an explanation, if you think of the hours as a number between 0 (midnight) and 23 (11pm) then it can never be > 21 (9pm) and < 6 (6am) at the same time. This issue traps most new programmers and actually is specifically mentioned in the help files. Note that this isn't just a function of the CBus logic engine. It is common to all programming languages. They are very logical and don't take human conventions into account.
     
    Last edited by a moderator: Apr 20, 2015
    Ashley, Apr 20, 2015
    #6
  7. daveymit

    Mr Mark

    Joined:
    Jan 27, 2006
    Messages:
    323
    Likes Received:
    5
    Location:
    FNQ
    Thumbs up to Ashley - great explanation!
     
    Mr Mark, Apr 20, 2015
    #7
  8. daveymit

    daveymit

    Joined:
    Sep 25, 2012
    Messages:
    26
    Likes Received:
    0
    Location:
    Wollongong
    Thanks a lot Ash and Mark!

    Just tested and works perfectly ;). I guess I wont be forgetting this concept anytime soon ;)

    :):):):):):):):):)
     
    daveymit, Apr 20, 2015
    #8
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.