IoT Device Event Source

When you select IoT Device as the Event Source for the Flux App, the App will be triggered when all the following conditions are met:

Event Source Configuration

Set the conditions for when event messages should be published to the channel from the event source.

You cannot set the same group in the IoT Device event sources for multiple Flux Apps. Groups are distinguished by group ID. For example, you cannot set the same SIM group and Sigfox group with the same group ID in different Flux Apps.

Data Format

The data sent to a channel configured with the IoT Device event source consists of Message and Context.

You can check the data received by the event to the Flux App in the History tab of Soracom Flux Studio. For more details, refer to View Logs.

Message

For this event source, the message is the data that is sent by the IoT device. Here's an example:

{
  "temp": 29.7,
  "x": null,
  "bat": 3,
  "lon": 139.73307,
  "rs": 4,
  "binaryParserEnabled": true,
  "humi": 53.4,
  "z": null,
  "y": null,
  "type": 0,
  "lat": 35.677226
}

To reference the event source's Message in an action, input it as ${event.payload.<MESSAGE_ATTRIBUTE>} or event.payload.<MESSAGE_ATTRIBUTE> == 1.

Context

This contains the information about the IoT device that sent data and how the data was sent. Here's an example:

{
  "eventType": "device",
  "request": {
    "protocol": "http",
    "httpPath": "/",
    "httpHeaders": {
      "content-length": "19",
      "content-type": "application/json",
      "connection": "close",
      "accept": "*/*",
      "user-agent": "xxxx"
    },
    "httpMethod": "POST",
    "port": 8888
  },
  "resource": {
    "resourceId": "<devideId || imsi>",
    "imsi": "<imsi>",
    "resourceType": "Subscriber",
    "simId": "<sim-id>>"
  },
  "group": {
    "groupId": "<group-id>"
  }
}

The main attributes are as follows:

Attribute Description
eventType The type of event. When the data sent to the Unified Endpoint triggers the Flux App, the value is device.
request Information about how the device sent data to the Unified Endpoint.
request.protocol The protocol used.
request.httpPath The path used.
request.httpHeaders The HTTP headers.
request.httpMethod The HTTP method used.
request.port The port number used.
resource Information about the device.
resource.resourceId The device ID. For IoT SIMs, this is the IMSI. For Sigfox devices or Inventory devices, this is the device ID.
resource.imsi The IMSI of the device.
resource.resourceType The type of resource. For IoT SIMs, this is Subscriber.
resource.simId The SIM ID.
group Information about the group.
group.groupId The group ID.

To reference the above Context in an action, input it as ${event.context.<CONTEXT_ATTRIBUTE>} or event.context.<CONTEXT_ATTRIBUTE> == 1.