Garage Door Open Logic

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by breadknife, Apr 16, 2015.

  1. breadknife

    breadknife

    Joined:
    Apr 16, 2015
    Messages:
    19
    Likes Received:
    0
    Location:
    Western Australia
    Hi Peoples,
    long time reader but never needed to post as most things have been answered previously (possibly even this question! , but was unable to find anything related)
    I have just taken delivery of the new Wiser 2 (or MK II if thats more correct!!), and am attempting some logic.

    The garage door controller is wired up to two output channels on a 12ch relay unit which works fine via a few eDLT's. I now wish to open the door through the wiser but want to make it a little more secure so it isn't accidentally opened whilst navigating the app.
    My intention is too have an 'Enable' bit which once enabled will only then allow the actual open/close bit to be operated, the enable bit automatically times out after 5 minutes.
    I am able to pulse the open/close bit from the wiser app no worries, i then added the enable bit which did hold out the open/close bit, however the timer seemed to be ignored! and wouldn't 'Disable' the enable bit! I have posted a couple of my attempts and done a lot of reading but obviously missing the essentials/basics. I read on this forum about separating the timers, hence the second example but had no success. Checked the log in the wiser, could see the buttons pushed, i'm assuming the timer start/stop will not appear here as these aren't broadcast on the bus.

    Thanks guys, any help would be appreciated, hopefully someone has the solution.

    Cheers
    breadknife


    First Example

    { This is to open garage door, first an enable bit is to be set, this allows the door open/close to become available }
    { The garage door enable bit times out after 5 minutes automatically }


    Once (GetEnableState("Garage Door Enable") = ON) then
    TimerStart(1);

    Once TimerTime(1) > 300 then
    begin
    SetEnableState("Garage Door Enable", OFF);
    TimerStop(1);

    Once (GetEnableState("Garage Door Enable") = ON) then
    begin
    Once (GetEnableState("Garage Door Open/Close") = ON) then
    begin PulseCBusLevel("Network", "Lighting", "Garage Door1", 100% ,"0s", "0:00:01", 0%);
    begin PulseCBusLevel("Network", "Lighting", "Garage Door2", 100% ,"0s", "0:00:01", 0%);


    end;
    end;
    end;
    end;



    Second Example

    { This is to open garage door, first an enable bit is to be set, this allows the door open/close to become available }
    { The garage door enable bit times out after 5 minutes automatically }

    Once (GetEnableState("Garage Door Enable") = ON) then
    begin
    TimerStart(1);
    end;

    Once (GetEnableState("Garage Door Enable") = ON) then
    begin
    Once (GetEnableState("Garage Door Open/Close") = ON) then
    begin PulseCBusLevel("Network", "Lighting", "Garage Door1", 100% ,"0s", "0:00:01", 0%);
    begin PulseCBusLevel("Network", "Lighting", "Garage Door2", 100% ,"0s", "0:00:01", 0%);
    end;

    once TimerTime(1) > 300 then
    begin
    SetEnableState("Garage Door Enable", OFF);
    TimerStop(1);
    end;
    end;
     
    Last edited by a moderator: Apr 16, 2015
    breadknife, Apr 16, 2015
    #1
  2. breadknife

    Roosta

    Joined:
    Nov 22, 2011
    Messages:
    560
    Likes Received:
    1
    Location:
    Australia
    If it was me i would set the enable control to a timer widget, and garage door open/close to a 1 or 2 sec timer widget then do the similar to your code..

    Once garage door enabled and garage door open close is ON then
    Pulse garage door1
    Pulse garage door2

    -Out of interest did your logic examples spit out any errors?
    -How exactly do your dlts control the open/close? The logic may affect their operation.
    -Also I believe the logic engine in the wiser does take about 5 mins from boot up to actually start running...
    -And lucky last what do the 2 garage door channels do? My assumption was that one did up and one did down.. Is that correct?
     
    Roosta, Apr 16, 2015
    #2
  3. breadknife

    breadknife

    Joined:
    Apr 16, 2015
    Messages:
    19
    Likes Received:
    0
    Location:
    Western Australia
    OK, thanks Roosta,
    I'll do some experiments with the timer widget if i can't grasp what i'm doing wrong with the code.

    -Out of interest did your logic examples spit out any errors?
    No errors that i am aware of (still learning!) logic compiled and downloaded.
    -How exactly do your dlts control the open/close? The logic may affect their operation.
    eDLT's are using two 'Bell Press', just press both at the same time.
    -Also I believe the logic engine in the wiser does take about 5 mins from boot up to actually start running...
    Yes i learn't the hard way a couple of times assuming i made a mistake in my code but it was me being impatient!
    -And lucky last what do the 2 garage door channels do? My assumption was that one did up and one did down.. Is that correct?
    The two channels are actually wired in series as a couple of times i have noticed channels coming on after a power outage (they were set to off in module after power outage). If i was away or the house was unattended i wanted some additional piece of mind that two channels had to fail,close or chatter for the door to open (unlikely), in the future i aim to install a door limit which will feed back into the system to indicate/alarm status of door.
     
    breadknife, Apr 16, 2015
    #3
  4. breadknife

    Roosta

    Joined:
    Nov 22, 2011
    Messages:
    560
    Likes Received:
    1
    Location:
    Australia
    Cool.. Also maybe re- arranging your code to follow the below would get it working..

    Initialise the timer to 0

    If 'Gd enable' = on then
    Begin
    Timerstart(1)
    Once 'GD open/close' = on then
    Begin
    Pulse 'GD1'
    Pulse 'GD2'
    End
    Once timertime(1)=>300 then
    Begin
    Setgroup 'gd enable' to off
    Timerstop(1)
    End
    End
    End
     
    Roosta, Apr 16, 2015
    #4
  5. breadknife

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,554
    Likes Received:
    180
    Location:
    Adelaide, Australia
    If you are using a CBus relay to pulse the garage door open you don't need any logic in the Wiser at all. Set the enable up as a button press timer, then in the relay logic tab enter the enable group and select the AND function.

    Timers in logic are rarely required. You are much better off using the pulse function of the button or PulseCBusLevel function.

    Also, never use the bell press function if you want to detect it in logic. The logic is only scanned every 200mS and it is surprisingly easy to press and release a button in the interval and the logic will miss it. If you want to detect button presses in logic, set the button function to ON, then turn it back off at the end of the logic processing routine.
     
    Last edited by a moderator: Apr 16, 2015
    Ashley, Apr 16, 2015
    #5
  6. breadknife

    breadknife

    Joined:
    Apr 16, 2015
    Messages:
    19
    Likes Received:
    0
    Location:
    Western Australia
    Thanks for helping Roosta.

    I tried what you suggested but it was doing weird stuff :confused:, bit hard to determine exactly what 'weird' stuff. Code i used from your suggestion was:
    Removed one of the pulses for testing! bad code = broken garage door!!

    if (GetEnableState("Garage Door Enable") = ON) then
    begin TimerStart(1);


    Once (GetEnableState("Garage Door Open/Close") = ON) then
    begin PulseCBusLevel("Network", "Lighting", "Garage Door1", 100% ,"0s", "0:00:01", 0%);
    end;

    Once TimerTime(1) > 5 then
    begin SetEnableState("Garage Door Enable", OFF);
    TimerStop(1);
    end;
    end;

    So after this no go, i used the following to just have the timer working, still no cigar. ( I did this test previously and managed to get it working, not sure whats different this time!)

    if (GetEnableState("Garage Door Enable") = ON) then
    begin TimerStart(1);


    Once TimerTime(1) > 5 then
    begin SetEnableState("Garage Door Enable", OFF);
    TimerStop(1);
    end;
    end;

    Log file shows button being pressed from Wiser app. ( Thats me turning it off, not the timer!)

    16/04/2015 9:10:47 PM C-Bus Rx : Set Enable Control, Garage Door Enable to Value 0 (unit 255)
    16/04/2015 9:10:50 PM C-Bus Rx : Set Enable Control, Garage Door Enable to Value 255 (unit 255)
    16/04/2015 9:12:54 PM C-Bus Rx : Measurement Application : Device 201, Channel 1 = 185E-1 (unit 201)
    16/04/2015 9:15:54 PM C-Bus Rx : Measurement Application : Device 201, Channel 1 = 185E-1 (unit 201)
    16/04/2015 9:16:32 PM C-Bus Rx : Set Enable Control, Garage Door Enable to Value 0 (unit 255)
    16/04/2015 9:16:34 PM C-Bus Rx : Set Enable Control, Garage Door Enable to Value 255 (unit 255)
     
    breadknife, Apr 16, 2015
    #6
  7. breadknife

    breadknife

    Joined:
    Apr 16, 2015
    Messages:
    19
    Likes Received:
    0
    Location:
    Western Australia
    Thanks for the advice Ashley,
    seems i may need to re-think my approach! I'm reasonably happy how the eDLT works with two bell presses (not wanting to detect these with logic), it was more with wiser app on phones and accidentally opening the garage door hence the attempt at the two stage approach.
    However it seems i may heading for more issues if i don't change my tactics.
    Cheers
     
    breadknife, Apr 16, 2015
    #7
  8. breadknife

    breadknife

    Joined:
    Apr 16, 2015
    Messages:
    19
    Likes Received:
    0
    Location:
    Western Australia
    Great solution Ashley, Thanks, works well.
    Maybe a couple of stupid questions but i had to use the 'lighting application' for the enable as i needed the timer (no other option).
    I assume this is correct! (It works!!)

    Also i noticed the timer on the two eDLT's i configured the same and the wiser do not 'mirror' one another. Whilst one is timing down the others are not, i assume this is normal. I guess it would be a big ask (network traffic) to broadcast each timer for each device on the bus.
    Therefore i assume that each timer used is in each device where it was programmed?

    Thanks Roosta also, have to look for something else that needs some logic!!
    Cheers
     
    breadknife, Apr 16, 2015
    #8
  9. breadknife

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,554
    Likes Received:
    180
    Location:
    Adelaide, Australia
    Using the lighting application is the way to do this sort of thing. Saves mucking around with multiple applications in the switches.

    Timers run inside the device that initiates them. A timer is linked to a specific group address and there can only be a single timer per group address running at a time. If another device changes that group address or initiates another timer on the same group address, the origin timer is cancelled.

    Timers set in logic with the TimerStart function are completely independent and not associated with any specific group address.
     
    Ashley, Apr 17, 2015
    #9
  10. breadknife

    breadknife

    Joined:
    Apr 16, 2015
    Messages:
    19
    Likes Received:
    0
    Location:
    Western Australia
    Cheers Ashley.
     
    breadknife, Apr 20, 2015
    #10
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.