Scene scrolling/toggling

Discussion in 'C-Bus Wired Hardware' started by pbelectrical, Nov 28, 2016.

  1. pbelectrical

    pbelectrical

    Joined:
    Aug 16, 2004
    Messages:
    121
    Likes Received:
    0
    Location:
    hobart
    Hi all, I have a request from a customer that has me a bit stumped at the moment. For the main living area they would like four seperate scenes to control different groups of lights. They would like one key input to scroll between the different scenes and then another key input to toggle the last scene that was set, on and off.

    The network includes a color touch screen so I can use logic. The scenes can also reside on the touch screen. Input units are mostly standard saturn but there is an edlt that they would like two keys to do this as well.

    Any pointers would be appreciated. Thanks.
     
    pbelectrical, Nov 28, 2016
    #1
  2. pbelectrical

    NickD Moderator

    Joined:
    Nov 1, 2004
    Messages:
    1,427
    Likes Received:
    64
    Location:
    Adelaide
    The eDLT can do all of this itself... have a play with the scene cycle and scene toggle key functions within the scene widget.

    The catch is that these key functions only works for scenes stored within the eDLT itself, so it actually becomes more tricky to offer from multiple units.

    For the scene cycle you tell it which scenes within the unit you want included in the cycle.. you can (from memory) even cycle through the list and see the names before deciding which one to trigger.

    See if they will be happy with just using the eDLT.

    Nick
     
    NickD, Nov 29, 2016
    #2
  3. pbelectrical

    pbelectrical

    Joined:
    Aug 16, 2004
    Messages:
    121
    Likes Received:
    0
    Location:
    hobart
    Thanks Nick, I will have a look at the the eDLT, that sounds simple. Unfortunately they also want to do the same thing from some Saturn switches (already installed by others and mounted horizontally so not easily changed to eDLT) I am going to have a play with having one key input increment a counter and then using this value in the logic engine to set the scene.

    Key 1 -

    press 1 - set counter to 1
    press 2 - set counter to 2
    press 3 - set counter to 3
    press 4 - set counter to 4
    press 5 - reset counter, then set counter to 1

    then have the scenes triggered by the counter value

    Key 2 -

    if OFF - then set scene all off

    if ON - and counter = 1 then set scene 1
    if ON - and counter = 2 then set scene 2
    etc
    etc

    The above is just rough but do you think the general idea is sound. Thanks.
     
    pbelectrical, Nov 29, 2016
    #3
  4. pbelectrical

    pbelectrical

    Joined:
    Aug 16, 2004
    Messages:
    121
    Likes Received:
    0
    Location:
    hobart
    OK I've had a bit of a crack at the scene scrolling logic, learning as I go with the PICED help files.

    This is what I have set up so far -

    Global variable -

    KitchenPressCounter : integer;

    Initialisation -

    KitchenPressCounter := 0;

    Logic Module -



    Code:
    once GetLightingState("Kitchen scene number") = ON then
    
    begin
    
     KitchenPressCounter := PressCounter + 1;
    
     if KitchenPressCounter = 1 then
    
       SetScene("Kitchen scene 1");
    
     if KitchenPressCounter = 2 then
    
       SetScene("Kitchen scene 2");
       
       if KitchenPressCounter = 3 then
    
       SetScene("Kitchen scene 3");
    
       if KitchenPressCounter = 4 then
    
       SetScene("Kitchen scene 4");   
    
     if KitchenPressCounter = 5 then
    
     begin
    
       SetScene("Kitchen scene all off");
    
       KitchenPressCounter := 0;
    
     end;
    end; 
    When I compile the logic module I get the following error -

    Error C104 at line 100:25 - Identifier is not declared.



    I have a GA in a key input named Kitchen scene number and the key function is set to ON. What I am expecting to happen is that with each push of the key input the counter will increment up 1 and set each scene in sequence from scene 1 to scene 5, and then repeat.

    How am I doing so far.
     
    Last edited by a moderator: Nov 29, 2016
    pbelectrical, Nov 29, 2016
    #4
  5. pbelectrical

    NickD Moderator

    Joined:
    Nov 1, 2004
    Messages:
    1,427
    Likes Received:
    64
    Location:
    Adelaide
    It would help to know which is line 100, but it seems you might just have mixed up your variable names.

    The basic idea is sound. You will obviously need to turn the group OFF (as part of the scene?).

    If you keep your scenes small (7 or less groups) and avoid ramp rates then teh whole scene should fit in one message and the response time will be pretty good.

    Nick
     
    NickD, Nov 29, 2016
    #5
  6. pbelectrical

    NickD Moderator

    Joined:
    Nov 1, 2004
    Messages:
    1,427
    Likes Received:
    64
    Location:
    Adelaide
    Another thought... I haven't got the source handy or a unit to try, but the eDLT *might* be able to do scene *cycle* on remote scenes (it definitely can't do scene *toggle* on remote scenes though because this requires knowledge of the scene components).

    You would just need to set up a bunch of remote scenes in the eDLT and then select them in the scene cycle.

    Nick
     
    NickD, Nov 29, 2016
    #6
  7. pbelectrical

    pbelectrical

    Joined:
    Aug 16, 2004
    Messages:
    121
    Likes Received:
    0
    Location:
    hobart
    Thanks Nick.

    I have fixed a typo in my last post, "Kitchen scene number" is the correct GA.

    I will edit the scenes to include setting this GA to off. Or would it be better to set the key function as a bell press.

    How do I tell which is line 100, I usually write my modules with the logic wizard but this time I cut and pasted the example from the help file and changed the GA's etc to suit my project.
     
    pbelectrical, Nov 29, 2016
    #7
  8. pbelectrical

    pbelectrical

    Joined:
    Aug 16, 2004
    Messages:
    121
    Likes Received:
    0
    Location:
    hobart
    Found the compiling error

    Code:
    KitchenPressCounter := PressCounter + 1;
    should have been

    Code:
    KitchenPressCounter := KitchenPressCounter + 1;
    Will visit site tomorrow to down load and test.

    If the scene scrolling works I will then attempt to have another button toggle the set scene on and off :eek:
     
    Last edited by a moderator: Nov 29, 2016
    pbelectrical, Nov 29, 2016
    #8
  9. pbelectrical

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,548
    Likes Received:
    178
    Location:
    Adelaide, Australia
    You could make life (and the logic) a bit simpler by triggering the scenes via their action selector rather than name. If you gave the scenes consecutive action selectors (i.e. Off scene=0, scene 1=1 etc) then you could set the scene directly from your counter as follows:

    Code:
    once GetLightingState("Kitchen scene number") = ON then
    begin
      kitchenPressCounter := (kitchenPressCounter + 1) mod 6;
      SetTriggerLevel("Kitchen Scene Trigger", kitchenPressCounter);
      SetLightingState("Kitchen scene number", OFF); 
    end;
     
    Ashley, Nov 29, 2016
    #9
  10. pbelectrical

    pbelectrical

    Joined:
    Aug 16, 2004
    Messages:
    121
    Likes Received:
    0
    Location:
    hobart
    This is what I have come up with. Downloaded to the touchscreen and it all seems to be working OK. We will see over the next few days whether it stays in-sync etc.

    Code:
    { Scrolls and sets living scenes with each push of a single key input }
     once GetLightingState("living room scene number") = ON then
    begin
    
     LivingPressCounter := LivingPressCounter + 1;
    
     if LivingPressCounter = 1 then
    
       SetScene("Living room scene 1");
    
     if LivingPressCounter = 2 then
    
       SetScene("Living room scene 2");
       
     if LivingPressCounter = 3 then
    
       SetScene("Living room scene 3");
                                             
     if LivingPressCounter = 4 then
    
     begin
    
       SetScene("Living room scene 4");      
                                          
      
       MasterPressCounter := 0;
    
     end;
    end;
    
    {turns living scene 1 back on if it was the last scene set}
    once (GetLightingLevel("living lights on/off") = 100%) and
         (GetLightingLevel("living scene 1 set") = 100%) then
    begin
      SetScene("Living room scene 1");
    end;
    
    {turns living scene 2 back on if it was the last scene set}
    once (GetLightingLevel("living lights on/off") = 100%) and
         (GetLightingLevel("living scene 2 set") = 100%) then
    begin
      SetScene("Living room scene 2");
    end;
    
    {turns living scene 3 back on if it was the last scene set}
    once (GetLightingLevel("living lights on/off") = 100%) and
         (GetLightingLevel("living scene 3 set") = 100%) then
    begin
      SetScene("Living room scene 3");
    end;
    
    {turns living scene 4 back on if it was the last scene set}
    once (GetLightingLevel("living lights on/off") = 100%) and
         (GetLightingLevel("living scene 4 set") = 100%) then
    begin
      SetScene("Living room scene 4");
    end;
    

    I set the GA " living room scene number " as a bell press so the GA was reset to off after each press.

    Then I added 4 other GA to the scenes to signal when the scene is set ( " living scene 1 is set " etc), then programmed another input as an on/off with the GA " living lights on/off ", using the logic above I can use this key input to turn the lights of by triggering an all off scene when the GA is 0% and then triggering the last scene that was set when the GA is 100%.

    Pressing key 1 scrolls and sets the 4 scenes, pressing key 2 turns off all the lights and a second press turns the last scene back on.

    Using cut and paste to copy the code and then changing the GA's to suit I have duplicated this to do the same with 4 other scene sets in 4 other areas of the house.
     
    pbelectrical, Dec 1, 2016
    #10
  11. pbelectrical

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,548
    Likes Received:
    178
    Location:
    Adelaide, Australia
    This won't work reliably. As your logic module is only run every 200mS if the button is pressed and released in this time gap it will not be detected. (This is surprisingly easy to do). To detect key presses in logic always set the key function to ON and reset it in the logic.
     
    Ashley, Dec 1, 2016
    #11
  12. pbelectrical

    pbelectrical

    Joined:
    Aug 16, 2004
    Messages:
    121
    Likes Received:
    0
    Location:
    hobart
    Thanks Ashley, hadn't noticed any issues but I made the change to prevent future problems. All seems to e working well.
     
    pbelectrical, Dec 7, 2016
    #12
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.