Debug Program Logic

Last modified by Scott Kohlmann on 2024/01/05 18:55

The ShowRunnerCLC™ program has several powerful command-line tools that can be used in order to determine whether or not the program is configured correctly. Knowledge of how to use these tools can help with on-site troubleshooting and narrow down issues with programming or installation.

All of these tools are unique to the ShowRunnerCLC™ program, requiring that ShowRunnerCLC™ be loaded to the processor with a valid license. In addition to ShowRunnerCLC™ being loaded, a valid SrConfig.json file must also be loaded. 

When using these troubleshooting tools, it is advisable to have Text Console be maximized on the screen. Many of these commands will return tables of information in Text Console, and if the window is too small the tables will be broken up and difficult to read.

These commands do not need to be used individually, and in fact it is often useful to combine the use of these tools for effective troubleshooting. For example, if lights are not installed or a piece of control hardware is offline or physically defective, the program logic can still be verified by enabling area debug messages and then simulating keypad presses or occupancy sensor state changes. The debug messages will enable confirmation that the configuration file is correct and that once the fixtures are installed/devices brought online, they will begin functioning correctly. 

sr show commands

The first command, sr show, is useful for determining what devices are currently programmed in the configuration file. 

The sr show command can take a number of different arguments in order to see different types of defined hardware. A list of all possible commands can be displayed in the text console by running the command "sr show ?", however the most frequently used are given below:

CommandResult
sr show global idsReturns a table of all objects in the configuration sorted by their Global ID and displaying their Type and Name.
sr show load

Returns a table of load controllers and loads. Each row in the table is either a load controller or a load, and load controllers are always followed by all of their loads. The table includes the Global ID for each load and load controller, as well as current online status for the load controller and current level for the load.

Use this table to verify that load controllers are online, and that their outputs are associated with the correct areas.

sr show occ

Returns a table of all occupancy sensors currently defined in the program. This table includes the ID and Global ID for each sensor, as well as their current occupancy status. Occupancy sensors that are model "GLS-ODT-C-NS" are generic non-system sensors, and their Cresnet ID and Online Status are linked to their host device (e.g. the GLS-SIM hosting them). 

Use this table to verify that occupancy sensors are online and associated with the correct areas. Also use this table to determine the occupancy sensor ID for simulating or debugging program logic.

sr show keyp

Returns a table of all keypads currently defined in the program. This table includes the ID and Global ID for each keypad, as well as current online status and associated area. 

Use this table to verify that keypads are online, of the correct type (style), and associated with the correct areas. Also use this table to determine the keypad ID for simulating or debugging program logic. 

sr show keyp actReturns a table of custom (X-type) keypads and the actions currently associated with them. Use this table to verify custom keypads are programmed correctly.
sr show keysReturns a table of all keyswitches currently defined in the program, along with their ID and their current status (online/offline, active/inactive).
sr show photo

Returns a table of all photocells currently defined in the program. This table includes the ID for each photocell as well as their current reading. 

Use this table to verify that the host device for each photocell is online and matches what has been installed (e.g. a photocell that is defined with a GLS-SIM will not work if it has been installed on a ZUMLINK-JBOX). Also use this table to determine the photocell ID for simulating or debugging program logic.

sr show area

Returns a table with all areas currently defined in the program. This table includes the ID and Global ID for each area. The table also includes information related to the area's occupancy status at the time the command was run. 

Use this table to verify areas are set to the correct occupancy mode and have the correct number of loads associated with them. Also use this table to determine an area ID for simulating or debugging program logic.

sr debug logic commands

As of version 3.020, debug messages print to the event log instead of the console. If the program is reset, "debug logic" commands will need to be run again upon restart but "eventlog" settings will persist and do not need to be run again.
To enable debug messages to print to the console in version 3.020 and newer, run the following commands:

  • sr eventlog true
  • sr eventlog console true
  • sr eventlog level trace

