LogicMachine as BACnet client
Example: Use LogicMachine as BACnet client
Task
How to read BACnet client data and send this information into KNX bus.
Install latest firmware available here
Install the genohm-scada-bacnet.ipk from Extra packages in: Sys Config –> System –> Packages
Note
Before using any bacnet function, you must include the library:
require('bacnet')
Examples of commands
- Read current value of binary or analog object:
bacnet.readvalue(device_id, object_type, object_id)
- Read binary object:
value = bacnet.readvalue(127001, 'binary value', 2305)
- Read analog object:
value = bacnet.readvalue(127001, 'analog value', 2306)
- Write new value to binary or analog object priority array:
bacnet.write = function(device_id, object_type, object_id, value, priority)
Value can be nil, boolean, number or a numeric string
Priority parameter is optional, lowest priority is used by default
- Set binary object value:
bacnet.write(127001, 'binary value', 2305, true)
- Set analog object value:
bacnet.write(127001, 'analog value', 2306, 22.5)
- Set binary object value at priority 12:
bacnet.write(127001, 'binary value', 2305, true, 12)
- Set analog object value at priority 10:
bacnet.write(127001, 'analog value', 2306, 22.5, 10)
- Clear binary object value at priority 12:
bacnet.write(127001, 'binary value', 2305, nil, 12)
Multi-input/output
Create object for operation mode, set data type to 1-byte unsigned integer. Create event script for this object:
require('bacnet') -- set new operation mode value = event.getvalue() bacnet.write(3, 'multi-state output', 10105, value)
- Example: read current value of error code
value = bacnet.read(3, 'multi-state input', 10104, 'present value')
- Example: read current value of operation mode
value = bacnet.read(3, 'multi-state input', 10106, 'present value')
- Example: set new operation mode, set to cooling (1)
value = 1 bacnet.write(3, 'multi-state output', 10105, value)
- To read/write other objects, refer to the scan table in BACnet tab.
- Read/write function have the same first 3 parameters:1. Device ID: you should not change it if you only have one device
(Device nr. 3)
2. Object type: ‘binary output’, ‘analog input’, ‘multi-state value’, etc
3. Object ID: use values from scan tableNote: inputs can only be read. Values and outputs can be read and written.