Wiser2 Scenes - how to turn OFF?

Discussion in 'C-Bus Wiser 2 Controller' started by Jeff, Mar 9, 2018.

  1. Jeff

    Jeff

    Joined:
    Feb 21, 2018
    Messages:
    21
    Likes Received:
    0
    Location:
    New Zealand
    Hi,

    Noobie apologies in advance if I missed this in the mountain of old documentation!

    My installer has created TWO copies of each scene. o_O Each pair of scenes is identical, except for:
    • one has levels=100% and one has levels=0
    • one has action-selector=1 and the other has action-selector=0

    The problem is that when groups are added / removed from a scene, the changes gets missed in the paired scene. :mad:

    The scene-pairs are triggered by Trigger Control / scene-name-trigger / then action 0 for off and 1 for on...

    There must be a better way to turn a Wiser2 scenes off? :confused:
     
    Jeff, Mar 9, 2018
    #1
    1. Advertisements

  2. Jeff

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    809
    Likes Received:
    33
    Location:
    Adelaide, Australia
    A scene is just a collection of ga's with pre-defined values that are loaded when a scene is triggered, so the simple answer to your question is "No, you need to create separate on scenes and off scenes, just as the installer has done". The new eDLT's allow you to turn off a scene but this only works for scenes defined in the eDLT so is not much help. You can turn a scene off in logic however, so you could write a simple line of code that detects action select or 0 and sets your single scene off.
     
    Ashley, Mar 9, 2018
    #2
    1. Advertisements

  3. Jeff

    Jeff

    Joined:
    Feb 21, 2018
    Messages:
    21
    Likes Received:
    0
    Location:
    New Zealand
    ummm, do you mean, in Wiser2 Logic:
    • watch for a trigger event with the action set to 0
    • get the Wiser2 scene components (dont know how to query the wiser2 scene contents yet...)
    • iterate over each setting its level to 0
    • send out the scene-break message
    I have found, but not yet tried Logic Engine: SetSceneLevel(32, 255, 0) - assuming this was for C-Bus scenes, which I haven't yet found much detail except in the C-Gate1 Server docs.
     
    Jeff, Mar 9, 2018
    #3
  4. Jeff

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    809
    Likes Received:
    33
    Location:
    Adelaide, Australia
    Code:
    once (GetTriggerLevel("Your trigger group") = 0% then setSceneLevel("sceneName", 0, 0);
    That's it :)
     
    Ashley, Mar 9, 2018
    #4
  5. Jeff

    Jeff

    Joined:
    Feb 21, 2018
    Messages:
    21
    Likes Received:
    0
    Location:
    New Zealand
    Fab, thank you :)
    I had just finished testing something similar - I had:
    Code:
    once GetTriggerLevel("TRIGGER - TEST") = 0 then
    begin
      if SceneIsSet("SCENE - TEST" ) then
      begin
        setSceneLevel( "SCENE - TEST", Darkness, Immediate );
      end;
    end;
     
    Jeff, Mar 9, 2018
    #5
  6. Jeff

    Jeff

    Joined:
    Feb 21, 2018
    Messages:
    21
    Likes Received:
    0
    Location:
    New Zealand
    Next is to put the Triggers and Scenes into an associative-array... if that exists in Logic... and if PICED will translate the Tags into group numbers...
     
    Jeff, Mar 9, 2018
    #6
  7. Jeff

    Jeff

    Joined:
    Feb 21, 2018
    Messages:
    21
    Likes Received:
    0
    Location:
    New Zealand
    I seem to be having an issue with Logic Engine Tag translation - I assume:
    • happens for double-quoted entries in the code
    • happens pre-compile
    but when I try the following code I get:
    • Error C261 at line nn:nn - Tag Error
    • even when I cut-n-paste tags that are recognised elsewhere
    Is there a hint to make the Tag substitution work?

    My code looks like:
    Code:
    // TYPE section
    TSceneTrigger = record
      Scene : integer;
      Trigger : integer;
    end;
    
    // Global Variables
    SceneTriggers : array[ 1..20 ] of TSceneTrigger;
    
    // Initialisation
    SceneTriggers[1].Scene   := "SCENE - TEST";
    SceneTriggers[1].Trigger := "TRIGGER - TEST";
    
     
    Jeff, Mar 9, 2018
    #7
  8. Jeff

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    809
    Likes Received:
    33
    Location:
    Adelaide, Australia
    No need to test if the scene is set since it will only be actioned when the action selector goes from non zero to zero.

    If you want to stick all the scenes in an array and loop over them you will have to use numbers as the logic engine will have no context to convert the tag name for you.

    Also, you won't be able to use the ONCE statement and will have to implement it yourself by storing the last value of the action selector for each scene and comparing it with the current value each scan. Alternatively you can just test for an action selector of zero, and if found set the scene then set the action selector back to an unused value.
     
    Ashley, Mar 9, 2018
    #8
  9. Jeff

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    809
    Likes Received:
    33
    Location:
    Adelaide, Australia
    Looks like we crossed over :)

    As I said you won't be able to use tags as the logic engine has no idea you are talking about scenes or trigger groups (how can it?)
     
    Ashley, Mar 9, 2018
    #9
  10. Jeff

    Jeff

    Joined:
    Feb 21, 2018
    Messages:
    21
    Likes Received:
    0
    Location:
    New Zealand
    most other similar pre-compile tools use a comment-hint to assist, e.g.
    Code:
    SceneTriggers[1].Scene   := "SCENE - TEST";  // Tag-Hint: Scene
     
    Jeff, Mar 9, 2018
    #10
  11. Jeff

    Jeff

    Joined:
    Feb 21, 2018
    Messages:
    21
    Likes Received:
    0
    Location:
    New Zealand
    Thanks for the help btw - much appreciated!
     
    Jeff, Mar 9, 2018
    #11
  12. Jeff

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    809
    Likes Received:
    33
    Location:
    Adelaide, Australia
    Given each scene has a number, I would just create an integer array indexed by scene number that contains the appropriate trigger group. Then each scan loop over the array, see if the corresponding trigger group is zero, if it is clear the scene then set the trigger group to some unused value.
     
    Ashley, Mar 9, 2018
    #12
  13. Jeff

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    809
    Likes Received:
    33
    Location:
    Adelaide, Australia
    Do you have an example? I've never come across it.

    You need a colour touch screen or the new SHAC controller. Both these support tag lookup.
     
    Ashley, Mar 9, 2018
    #13
  14. Jeff

    Jeff

    Joined:
    Feb 21, 2018
    Messages:
    21
    Likes Received:
    0
    Location:
    New Zealand
    grrr :mad: - I hate programming the Wiser2 - every one-line change to test something requires a reboot... and that takes down the Wiser2-CNI for the G-Gate2 server and everyone else for more than a minute...

    Can't see why there is not a Transfer tool that just:
    • stops the logic process on the Wiser2
    • emits a message using broadcast_event saying wiser2-logic-stopped
    • transfers the new logic
    • starts the logic process on the Wiser2
    • emits a message using broadcast_event saying wiser2-logic-started
    In Software Development the duration of the code-build-release-test cycle is directly related to developer productivity :(

    And a nasty bug has me stymied for a while - looks like there is an off-by-one difference between PICED Scene Manager and SetSceneLevel() - Scene 21 in Scene Manager is accessed using scene-number 20 in SetSceneLevel().:eek:
     
    Jeff, Mar 9, 2018
    #14
  15. Jeff

    Jeff

    Joined:
    Feb 21, 2018
    Messages:
    21
    Likes Received:
    0
    Location:
    New Zealand
    Here is where I ended up in Logic...
    Code:
    // Constants
    SceneOffTriggerMAX = 1;  // number of SceneOffTrigger entries to check
    
    // Types
    TSceneOffTrigger = record
      SceneName : string;
      SceneNo   : integer;
      TriggerNo : integer;
      LastLevel : integer;
    end;
    
    // Global Vars
    iSceneNo    : integer; // iterator
    SceneOffTriggers : array[ 1..SceneOffTriggerMax ] of TSceneOffTrigger;
    
    // Procedures
    procedure handleSceneOffTrigger ( var SceneInfo : TSceneOffTrigger );
    var
      CurrentLevel      : integer;
    begin
      // LastLevel tracking because ONCE doesn't work on array-elements.
      CurrentLevel := GetTriggerLevel( SceneInfo.TriggerNo );
      if CurrentLevel <> SceneInfo.LastLevel then
      begin
        if CurrentLevel = 0 then
        begin
          setSceneLevel( SceneInfo.SceneNo, AllOff, Immediate );
        end;
        SceneInfo.LastLevel := CurrentLevel;
      end;
    end;
    
    // Initialisation
    SceneOffTriggers[1].SceneName :=   'TEST SCENE';
    SceneOffTriggers[1].SceneNo   :=   20;   // ONE less that Scene Manager!!! Argh.
    SceneOffTriggers[1].TriggerNo :=   6;
    SceneOffTriggers[1].LastLevel :=   255;
    
    // Modules
    for iSceneNo := 1 to SceneOffTriggerMax do
    begin
      handleSceneOffTrigger( SceneOffTriggers[iSceneNo] );
    end;
    
    
    • Very newbie - to Logic and Pascal, so comments on more maintainable code welcomed.
    • This works for me - I only have one scene per trigger
    • If you use xor scenes on the same trigger with different actions...
      • you would need to make SceneInfo.SceneNo a dynamic array.
    • Next iteration of code...
      • see if Logic supports dynamic arrays... SetLength()
      • restore SceneIsSet() test to prevent turning off group elements when Scene is not actually on
      • investigate kill-indicator handling and behaviour
      • explore how triggers are raised from Input Units
     
    Jeff, Mar 9, 2018
    #15
  16. Jeff

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    809
    Likes Received:
    33
    Location:
    Adelaide, Australia
    You don't need to download the logic to test it. You can run it from PICED. Just connect to CBUS. (OPTIONS/CONNECT TO CBUS). It's much easier as you can log things. You may need to stop the wiser logic though or you will have 2 copies running which can get a bit confusing. You only need to download to test widgets.
     
    Ashley, Mar 9, 2018
    #16
  17. Jeff

    znelbok

    Joined:
    Aug 3, 2004
    Messages:
    1,093
    Likes Received:
    5
    How o you stop the wiser logic?
     
    znelbok, Mar 9, 2018
    #17
  18. Jeff

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    809
    Likes Received:
    33
    Location:
    Adelaide, Australia
    Unplug it :). On the Wiser 1 I just connect to the Wiser CNI with PICED which stops everything running. Not sure if you can do that with a Wiser 2 with it's dual CNI's. You can also use a systemIO to turn the "Master Unit" on and off in response to a GA which stops the unit outputting ga's from logic or executing remote scenes. I haven't tried that in a Wiser though.
     
    Ashley, Mar 10, 2018
    #18
  19. Jeff

    Jeff

    Joined:
    Feb 21, 2018
    Messages:
    21
    Likes Received:
    0
    Location:
    New Zealand
    Sigh - that all turned out to have been a waste of time... doesn’t look like there is an eDLT widget that you can use for the Trigger Application... it seems that the whole Scene setup is currently an inconsistent mish-mash. The older docs talk about using Trigger App...

    We need a Trigger App widget on the eDLTs that works kind of like the Fan and Heat level widgets - i.e. sets the Trigger Action to a number of user pre-selected values, you could then use Triggers and Trigger Actions and X-OR Scenes the way the docs imply they were ment to work...

    I have switched to using a Lighting App group as the Trigger for Wiser2 Scene-pairs - I only have 12 scenes, so doubling up for the OFF-scene pair is only a minor PITA.

    I will look into the GGate Server scene approach - if might just be easier to set up the scenes on my server and script the On/Off/Kill Indicator logic via Lighting-app-widgets on the eDLTs. That would enable me to properly detect when the Scene is broken.

    I will also have to make sure that the eDLTS will support turning of the remainder of the scene even if the scene has been broken.
     
    Jeff, Mar 10, 2018
    #19
  20. Jeff

    Jeff

    Joined:
    Feb 21, 2018
    Messages:
    21
    Likes Received:
    0
    Location:
    New Zealand
    Oh - looks like eDLTS send Triggers if you set up a dummy eDLT scene... I will give that a go.
     
    Jeff, Mar 10, 2018
    #20
    1. Advertisements

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.