Trigger Problem

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by Jason Conis, Nov 14, 2010.

  1. Jason Conis

    Jason Conis

    Joined:
    Oct 18, 2010
    Messages:
    8
    Likes Received:
    0
    Location:
    Brisbane
    This is driving me nuts... I must be missing something simple in my understanding here... The first block of code works fine. It is a cycle so that one button cycles a scene, I am sure you will work that out quickly. But it doesn't work with Triggers eg the second block. Why is that????

    this one works fine:)

    Outsidevalue := GetSceneLevel("All Outside No Flood"); {use declared variable to store scene level}
    Once GetBoolSystemIO("Scene Outside Ex Floods") = true then {use system IO to change state}
    Case GetSceneLevel("All Outside No Flood")of
    -2: SetSceneLevel("All Outside No Flood", -1 ,4);
    0: SetSceneLevel("All Outside No Flood", -1 ,4);
    -1: SetSceneLevel("All Outside No Flood", 255,4);
    255: SetSceneLevel("All Outside No Flood", 0 ,1);
    End;


    This one sets the scene only not matter how many times or from what devices the trigger is operated.

    If GetTriggerLevel("TG - Outside Lights")= 255 then
    Begin
    Case GetSceneLevel("All Outside No Flood")of
    -2: SetSceneLevel("All Outside No Flood", -1 ,4);
    0: SetSceneLevel("All Outside No Flood", -1 ,4);
    -1: SetSceneLevel("All Outside No Flood", 255,4);
    255: SetSceneLevel("All Outside No Flood", 0 ,1);
    End;
    SetTriggerLevel("TG - Outside Lights", 0);

    End;

    Save my sanity and help please:confused:!!!

    Jason
     
    Jason Conis, Nov 14, 2010
    #1
  2. Jason Conis

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    I am not sure what you mean by this.

    I tried your logic code and it cycled through the different levels nicely.

    Have a look at the recent thread http://www.cbusforums.com/forums/showthread.php?t=6471 which also discusses a solution to scene cycling.
     
    Darren, Nov 14, 2010
    #2
  3. Jason Conis

    Jason Conis

    Joined:
    Oct 18, 2010
    Messages:
    8
    Likes Received:
    0
    Location:
    Brisbane
    Darren

    The trigger only operates the scene once. So if the lights are off, the scene will set, but then if you trigger again, the lights will stay at the scene level. I can see that the trigger has reset from on -> off by the active/inactive properties on the button.

    No matter how many times you operate the trigger, it simply won't affect the scene levels. The code is seeems fine and extremely simple, I don't think the problems is there. Perhaps it is the way my trigger is set up. IE. bell press, Action Selector = on. In reality I have tried many different configurations eg, on/off, and so on. Is there something in the scene, but again, the working code cycles fine.

    It works once so I can't figure it out.

    The other code for example cycles through off -> scene -> on -> off
     
    Last edited by a moderator: Nov 15, 2010
    Jason Conis, Nov 15, 2010
    #3
  4. Jason Conis

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    You should not need to use a bell press for this, since you are switching off the group with the logic. I would suggest using the "on" key function.

    Are you triggering this from within PICED, or using an actual key switch? Is the code running in PICED, a PAC or a touch screen?

    The logic code is correct. It worked for me (running in PICED, triggered from PICED).
     
    Darren, Nov 16, 2010
    #4
  5. Jason Conis

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    The trigger control application group "TG - Outside Lights" is not also the trigger group for the "All Outside No Flood" scene is it?

    That would cause some fairly unexpected behaviour.
     
    Darren, Nov 16, 2010
    #5
  6. Jason Conis

    Jason Conis

    Joined:
    Oct 18, 2010
    Messages:
    8
    Likes Received:
    0
    Location:
    Brisbane
    Darren

    I've got it sorted. I was doing two things wrong.

    Firstly, I had the trigger group tab set with the trigger name in the Scene Editor. As soon as I cleared that (ie "unused"), the code worked. I don't understand why that is.

    Secondly, I didn't have a colectively exhaustive set in my case statement. I didn't realise that a scene with a setting of 75% for example, operating at 25% is not a broken scene thereby returning -2. It returns the level of the setting of the scene. As neat as the case statement is, I had to ditch it for this reason.

    BTW I found it better not using an "ON" switch because at one time when my SetTriggerLevel to "OFF" was missed (for whatever reason), my switches were stuck on and therefore failed to run the code and couldn't be turned off.

    Thanks for your help, much appreciated.
     
    Jason Conis, Nov 17, 2010
    #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.