PAC Fan run on timer for heat lamps

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by Stu, Jan 28, 2008.

  1. Stu

    Stu

    Joined:
    Aug 4, 2004
    Messages:
    8
    Likes Received:
    0
    Is the code I have here going in the right direction? It runs OK in PICED.
    The idea is to run a fan on if the light has been on longer for 1 minute.

    {If an Ensuite light goes ON then start Exhaust Fan after light(s) have been on for >10 seconds
    On for longer than 1 minute then fan runs on for 2 minutes after last light goes off}

    if ConditionStaysTrue(GetLightingState("Ensuite Light") or
    GetLightingState("Esuite Heat 1 51B") or
    GetLightingState("Ensuit Heat 2 51C")= ON, 10) then { 10 seconds }
    begin { a light has gone on long enough to start fan }
    Trigger2 := ON; {condition met, store result}
    SetLightingState("Ensuite Fan", ON); { switch on fan }
    StartTime := Time; { set start time }
    end;

    once (GetLightingState("Ensuite Light")= OFF) and
    (GetLightingState("Esuite Heat 1 51B")= OFF) and
    (GetLightingState("Ensuit Heat 2 51C")= OFF) and {if all lights are off}
    (Trigger2 = ON) then {check if condition met}
    begin { lights have gone off and were on long enough to start fan }

    if Time - StartTime > 60 then { fan has been on for 60 seconds }
    Delay(120); { 2 mins delay off for fan }
    SetLightingState("Ensuite Fan", OFF); { switch off fan }
    Trigger2 := OFF; {set condition OFF}
    end;

    Stu
     
    Stu, Jan 28, 2008
    #1
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.