The views feature permits to add alternative names to identify addresses. Those names are dynamic (programmatic) and can be automatically updated when some specific addresses or gateways parameters change. The views are useful in the context of reading / writing addresses in the routes, in the logic module, or more rarely from external applications using the gateways API.
A view is a naming mechanism, not a screen. Not to be confused with the visualization (supervision pages built with the View editor); for charts and dashboards, see Dashboards.
An address can be designated in several ways:
#1, #2, #3… It is unique on the device.%bac:local/analogValue:1. A name is unique inside one gateway only.When a text is given, the device looks for a name first, then for an alias, then for a view identifier.
To target one gateway, put its name or its number before the ¬ symbol: myBacnetDevice¬%bac:local/analogValue:1. Without this prefix, if several gateways have an address with the same name, no error is raised: the address of a connected gateway is used. Add the prefix whenever a name is not unique. All the accepted forms are described in Addresses › Address keys.
The screenshot below shows examples of local BACnet addresses identified by id in blue, and by name in orange. An example of view is given in the next section.
This section introduces views with a practical example on the BACnet driver. As you can notice in Figure1, BACnet addresses name are technical and not very user friendly. The BACnet addresses naming scheme is described below.
%bac: followed by the either %bac:local for the local BACnet addresses of the Universal IoT gateway, or the physical address of another BACnet device such as %bac:192.168.1.98 for BACnet IP or the mac id for BACnet MSTP such as %bac:3 for device with mac address number 3.binaryInput, binaryOutput, binaryValue, analogInput, analogOutput, analogValue, multistateInput, ... and so on) followed by : and the BACnet object instance id (unique integer by object types) such as (1, 2, and so on).presentValue, units, description, objectName, and so on.This addressing scheme above contains all the information for the driver to build the BACnet packets and communicate with other BACnet devices. It is good from an automation point of view and does not break if a BACnet object name is modified, but it is not very user friendly. Generally technicians prefer to see and work with a BACnet structure following the three levels below.
presentValue, units, description, objectName, and so on.The BACnet driver includes by design a native view called bacnetName, which permits to use the user friendly addressing scheme described above. The screenshot below shows how to display the list of the views from the web interface.
By default, views are not active. Each gateway can turn on and off its compatible views. Some views only applies to certain types of gateways, the alias view is available for all gateway types, but the bacnetName view is only available for BACnet gateways. In order to activate the bacnetName view on our demo BACnet named gateway myBacnetDevice, the gateway menu can be used as shown below.
Once the view is activated, it can be seen from the gateway. Here the bacnetName view resembles what BACnet explorers usually display.
The view can be used to explore the BACnet devices and their objects more easily, but it can also be used to create routes between objects. By drag & dropping myBacnetDevice/objName onto myBacnetDevice/objName2 a route is created between the 2 view identifiers and the present value of myBacnetDevice/objName is routed to the destination address myBacnetDevice/objName2. When routing using views it is advised to first make sure that the view name will not be modified in the future.
A custom view is a javascript function transforming each address of one gateway to its new view name (string). Custom views can be created from the Views list by clicking the Insert view button.

A new view is created, it is named "newView", and on the right panel it is possible to select the target driver / gateway type. Below the gateway driver of type "internal" is selected. The function here in the example replaces the first address name character ($ for internals) by the prefix %internal:


The following code snippets below show the native views implementation of the Alias view and the bacnetName view. This code can be used as a starting point for new views creation.
function alias (adr){
return adr.alias
}
function bacnetName (adr, getAddress){
var levels = adr.name.split("/")
var parsed = {
'device' : levels[0].substring("%bac:".length),
'type' : levels[1] && levels[1].split(":")[0],
'instance' : levels[1] && levels[1].split(":")[1],
'property' : levels[2]
}
var devAdrName = "%bac:"+parsed.device
var objAdrName = parsed.type ? devAdrName + "/" + parsed.type + ":" + parsed.instance : null
var ret = null;
if(objAdrName){
var devAdr = getAddress(devAdrName)
var propAdrName = parsed.property ? (objAdrName + "/" + parsed.property) : null
var objNameAdr = getAddress(objAdrName + "/objectName")
if(propAdrName){
ret = {
view : [devAdr && devAdr.value && devAdr.value.name,objNameAdr && objNameAdr.value, parsed.property],
events : ['newValue '+ (adr.gateway_id + "¬" + devAdrName),'newValue '+ (adr.gateway_id + "¬" + objAdrName + "/objectName")]
}
}else{
ret = {
view : [devAdr && devAdr.value && devAdr.value.name, objNameAdr && objNameAdr.value],
events : ['newValue '+ (adr.gateway_id + "¬" + devAdrName), 'newValue '+ (adr.gateway_id + "¬" + objAdrName + "/objectName")]
}
}
}else{
ret = {
view : [adr.value && adr.value.name],
events : ['newValue ' + adr.id]
}
}
if(ret.view.findIndex(e => !e) != -1){
ret.view = null;
return ret;
}
// Escape the normal slash character "/" by the special slash "∕".
ret.view = ret.view.map(e => e.replace(/\//g,"∕")).join("/")
return ret
}
function myView(address, getAddress){
return address.name.replace(/^\$/, '%internal:')
}
address is the address object (id, name, alias, description, value, gateway_id, json…).getAddress(name) returns another address of the same gateway, or null.null or an empty string: the address has no identifier in this view and is hidden in the view tab.¬./ in the identifier creates a level in the tree of the view tab. To keep a slash inside a level, replace it with ∕ as the bacnetName view does.{view: '...', events: ['newValue <gateway id>¬<address name>']}: the identifier is recomputed each time one of the listed events occurs.Rules:
Views can also be managed by program: see the Views section of the gateways API.
View identifiers are different from unique identifiers such as the address id or address name in the sense that a single view identifier can refer to multiple addresses, and a single address can have multiple view identifiers. The table below shows an example. When one identifier designates several addresses, what happens depends on where the identifier is used (see the second table).
|
|
| Where | With an identifier shared by several addresses |
|---|---|
| Route (source or destination) | The route applies to all the addresses that carry the identifier. A route whose destination is A writes address_1 and address_3. |
| Logic module, write block | One address by default. With the option Write to all addresses with this name, all the addresses that share the same name or alias. |
API (writeValue, readValue, getLastValue…) |
One address only: the first one whose gateway is connected. |
To perform a group action, use a route. Example: give the alias KNX_LIGHTS to the KNX group addresses 1/2/3, 1/2/4 and 1/2/5, then create a route from a command address to the destination KNX_LIGHTS: writing 1 or 0 to the command address switches the three lights.