Default Provision Watchers
There is a default provision watcher that can be enabled through environment variables in the docker-compose.yml. This creates a provision watcher on initialization of the device service, adding any matching devices or device profiles.
The following device services support default provision watchers:
- BACnet/IP
- OPC-UA
This page uses the BACnet/IP Device Service as an example.
Set Up a Default Provision Watcher
Add the environment variable XRTCONTROL_DISCOVERY_IDENTIFIER
to the local docker-compose file, which instructs the device service to create a default provision watcher:
version: '3.7'
services:
device-bacnet-ip:
environment:
BACNET_BBMD_ADDRESS: bacnet-sim
DEVICE_DISCOVERY_ENABLED: 'true'
XRTCONTROL_DISCOVERY_IDENTIFIER: 'DeviceInstance'
Note
The environment variable XRTCONTROL_DISCOVERY_IDENTIFIER
should be one of the device protocol properties.
Once started, the device service will create a default provision watcher as below:
$ curl http://localhost:59881/api/v2/provisionwatcher/all | jq
{
"apiVersion": "v2",
"statusCode": 200,
"totalCount": 1,
"provisionWatchers": [
{
"created": 1665123963729,
"modified": 1665123963729,
"id": "3b8fc160-0394-4127-b6dd-c6b26a4bd73c",
"name": "device-bacnet-ip-provisionWatcher",
"identifiers": {
"DeviceInstance": "."
},
"profileName": "",
"serviceName": "device-bacnet-ip",
"adminState": "UNLOCKED",
"protocolName": "bacnet-ip"
}
]
}
The identifier uses the key DeviceInstance
with a period "." as the value. The period matches all characters in the regular expression, meaning any devices containing the DeviceInstance property, regardless of value, can be added to Edge Xpert.
Customize the Default Provision Watcher
You can customize the following default provision watcher fields:
- AdminState
- DeviceNameTemplate
- DeviceLabels
- DeviceDescription
- ProfileNameTemplate
- ProfileLabels
- ProfileDescription
For example:
version: '3.7'
services:
device-bacnet-ip:
environment:
BACNET_BBMD_ADDRESS: bacnet-sim
DEVICE_DISCOVERY_ENABLED: 'true'
XRTCONTROL_DISCOVERY_IDENTIFIER: 'DeviceInstance'
XRTCONTROL_DISCOVERY_DEVICENAMETEMPLATE: 'BACnet-IP-{{VendorName}}-{{DeviceInstance}}'
XRTCONTROL_DISCOVERY_DEVICEADMINSTATE: 'LOCKED'
XRTCONTROL_DISCOVERY_DEVICELABELS: 'Auto-Discovered,instance-{{InstanceID}},{{DeviceType}},{{VendorName}}'
XRTCONTROL_DISCOVERY_DEVICEDESCRIPTION: '{{ModelName}}, DeviceInstance {{DeviceInstance}}'
XRTCONTROL_DISCOVERY_PROFILENAMETEMPLATE: 'BACnet-IP-{{ModelName}}'
XRTCONTROL_DISCOVERY_PROFILELABELS: 'Auto-Discovered,{{DeviceType}},{{VendorName}}'
XRTCONTROL_DISCOVERY_PROFILEDESCRIPTION: '{{DeviceType}} profile for {{ModelName}}'
For more detailed information on discovery in BACnet/IP, see BACnet Discovery.