registerForX10Events

Top  Previous  Next

cm11a.registerForX10Events registers a callback that is called when an X10 event arrives.

Definition

regId = cm11a.registerForX10Events( callback )

 

Name

Type

Description

callback

function

The callback function.

regId

number

The id used to register with the plugin. This can be used with cm11a.unregisterFromX10Events( regId ) to unregister from events.

Callback Definition

function( addresses, command, v ) 

 

Name

Type

Description

addresses

table of strings

The addresses referenced by this command

command

number ( see cm1a.commands )

The command used. See the lua table for their meaning.

v

value

Dim and Bright pass a v, otherwise nil

Example

local x = cm11a.registerForX10Events( function( addresses, command, v ) 

 

  table.print(addresses)

  print(command,v)

 

end)

 

 

For a B2 Off command you'd get:

 

Wed Jan 22 15:28:12 2014        { -- #0

Wed Jan 22 15:28:12 2014           [1] = "B2",

Wed Jan 22 15:28:12 2014        } -- #0

Wed Jan 22 15:28:12 2014        3        nil