Subscribe to a TilliT Topic

Overview

When TilliT sends an MQTT message, it is sent on a specific topic only available to you in a hierarchical structure. Depending on how specific you want to be, you can adjust the subscriptions you make to get exactly the data you want.

Subscribe to TilliT MQTT

The easiest way to receive data from TilliT MQTT Endpoint is to subscribe to all topics. This is done with the wildcard character #.

subscribe('/tenant/#')

This will receive:
 - /tenant/test
 - /tenant/another/test/
 - /tenant/another/another/test/
 - etc.
It will not receive:
 - /another
 - /another/topic
 - /tenant

To be more specific, every message TilliT sends have a topic structure of:

tenant/siteName/assetName/endpoint
 - tenant: the name of your tenant
 - siteName: the name of the site the event occured on
 - assetName: the name of the asset the event occured on
 - endpoint: the topic configured by the channel endpoint field (see Seperating Different Client Subscriptions)

If you want to subscribe to anything in a level, then you can use the character + like so:

/tenant/+/assetName/endpoint - receive updates on an asset across any site
/tenant/siteName/+/endpoint - receive updates on a site across any asset
/tenant/+/+/endpoint - receive updates on any site and any asset for an ednpoint

Separating Different Client Subscriptions

A Channel configured in TilliT has an optional endpoint field. By including an identifier here, we can easily subscribe to a specific TilliT Channel and seperate our subscriptions.

Last updated