Our Brands

Impact-Company-Logo-English Black-01-177x54

Welcome to the Schneider Electric Website

Welcome to our website.
		
How can we help you today?
How to perform C-Bus Automation Controller LUA Script logging
C-Bus LUA Script log function is usual to help determine what values various LUS Script functions including C-Bus functions including Measurement Application and User Parameter functions etc. The use of the show Logs(1) to display Current logs window and selecting Show logs for only current script(2) and Clear and running script containing log functions will display any log string messages and parameters (variables).

Default Log Helper Function
The LUA Script Editor contains Helpers - under the Alerts and Logs - contains a log variables function helper which when left clicked enters an example containing some different parameters to log. The results shown in the Current logs window of running a script containing the default log helper is as follows
Default log variables helper

Logging Descriptive String and Value
Using log function can be prefixed with a string as well as the parameter(variable) to provide understanding of what it being logged. All arguments are logged to the Current logs window in example below we see argument 1 being the description and argument 2 being the variables(parameter) value.

Log string and variable parameters
Logging Multiple Parameters or Concatenated Strings
Using log functions containing multiple strings and/or parameters eg log('string', parameter, parameter, parameters, ....) to see descriptions and multiple variables at the specified execution point in the LUA script. Knowing what various C-Bus groups, C-Bus levels, measurement values, user defined setpoints are at a specific point in the LUA script can help determine why a block of LUA script code is or isn't being executed.

Additionally using "tostring(variable)" to convert boolean, integer, floating value's into strings and " .. " to concatenate strings allows you to condense log messages into a single line. This allows complex logic with multiple conditional statements to be checked for expected and actual execution whilst troubleshooting LUA scripting.

SwValues = 'Reed Switch: ' .. tostring(SwReed) .. ', Switch Loops: ' .. tostring(SwLoops) .. ', Switch Value: ' .. tostring(SwValue)
log('Switch Values', SwReed, SwLoops, SwValue)

returns
* string: Reed Switch: true, Switch Loops: 5, Switch Value: 83.35

Logging multiple parameters or concatenated strings

Schneider Electric New Zealand

Explore more
Product:
Users group

Discuss this topic with experts

Visit our Community for first-hand insights from experts and peers on this topic and more.
Explore more
Product:

Need help?

  • Product Selector

    Quickly and easily find the right products and accessories for your applications.

  • Get a Quote

    Start your sales inquiry online and an expert will connect with you.

  • Where to buy?

    Easily find the nearest Schneider Electric distributor in your location.

  • Help Centre

    Find support resources for all your needs, in one place.

  • Products Documentation
  • Software and Firmware
  • Product Selector
  • Product Substitution and Replacement
  • Help and Contact Centre
  • Where to Buy?
  • Office Locations
  • Schneider Electric, PDL & APC Phone: 0800 741 303
  • Careers
  • Company Profile
  • Report a misconduct
  • Newsroom
  • Investors
  • EcoStruxure
  • Job Search
  • Blog
  • Privacy Policy
  • Cookie Notice
  • Conditions of Sale
  • Change your cookie settings