Module: drivers/gateways/knx

This driver is used by the core/addresses module to communicate on the KNX bus via a KNX to IP gateway. It is a Javascript layer running on top of the knxd software (https://github.com/knxd/knxd)

Gateway parameters

The gateway parameters are defined in the gateway json (refer to core/gateways module)

{
	"id" : 5,  
	"name" : "knx ip",
	"description" : "...",
	"active" : 1,
	"driver": "knx"  // links to the knx driver.
	"json"  : {
		"host":"192.168.1.11", // IP address of the knx IP gateway.
		"port":3671,    //port of the knx IP gateway
		"mode":"ipt",  // mode of connection to the knx IP gateway. 
					   // Possible values are 'ip', 'ipt' (ip tunneling), and 'iptn' (ip tunneling nat).
		"server":1     // Activate (1) or deactivate (0) the knxd IP multicast server. 
				       // This feature is useful to remotely connect to the KNX bus for maintenance, but creates multicast traffic on the LAN.
		},
	"private_json" : {...} //this is not used by the driver. It can be used by any application to store custom information.
}


Address parameters

The main driver parameter is the KNX datatype. Here is an example of an KNX address as stored in the system.

{
	id: 23055,	//database id
	alias: null,  
	name: '4/7/25', // KNX group address
	description: null,
	...
	,
	json: {
		datatype : '3.xxx 3 bits with control (6 bits)'
		
		// the following datatypes are currently supported: 
		// '0.000 hexadecimal',
		// '1.xxx 1 bit (6 bits)',
		// '2.xxx 1 bit with priority control (6 bits)',
		// '3.xxx 3 bits with control (6 bits)',
		// '4.xxx character (8 bits)',
		// '5.xxx 1 byte unsigned (8 bits)',
		// '5.001 scaling, 1 byte unsigned (8 bits)',
		// '5.003 angle, 1 byte unsigned (8 bits)',
		// '5.004 percent, 1 byte unsigned (8 bits)',
		// '6.xxx 1 byte signed (8 bits)',
		// '7.xxx 2 bytes unsigned (16 bits)',
		// '8.xxx 2 bytes signed (16 bits)',
		// '9.xxx 2 bytes float (16 bits)',
		// '10.001 time (24 bits)',
		// '11.xxx date (24 bits)',
		// '12.xxx 4 bytes unsigned (32 bits)',
		// '13.xxx 4 bytes signed (32 bits)',
		// '14.xxx 4 bytes float (32 bits)',
		// '232.xxx 3 bytes unsigned (24 bits)',
		// '16.xxx string (112 bits)'
	},	
	gateway_id: 137
}


Address format


There is two types of KNX addresses :
  • Group addresses. Those are used to communicate information on the bus. Multiple sensors/actuators can communicate on the same group address. The address format is: [0-31]/[0-7]/[0-255] (e.g. 4/7/25 is a valid KNX group address)
  • Individual addresses. Those correspond to physical sensors/actuators. Those are generally not used by the supervision application, but by the KNX integrator in order to configure the physical devices. The address format is [0-15].[0-15].[0-255] (e.g. 3.3.1 is a valid individual KNX address)


Use Cases

The driver is used by the core/gateways module. Its methods should not be used directly by custom applications.

// Indirectly calls the write method of the KNX driver. It writes a group write packet on the KNX bus.
gateways.writeValue('14/7/25', 0)

// Sends on the bus a read request for the group address 14/7/25.
gateways.readValue('14/7/25', function(err,value){ 
	// when the sensors/actuators receive the read request, if those are configured to respond for group address 14/7/25, 
	// then they transmit their current value. When multiple devices reply to the read request, the driver returns the first response.
	// Here the decoded value should be 0.
})

// Gets from the system cache the last KNX value written on address 14/7/25. It does not write packets on the bus.
gateways.getLastValue('14/7/25', function(err,value){ ... })

// This sends a reboot command to the actuator/sensor with individual address 3.3.1
// It may be useful if the actuator/sensor is disfonctional and blocked in a faulty state.
gateways.writeValue('3.3.1', 'restart')