This set of functions are is used in combination with In / Out Converter definitions in KNX telegram definitions. Some functions provide helper functionality that are only invokable within such LUA conversion functions that are executed by such an item.
To still have the original value available, two more data points are added. They have extended Item IDs with ".IN" and ".OUT".
IN Converter
The corresponding LUA function for IN conversion would look like that:
Code Block |
---|
function InConv() |
...
Destination.SetValue(nxa.LowByte(Source.Value())) end |
Warning |
---|
...
"Destination" would be the object where you would write the result of your conversion. For your InConv() the IN data point would be the receiving item. "SetValue()" is the function to call to push the value into the destination object without sending a telegram. "Source" in IN-convert-function is the object with the original value. "Value()" returns the actual value of the source object. |
This means, in the above example the IN data point always will filter the lower byte off the original value.
In an IN-convert-function:
- Source - the original data item
- Destination - the IN data point
OUT Converter
Here an example for an out converter:
Code Block |
---|
function OutConv() |
...
Destination.WriteValue(nxa.LowByte(Source.Value())) end |
Warning |
---|
...
"Destination" would be the object where you would write the result of your conversion. In an OUT-convertfunction it would be the original data item. "WriteValue()" is the function to call to push the value into the destination object with sending a telegram. "Source" in Out-convert-function is the object with the original value. "Value()" returns the actual value of the source object. |
The .OUT data point was set by a client, the LUA function OutConv() was called and the low byte value was set to the original data point. The difference between "SetValue()" and "WriteValue()" is, that in case of the latter one a telegram is generated.
In an OUT-convert-function:
- Source - the OUT data item
- Destination - the original data point
Description
Signature
string Destination.ID ()
...
- data point
...
Parameters
None.
Return
...
Description
Signature
string Source.ID ()
Gets the ID of "Source" object. e.g. Source.ID() in an IN-convert-func would return the ID of the original data item.
Parameters
None.
Return
...
Description
Signature
variant Source.Value ()
Gets the actual value of "Source" object.
Parameters
None.
Return
...
Description
Signature
variant Destination.Property (number)
Gets the value of any property of "Destination" object. e.g. Destination.Property(0) in an IN-convert-function would return the canonical data type of the IN data point.
Parameters
...
Return
...
Description
Signature
variant Source.Property (number)
Gets the value of any property of "Source" object. e.g. Source.Property(0) in an IN-convert-function would return the canonical data type the original data item.
Parameters
...
Return
...
Description
Signature
Destination.ReadValue ()
Generates a read telegram in the "Destination" object.
Parameters
None.
Return
None.
Description
Signature
Destination.SetValue (variant)
Sets the value of the "Destination" object, but does not generate any KNX telegram.
Parameters
...
Return
None.
Description
Signature
Destination.WriteValue (variant)
Sets the value of the "Destination" object and generates a KNX telegram.
Parameters
...
Return
...