4.12. 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
  • 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, you could organize the processing of the sensor data 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 and format/publishes a message to the cloud

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

4.12.1. Processing a Custom Event

Custom events are processed in a pipeline like a standard 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 any event types should be handled by a pipeline, event type any can be used.

Once the pipeline receives the custom event, use the filters to process the custom event.

4.12.2. Emitting a Custom Event

Custom events are emitted in the following ways:

  • To emit a custom event from a pipeline/connection use the emit-event filter and specify the event name and event payload.
  • To emit a custom event from a eventGenerator consult the eventGenerator documentation.