Logic assistance please

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by zei20t, Feb 18, 2014.

  1. zei20t

    zei20t

    Joined:
    Aug 18, 2010
    Messages:
    130
    Likes Received:
    1
    Location:
    Sydney, Australia
    Hi Guys,

    Been messing around with the logic on my colour spectrum.

    What I want to achieve is (I think) fairly simple. But I cant seem to get different times to work.

    I have a PIR in the hall, which triggers the hall lights. Depending on the time, it will turn on 18% or 38%. It works fine before 11pm, but then after that time it doesn't turn on the group at all.

    Any assistance would be greatly appreciated

    Thanks!

    once (GetLightingState("Hall PIR Trigger") = ON) then
    begin
    if (time > "11:00:00 PM") and (time < sunrise) then
    begin
    SetLightingLevel("Hall PIR Switch", 18%, "8s");
    end
    else if (time > sunset) and (time < "11:00:00 PM") then
    begin
    SetLightingLevel("Hall PIR Switch", 38%, "8s");
    end
    end;

    once (GetLightingState("Hall PIR Trigger") = OFF) then
    begin
    SetLightingLevel("Hall PIR Switch", 0%, "12s");
    end;
     
    zei20t, Feb 18, 2014
    #1
  2. zei20t

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,548
    Likes Received:
    178
    Location:
    Adelaide, Australia
    Your problem is the time can never be greater than 11pm AND earlier than sunrise. If you think about it you are asking for a number greater than 23 but less than about 7.

    Try if (time > "11:00:00 PM") OR (time < sunrise) then
     
    Ashley, Feb 18, 2014
    #2
  3. zei20t

    zei20t

    Joined:
    Aug 18, 2010
    Messages:
    130
    Likes Received:
    1
    Location:
    Sydney, Australia
    ahhhhh ok that makes sense.

    if the above statement doesn't work, should I then try 3 time periods?

    1 to cover sunset to 11pm, then 11-11:59:59 and another for 12am-sunrise?

    thanks for your reply Ashley!
     
    zei20t, Feb 18, 2014
    #3
  4. zei20t

    zei20t

    Joined:
    Aug 18, 2010
    Messages:
    130
    Likes Received:
    1
    Location:
    Sydney, Australia
    thanks again for your help, Ashley. I've slightly changed the code. the PIR is enabled/disabled via a schedule so there is no need to specify a start time as the group will never turn on before sunset - 10mins.

    once (GetLightingState("Hall PIR Trigger") = ON) then
    begin
    if (time < "11:00:00 PM") then
    begin
    SetLightingLevel("Hall PIR Switch", 38%, "4s");
    end
    else if (time > "11:00:01 PM") OR (time < sunrise + "0:15:00") then
    begin
    SetLightingLevel("Hall PIR Switch", 20%, "4s");
    end
    end;

    once (GetLightingState("Hall PIR Trigger") = OFF) then
    begin
    SetLightingLevel("Hall PIR Switch", 0%, "12s");
    end;
     
    zei20t, Feb 19, 2014
    #4
  5. zei20t

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,548
    Likes Received:
    178
    Location:
    Adelaide, Australia
    You can also do this without any logic. Assign your Hall PIR trigger to the dimmer channel. Then create another GA that is set to 38% or 20% via 2 schedules. In the dimmer logic tab, enter this GA and select Minimum. When the Hall PIR trigger is off (i.e. 0), this will be the minimum value so the light will be off. When Hall PIR trigger is set (255), the dimmed GA will be minimum and set that light level.
     
    Ashley, Feb 19, 2014
    #5
  6. zei20t

    zei20t

    Joined:
    Aug 18, 2010
    Messages:
    130
    Likes Received:
    1
    Location:
    Sydney, Australia
    ohh I really didn't think of that!

    damn, you guys are smart :)
     
    zei20t, Feb 19, 2014
    #6
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.