Serial Trigger

The Serial Trigger will trigger a workflow whenever the Edge Compute device receives enough data via Serial to satisfy the configured trigger.

Serial Trigger

Node Properties

The Serial Trigger has several pieces of configuration in order to successfully listen for data.

  • Serial Path: (Required) The serial port to listen on.
  • Baud Rate: (Required) The baud rate, speed of communication over a data channel, which by default is 9600. For agent versions prior to 1.19.2 the following are accepted baud rates: 110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200, 128000, 256000. As of agent version 1.19.2 you may specify any positive integer for this field.

In the Gateway Edge Agent versions prior to 1.19.0, the following options are defaulted:

  • Data Bits: 8
  • Stop Bits: 1
  • Parity: none
  • RTS/CTS: false

However, in versions 1.19.0 and higher you may specify these options.

  • Parity: (Required) The parity, whether or not a parity bit is set and its value. By default, this is none. Other valid values include even, odd, mark, and space.
  • Data Bits: (Required) The number of bits per character, set to 8 by default. Other valid values include 5, 6, and 7.
  • Stop Bits: (Required) The number of stop bits to signal the end of a character. Default is 1, may also be set to 2.
  • RTS/CTS Handshake: (Required) Boolean that indicates whether RTS/CTS handshaking is in use. Default is false.
  • Write After Port Opens: (Optional) Field where after the port opens this string will be written once. It will also be encoded using the Output Ending field.
  • Write On Open Encoding: (Required if a value is set for Write After Port Opens) This denotes the encoding of the “Write After Port Opens” field. The following are valid character encoding options: ASCII, UTF-8 (default), UTF16LE, Base64, Binary, Hex. This field has been added as of agent version 1.19.2.
  • Parse Method: (Required) By default, the value is Delimiter. This field can either be Byte Length or Delimiter, and it tells the serial port listener how to chunk up the data as it is received.
  • Delimiter: This field is required if the parse method is Delimiter. The Serial Trigger fires with the serial data received once the delimiter is encountered. This delimiter will not be included in the serial data on the payload.
  • Delimiter Encoding: (Required if Parse Method is set to Delimiter) This denotes the encoding for the delimiter. The following are valid character encoding options: ASCII, UTF-8 (default), UTF16LE, Base64, Binary, Hex. This field has been added as of agent version 1.19.2.
  • Byte Length: This field is required if the parse method is Byte Length and it is the number of bytes to wait for before firing the trigger.
  • Output Encoding: (Required) This denotes the encoding for the received serial message. The following are valid character encoding options: ASCII, UTF-8 (default), UTF16LE, Base64, Binary, Hex.

Serial Trigger Configuration

Payload

The payload will include a serial field under the data field which contains the data that was received from the serial port. In the general case, a Serial workflow payload will look like the following:

{
  "applicationId": <id of the current application>,
  "applicationName": <name of the current application>,
  "data": {
    "serial": <data received from the serial port>,
  },
  "deviceId": <id of the edge device>,
  "deviceName": <the edge device name>,
  "deviceTags": {<any tags for the edge device>},
  "flowId": <id of the current workflow>,
  "flowName": <name of the current workflow>,
  "flowVersion": <name of the current workflow version>,
  "globals": <object of workflow globals>,
  "isConnectedToLosant": <if the agent is connected to Losant>,
  "agentEnvironment": <object of environment variables>,
  "time": <time the serial trigger fired the trigger>,
  "triggerId": <serial id>,
  "triggerType": "serial"
}

Was this page helpful?


Still looking for help? You can also search the Losant Forums or submit your question there.