Custom Events

Custom Events

This document describes the Custom Event functionality of Edge Connect.

Edge Connect has the following standard event types:

  • advertisement: for incoming BLE Advertisements
  • cloud: for incoming Cloud messages
  • deviceStatus: for device status events from a device group
  • device[Detected|Assigned|Health]: device type related events
  • any: for matching any event type

An event type with a name not in the list above is a custom event type in Edge Connect. Custom event types may be used to organize processing of data into smaller more manageable stages.

For example, if using a custom sensor with a complicated protocol, processing of the sensor data could be organized into 2 pipelines:

  • a pipeline to collect the data from the sensor and emit the sensor
    data in a custom event
  • a pipeline which receives the custom event, formats the data, and publishes a
    message to the cloud

Custom events are also used to receive the output of a recipe Recipes.

Processing a Custom Event

Custom events are processed in a pipeline like any other event.

  • To receive a custom event on a pipeline, set eventType to the Custom Event name on a pipeline.
  • If multiple specific event types should be handled by a pipeline, a regular expression for the event type may be used. The regular expression must match the start (with [^]) or end (with [$]) of a string.
  • If a pipeline handles any event type, "eventType":"any" can be used.

Emitting a Custom Event

Custom events are emitted in the following ways:

  • To emit a custom event from a pipeline or connectionSequence use the emitEvent filter and specify the event name and event payload.
  • To emit a custom event from an eventGenerator consult, the eventGenerator documentation.