The sr debug logic command is used to enable or disable debug messages in the Text Console. Some devices are more chatty than others when it comes to the number of debug messages sent, so there are several categories of debug messages available that can be toggled independently. A list of all possible debug commands can be displayed in the text console by running the command "sr debug logic ?", however the most frequently used are given below:

CommandResult
sr debug logicDisplays the currently enabled debug logs.
sr debug logic offTurns off all debug messages.
sr debug logic area

Toggles debug messages associated with areas. When enabled, any changes to an area will be logged, including any changes to the occupancy status, any changes to the current scene, the source of the scene change, as well as other information.

sr debug logic sensToggles debug messages associated with sensors. This includes changes in occupancy status for occupancy sensors as well as changes to photocell readings above a certain threshold.
sr debug logic joinsToggles debug messages associated with joins, including keypads and keyswitches. When enabled, any keypad button presses will be logged including the keypad, the button, and the type of press (i.e. press, tap, hold, release, etc.)
sr debug logic loadToggles debug messages associated with loads, including when a scene recall is performed on them. 

sr simulate commands

The sr simulate commands can be used to simulate certain actions or sensor readings. This is useful for verifying certain aspects of the lighting program, such as whether an occupancy sensor is triggering the correct areas, or a keypad is programmed correctly. A list of all possible simulate commands and their usage can be displayed in the text console by running the command "sr sim ?", but the most common are discussed below.

It is often useful to combine sr simulate commands with sr debug logic commands. If debug logic is enabled, debug messages will appear in the Text Console when certain actions are simulated. For example, with sr debug logic area enabled, messages will appear to confirm a change in area status if sr sim occ [x] true is run on an occupancy sensor associated with an area.

Note that these commands only simulate sensor readings or button presses, but do not affect the actual output of a device. 

For example, using "sr sim occ [x] false" will simulate a vacant signal from that occupancy sensor and vacate the area associated with the sensor, but will not force vacate the sensor. If the sensor is occupied when the command is run, it will continue to output an occupied signal. The sensor output and program state will be out of sync until the sensor vacates on its own or is force vacated using a remote.

CommandResult
sr sim keyp [x] [y] [z]

Simulates presses on a keypad. The type of press simulated must be exact (e.g. if an action is defined as a "tap" action, simulating a "press" will not do it). The button index is the index for the actual button being pressed regardless of keypad layout (e.g. a two-button C2N-CBD-P keypad would need to be simulated on buttons 3 and 6, not 1 and 2). If you are ever uncertain of which button index corresponds to each physical button, you can run "sr debug logic joins" and press the button on the keypad to confirm.

  • [x] = Integer keypad ID (taken from sr show keyp)
  • [y] = Integer button index (1 through 8 for Cameo and Zūm keypads, 1 through 15 for Horizon keypads)
  • [z] = String press type: press, tap, doubletap, hold, or release
sr sim keys [x] [y]

Simulates turning or pressing a keyswitch. Momentary keyswitches should be tested by first simulating true and then simulating false in order to simulate a full cycle. 

  • [x] = Integer keyswitch ID (taken from sr show keys)
  • [y] = Binary keyswitch state (true for on/pressed or false for off/not pressed)
sr sim occ [x] [y]

Simulates occupied or vacant status for an occupancy sensor.

  • [x] = Integer occupancy sensor ID (taken from sr show occ)
  • [y] = Binary occupancy state (true for occupied or false for vacant)
sr sim part [x] [y]

Simulates partition detected status for a partition sensor.

  • [x] = Integer partition sensor Global ID (taken from sr show part)
  • [y] = Binary partition state (true for detected or false for not detected; inverse if partition sensor logic is inverted)
sr sim photo [x] [y]

Simulates photocell reading in order to verify daylight harvesting is configured.

  • [x] = Integer photocell ID (taken from sr show photo)
  • [y] = Integer photocell reading (16 bit integer; 0 = 0% reading and 65535 = 100%)