Problem with SetEnableState()

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by BradJ, May 10, 2008.

  1. BradJ

    BradJ

    Joined:
    Aug 6, 2004
    Messages:
    95
    Likes Received:
    0
    PAC cant send Enable App msgs early in startup (was "Problem with SetEnableState()")

    I've got the following code in a test program:

    Global Variables
    bEnableSMSInterface : Boolean;
    bEnableBlindControl : Boolean;
    bEnableOccupancyMonitor : Boolean;
    bEnableLightsControl : Boolean;
    bEnableEntryPIR : Boolean;
    bEnablePassagePIR : Boolean;
    bEnableVerandahPIR : Boolean;
    bEnablePorticoPIR : Boolean;
    bEnableGaragePIR : Boolean;
    bEnableStartupMessage : Boolean;
    iDebugLevel : Integer;

    Initialisation
    bEnableSMSInterface := TRUE;
    bEnableBlindControl := TRUE;
    bEnableOccupancyMonitor := TRUE;
    bEnableLightsControl := TRUE;
    bEnableEntryPIR := TRUE;
    bEnablePassagePIR := TRUE;
    bEnableVerandahPIR := FALSE;
    bEnablePorticoPIR := TRUE;
    bEnableGaragePIR := FALSE;
    bEnableStartupMessage := TRUE;
    iDebugLevel := 0;

    SetEnableState("SMS", bEnableSMSInterface);
    SetEnableState("Blinds", bEnableBlindControl);
    SetEnableState("Occupancy", bEnableOccupancyMonitor);
    SetEnableState("Lights", bEnableLightsControl);
    SetEnableState("Entry PIR", bEnableEntryPIR);
    SetEnableState("Passage PIR", bEnablePassagePIR);
    SetEnableState("Verandah PIR", bEnableVerandahPIR);
    SetEnableState("Portico PIR", bEnablePorticoPIR);
    SetEnableState("Garage PIR", bEnableGaragePIR);
    SetEnableState("PAC 1 Startup Message", bEnableStartupMessage);
    SetEnableLevel("PAC 1 Debug", iDebugLevel);

    In general, nothing is getting sent out to CBUS. Maybe once in 5 times, one Enable event will be broadcast on to CBUS. Is the Enable application supported?

    Oh, and it also seems to do nothing when run in PICED as well.
    Actually it is now. I swear it wasn't initially... Still not working from the PAC though.

    I'm trying to 'publish' the logic options in my PAC out to CBUS so the status can be showed on a CTOUCH and the options can be disabled from a CTOUCH screen.

    Thanks,
    Brad.
     
    Last edited by a moderator: May 12, 2008
    BradJ, May 10, 2008
    #1
  2. BradJ

    Lucky555

    Joined:
    Aug 13, 2007
    Messages:
    229
    Likes Received:
    0
    C-Bus has 255 Application Addresses in each application there are 255 Group Addresses - Each group address has 255 levels (Off = level 0 & ON = 255).
    About 40 of the application addresses are reserved for lighting type uses. Other standard applications = Heating, Telephony, Secuirty,Trigger, Enable etc which are non lighting in their function. Enable happens to be Application Address 203 (hex CA) You use these applications and group addresses to trigger and enable "stuff" as opposed to controlling lightig loads. For Enable you would have an Enable -Group Address eg GA 01 tag "Time Controls" and either turn this group address on / off / or set it to a specific level (network variable) You would use the GA level (network variable) if you wanted to enable up to 254 functions using the one GA. Similar concept for Trigger Application (203 I think) In this case the levels of a single group address in the Trigger Application are referred to as "Action Selectors"

    So - from your code it looks like you are trying to set Enable Application address "SMS" to a Boolean value instead of an integer value. I am sure the Boolean value is meaningless in relation to C-Bus.
     
    Lucky555, May 11, 2008
    #2
  3. BradJ

    ashleigh Moderator

    Joined:
    Aug 4, 2004
    Messages:
    2,398
    Likes Received:
    26
    Location:
    Adelaide, South Australia
    Minor correction: Enable Control is application 203 ($CB), and Trigger Control is application 202 ($CA).
     
    ashleigh, May 11, 2008
    #3
  4. BradJ

    Lucky555

    Joined:
    Aug 13, 2007
    Messages:
    229
    Likes Received:
    0
    I did that on purpose to make sure someone (anyone) was paying attention :D

    It's one thing to hack code,,, in this arena the added challenge is to
    understand C-Bus "under the hood". This makes it interesting ;)

    I hope my previous post helped - Ashleigh only had a minor correction so I might have been right. People often use constant values for group addresses and their levels...
     
    Last edited by a moderator: May 11, 2008
    Lucky555, May 11, 2008
    #4
  5. BradJ

    BradJ

    Joined:
    Aug 6, 2004
    Messages:
    95
    Likes Received:
    0
    I think CBUS handles the Boolean state OK. My understanding is TRUE and ON both have a value of 255.

    I had also tried changing the SetEnableState to the following just in case

    if (bEnableBlindControl = TRUE) then SetEnableState("Blinds", ON) else SetEnableState("Blinds", OFF);

    but it didn't help.

    I was worried I was overloading either CBUS or the PAC with so many SetEnableStates one after the other so I moved them out of Initialisation into a Module and put delays between each SetEnableState but that made no difference. Most of the time when I reset the PAC, no SetEnableState's are sent from my PAC at all.
     
    BradJ, May 11, 2008
    #5
  6. BradJ

    BradJ

    Joined:
    Aug 6, 2004
    Messages:
    95
    Likes Received:
    0
    Well, I've worked around it. There's nothing wrong with my code. It appears that the PAC cannot set the Enable group early on Startup.

    I simply moved the SetEnable.. commands into a module and put a 5 second delay in front of them. I don't know how short the delay needs to be but that will do for now.

    The issue may be related to what's in this thread as well:

    http://www.cbusforums.com/forums/showthread.php?t=4194
     
    BradJ, May 12, 2008
    #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.