Dynamic Labels with Logic

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by jamesng, Nov 21, 2010.

  1. jamesng

    jamesng

    Joined:
    Jun 6, 2005
    Messages:
    38
    Likes Received:
    0
    I have a DLT with the lighting group "SelectBlind" set to button 4

    I have the following test logic in PAC which I want to increment a counter on button press and change the DLT label to reflect selected blind.

    Ultimately I'll used the SelectedBlind variable value in conjunction with an up, down, or stop button press to issue RS232 commands to the blinds (a bit like the way the Somfy remotes work)

    Here's the logic that's not working at present...

    once (GetLightingState("SelectBlind") = ON) then
    begin

    if SelectedBlind = 3 then
    SelectedBlind := 0
    else
    SelectedBlind := SelectedBlind + 1;

    { Set the DLT Label for network 254, application lighting, group SelectBlind (123) to 'button label value' }
    Case SelectedBlind of
    0 : SetStringIBSystemIO("Label Group Text", 254, "Lighting", "SelectBlind", 0, 'Select Blind');
    1 : SetStringIBSystemIO("Label Group Text", 254, "Lighting", "SelectBlind", 0, 'Study');
    2 : SetStringIBSystemIO("Label Group Text", 254, "Lighting", "SelectBlind", 0, 'Stairs');

    End;

    End;


    I get the following error in the Logs

    DateTime= 11/22/2010 4:20:41 AM App= 056 Lighting Group= 123 SelectBlind Unit= 021 KEYBL5/DLTLOUNG Event= Group on
    DateTime= 11/22/2010 4:20:41 AM App= 056 Lighting Group= 123 SelectBlind Unit= 021 KEYBL5/DLTLOUNG Event= Group off
    DateTime= 11/22/2010 4:20:41 AM App= 056 Lighting Group= Unknown Unit= 001 PC_PACA/PAC Event= //JAMES/254/56 0 123 - F0 0 537461697273 #sourceunit=1 OID=4d565b50-d7bf-102d-8f63-e65605ef80c9

    DLT is Firmware Version 3, and am running latest versions of Toolkit and PICED plus current firmware on PAC

    What am I missing?



    Cheers
    James
     
    Last edited by a moderator: Nov 21, 2010
    jamesng, Nov 21, 2010
    #1
  2. jamesng

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    The string "537461697273" in the log message is "Stairs", so it appears that the logic is working.

    It is generally better to use the C-Bus Diagnostic Utility for looking at C-Bus messages, as it is usually easier to understand.

    Is the label being shown on the DLT? If not, you may have a mismatch between the variant selected in the DLT and in the logic.
     
    Darren, Nov 21, 2010
    #2
  3. jamesng

    jamesng

    Joined:
    Jun 6, 2005
    Messages:
    38
    Likes Received:
    0
    Not ... the DLT label is not changing

    Changing the variant to 1 to match the default labels I keyed in doesn't seem to work either (have also updated the group name between posts)

    0 : SetStringIBSystemIO("Label Group Text", 254, "Lighting", "BlindsTrigger-SelectBlind", 1, 'Select Blind');
    1 : SetStringIBSystemIO("Label Group Text", 254, "Lighting", "BlindsTrigger-SelectBlind", 1, 'Study');
    2 : SetStringIBSystemIO("Label Group Text", 254, "Lighting", "BlindsTrigger-SelectBlind", 1, 'Stairs');

    Looking at the CB Diagnostic Utility a command is being sent to the GA
    15:19:19 Rx : = GA 123 Off
    15:19:20 Rx : 05153800797BBA<CR>
    15:19:20 Rx : = GA 123 On
    15:19:20 Rx : 05153800017B32<CR>
    15:19:20 Rx : = GA 123 Off
    15:19:21 Rx : 05153800797BBA<CR>
    15:19:21 Rx : = GA 123 On
    15:19:21 Rx : 05153800017B32<CR>
    15:19:21 Rx : = GA 123 Off

    ... Do I need to setup the DLT in a different way to accept the dynamic lables sent from the PAC (see attached screenshot)??
     

    Attached Files:

    • DLT.png
      DLT.png
      File size:
      72.7 KB
      Views:
      582
    jamesng, Nov 22, 2010
    #3
  4. jamesng

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    There are several possible causes of problems in what you are doing.

    The first is that if you are using a bell press on the DLT key and you press and release it quickly, the off-on-off transitions may happen in between logic engine scans and the logic engine may miss it entirely. It is better to have the DLT have an On or On/Off key function and have the logic engine switch the group back off.

    The second problem is that the SelectedBlind variable will have a value of 3 every fourth time. This will result in no label being sent out.

    Rearranging the code as shown below will fix both of these problems:

    Code:
    if GetLightingState("SelectBlind") = ON then
    begin
      SelectedBlind := SelectedBlind + 1;
      if SelectedBlind = 3 then
        SelectedBlind := 0;
    
      { Set the DLT Label for network 254, application lighting, group SelectBlind (123) to 'button label value' }
      Case SelectedBlind of
        0 : SetStringIBSystemIO("Label Group Text", 254, "Lighting", "SelectBlind", 0, 'Select Blind');
        1 : SetStringIBSystemIO("Label Group Text", 254, "Lighting", "SelectBlind", 0, 'Study');
        2 : SetStringIBSystemIO("Label Group Text", 254, "Lighting", "SelectBlind", 0, 'Stairs');
      End;
      SetLightingState("SelectBlind", OFF);
      ToggleLEDState;
    End;
    I also have it toggling the user LED on the PAC so that you can see the logic is detecting the "SelectBlind" group.

    The last problem is related to variants. In the C-Bus protocol, the first variant is numbered 0. The C-Bus ToolKit refers to this as variant 1. PICED refers to it as variant 0. This causes confusion and we will try to solve this in the next release of PICED (issue #20687).

    So use variant 0 in the PAC and variant 1 on the DLT and it will all work nicely.

    I have tested the above and it works fine.

    I am not sure why you want to display the text "Select Blind" as you cycle through the options. Unless you just have it time-out to this text, it seems that this will be confusing.
     
    Darren, Nov 22, 2010
    #4
  5. jamesng

    jamesng

    Joined:
    Jun 6, 2005
    Messages:
    38
    Likes Received:
    0
    Instead of setting the string value I'm getting default labels on the DLT when the logic runs.

    For example, I've programmed the DLT to say "My Label", but when I push the button to execute the logic code the DLT label is updated to "Button 4" instead of the string values in logic 'Study', 'Stairs' etc.

    Even this test logic does this

    Code:
    if GetLightingState("SelectBlind") = ON then
    begin  
      SetStringIBSystemIO("Label Group Text", 254, "Lighting", "SelectBlind", 0, 'Test');
      SetLightingState("SelectBlind", OFF);
      ToggleLEDState;
    End;
    
    Is there something else that I'm overlooking in the setup of the DLT?
     
    jamesng, Nov 23, 2010
    #5
  6. jamesng

    Dave Byron

    Joined:
    Aug 3, 2004
    Messages:
    835
    Likes Received:
    0
    Location:
    Casurina
    jamesng
    if not using English
    make sure the language is set right, its a pain in th a--- in DLTs

    dave
     
    Dave Byron, Nov 23, 2010
    #6
  7. jamesng

    jamesng

    Joined:
    Jun 6, 2005
    Messages:
    38
    Likes Received:
    0
    I'm using English, but just added

    SetIntIBSystemIO("Label Language",1);

    to the Init logic and now it's working
     
    jamesng, Nov 23, 2010
    #7
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.