API
Documentation
  • Welcome!
  • REST API
    • Overview
    • Authentication
    • Swagger docs
    • Query an endpoint
    • Filter query results
    • Handling timestamps
    • Backward compatibility
    • Exporting Data using ODATA
    • Power BI Incremental refresh
    • Data Lake Transfer Gateway
    • EXAMPLES
      • Upload production schedule
      • Find all Running Orders
      • Interact with the Order Lifecycle
      • Consume and Submit an Activity
      • Raise an Event in TilliT
  • MQTT API
    • Overview
    • Connect to the TilliT Broker
    • Subscribe to a TilliT Topic
    • Setting a MQTT Integration
    • Publish Timeseries
    • Publish Order Progress
  • Activity API
    • Overview
    • JavaScript Basics
    • Using $scope and OnLoad Scripts
    • JavaScript Object Schema
  • Release Notes
    • 2024
      • April
Powered by GitBook
On this page
  • Overview
  • Configure an MQTT Channel
  1. MQTT API

Setting a MQTT Integration

PreviousSubscribe to a TilliT TopicNextPublish Timeseries

Last updated 10 months ago

Overview

TilliT does not send information over MQTT by default, you need to configure that types of information you want to be sent. This is done by creating an MQTT integration which will send an MQTT message when a specific event occurs. For instance when an Order Started event occurs or Shift Started.

Configure an MQTT Channel

Navigate to Integrations and create a Channel

Fill in the form like so and hit Save and Open

Now we need to create a subscription which will cause an MQTT message to be sent, for this example we want this to happen on any Equipment Stopped Event. Click Actions -> Create and fill in the following form.

Now whenever an Equipment Stopped event is raised, we can receive this event as an MQTT message.

You can also filter the subscription so you only receive events that meet a certain condition. The fields you fill in above will define how specific or broad the subscription is:

  • Asset - defines a specific Asset to subscribe to.

  • Order - defines a specific Order to subscribe to.

  • Activity Key - defines a Activity asset to subscribe to.

  • Activities Included - does not apply to Webhooks (for email subscriptions only).

If you only select an event type, you will receive payloads every time that event triggers. Using the other fields allows you to make more specific subscriptions.

Receive the TilliT Event

Subscribe to the tenant/# topic

Manually raise an Equipment Stopped event in TilliT

See that you receive a similar payload body via MQTT as shown below

{
  "id": 177842,
  "createdAt": "2022-06-30T06:54:33.638Z",
  "updatedAt": "2022-06-30T06:54:33.638Z",
  "name": "Equipment stopped",
  "subtitle": "SCH457980 - 2000469",
  "activityKey": null,
  "priority": 2,
  "timestamp": "2022-06-30T06:54:33.590Z",
  "closedAt": null,
  "status": "ACTIVE",
  "asset": {
    "id": 2,
    "createdAt": "2020-12-14T05:51:58.589Z",
    "updatedAt": "2022-03-18T04:11:31.127Z",
    "name": "Depalletiser 1",
    "displayOrder": 1,
    "defaultRunRate": 60,
    "packml": true,
    "representsLineProduction": false,
    "representsLinePerformance": false,
    "allowMultipleOrders": false,
    "active": true,
    "type": "EQUIPMENT",
    "site": {
      "id": 1,
      "createdAt": "2020-12-14T04:49:27.159Z",
      "updatedAt": "2022-05-24T02:45:26.660Z",
      "name": "Bottling site 1",
      "displayOrder": 1,
      "timezone": "Australia/Adelaide"
    }
  },
  "eventType": {
    "id": 2,
    "createdAt": "2020-12-14T04:49:26.875Z",
    "updatedAt": "2020-12-14T04:49:26.875Z",
    "name": "Equipment stopped",
    "subtitle": null,
    "priority": 2,
    "displayOrder": 1,
    "systemEvent": "EQUIPMENT_STATUS_STOPPED",
    "closingEventId": 1
  },
  "order": {
    "id": 34785,
    "createdAt": "2022-05-18T01:10:10.731Z",
    "updatedAt": "2022-06-30T05:25:19.308Z",
    "name": "2000469",
    "orderDate": "2022-06-30",
    "orderNumber": "SCH457980",
    "operation": "DEPAL",
    "batchNumber": null,
    "quantityTarget": "280",
    "dueDateTime": null,
    "scheduledStart": "2022-06-30T01:14:08.000Z",
    "scheduledEnd": "2022-06-30T04:52:43.000Z",
    "actualStart": "2022-06-30T05:25:19.229Z",
    "actualEnd": null,
    "defaultRunRate": 60,
    "status": "RUNNING",
    "notes": null,
    "actualChangeoverStart": null,
    "actualChangeoverEnd": null,
    "scheduledChangeoverDuration": null,
    "previousOrderId": 34779,
    "schedulerOrderItemId": 2051,
    "segmentExternalId": "Produce",
    "routeExternalId": "Route 1",
    "material": {
      "id": 3,
      "createdAt": "2020-12-15T23:43:06.027Z",
      "updatedAt": "2022-06-29T17:39:52.490Z",
      "name": "459690 Merlot v01",
      "active": true,
      "canProduce": true,
      "canConsume": true,
      "externalId": "2000457",
      "barcodeReference": "1231231321231",
      "defaultRunRate": null,
      "displayOrder": 2
    }
  },
  "activityInstance": null,
  "changeOver": false,
  "eventReason1": null,
  "eventReason2": null,
  "eventReason3": null,
  "eventReason4": null,
  "downtimeType": null,
  "comments": null
}
	

Event Type - select the event trigger you wish to use (see ).

We have now configured TilliT to send an MQTT message on the Equipment Stopped event. In previous steps we also described how to connect to the TilliT Broker and what topic to subscribe to receive the event. You can use the code snippet provided and adjust to the steps outlined here.

Event Type
here