The main purpose of scripting is to provide custom logic functions for various KNX objects. There are three types of scripts possible:
Lua programming language is used to implement user scripts. Most of the Lua language aspects are covered in the first edition of "Programming in Lua" which is freely available online.
Data format — in most cases data is stored and transferred using hex-encoded strings (2 bytes per 1 byte of data).
Event-based scripting can be used to implement custom logic for group address events. User-defined function is executed when a "group write" event occurs for given group address. Event information is stored in global event variable. Variable contents:
event.getvalue function can be used to get the event value if the event is bound to a known object.
Note: event variable is available only in Event-based functions, not in Resident and Scheduled.
Resident scripts are executed infinite amount of times. Scripts are put into inactive state after each call and are resumed after delay timer expires.
Note: even though resident scripts are executed in parallel they should not have infinite loops or it will not be possible to reload scripts after editing.
Scheduled scripts are executed when the system time matches the specified script start time. Scheduled script is run only once after each timer call.