Configure the BACnet package in Liota to enroll a BACnet Thing device and collect metrics.

Prerequisites

Ensure that you have:
  • Created a Liota gateway template on VMware Pulse IoT Center.
  • Enrolled a gateway using the Liota gateway template.
  • Created a Thing template to enroll the BACnet Thing device.
  • Added a firewall rule to open the BACnet UDP Port.

Procedure

  1. Copy the Liota packages from the installer location to the packages folder in your gateway. Run the following command:
    root@photon-machine [ /opt/vmware/liota/data/packages ]# cp ~/mirrors_github_liota/example/pulsev2/* .
    The Liota packages are copied to the packages folder in your gateway.
  2. Edit the BACnet device package that you want to configure. In this example, we configure the BACnet Thermostat package to collect metrics. Run the following command:
    root@photon-machine [ /opt/vmware/liota/data/packages ]# vi bacnet_thermostat.py
  3. The bacnet.thermostat.py package contains definitions for collecting metrics and for running commands.
    1. Configure the following parameters:
      Parameter Description
      device_props Enter the IP address of your BACnet Thing device. For example,
      device_props = {"ip":"192.168.101.2"}
      comms Enter the Ethernet name and port number. For example,
      comms = BacnetDeviceComms({"iface":"eth3", "port":"47808"})
      device_name Enter the device name that is registered on VMware Pulse IoT Center. For example,
      device_name = "BacnetTemperatureSensor"
      d Enter the device template name that you have created on VMware Pulse IoT Center. For example,
      d = PulseConnectedDevice(device_name, "TemperatureSensorTemplate",
                                               self.iotcc_edge_system.reg_entity_id,
                                               device_context)
      metricName The name of the metric that is collected in VMware Pulse IoT Center. Ensure that you provide the same metric name and value type when creating a Thing template. For example,
      metricName = "Temperature"
      args To configure your thermostat device to send metrics to VMware Pulse IoT Center, update the object type to analogInput. The following object types are available:
      • analogInput
      • analogOutput
      • analogValue
      • binaryInput
      • binaryOutput
      • binaryValue
      • multiStateInput
      • multiStateOutput
      • multiStateValue
      For example,
      args = [self.reg_device.reg_entity_id,
                              "Temperature_sensor", {"object":"analogInput", "instance":"0"}]
      d_metric Define the type of metric that is sent to VMware Pulse IoT Center. For example:
      d_metric = Metric(
                          name=metricName,
                          mtype='double',
                          unit=None,
                          interval=10,
                          sampling_function=collect_metrics,
                          sampling_args=args
                      )
      client_id The ID for sending the commands. For example,
      client_id = "com.liota.bacnet"
      interval The time interval in seconds to check for the commands. For example,
      interval=10
  4. After configuring the package, register it by running the following command:
    root@photon-machine [ /opt/vmware/liota/data/packages ]# python3 reg.py bacnet_thermostat
  5. Alternatively, you can register

Results

The BACnet thermostat device is enrolled to VMware Pulse IoT Center. The Metrics tab of the device publishes the metrics every 10 seconds.

What to do next

Send a command to the enrolled thermostat device:
  1. In the VMware Pulse IoT Center console, go to Inventory > Devices.
  2. Click the thermostat device that you have enrolled, click the drop-down menu, and click Commands.
  3. Click SEND COMMAND.
  4. In the Send Command window:
    1. Under Select Command, select the set-temperature command.
    2. Under Arguments, make sure that the argument name is the same as in the configuration package.
    3. Under Address, enter the object type and instance number. This address is to identify the device property to be set. For example,
      {"object":"analogOutput", "instance":"0"}
    4. Under Value, enter the temperature value.
  5. Click SEND COMMAND.
  6. Refresh the Command History table. The status of the command must change to EXECUTED.
  7. Verify the update from the Metrics tab.