Server Topics API
Authentication
The MQTT authentication is handled by the underlying MQTT client, which authenticates and receives a sessionID that is not required when publishing or subscribing to commands on the endpoints. Each command is transmitted over the established MQTT session.
Publishing
-
-
Property.publish
Publish the value you want to send as a string to topic "thing/<thingKey>/property/<propKey>". (Equivalent of sending the following TR50 API call.)
{ "1" : { "command" : "property.publish", "params" : { "thingKey" : "<thingKey>", "key" : "<propKey>", "value" : <value> } } }
-
Alarm.publish
Publish the state you want to set the alarm to as a string to topic "thing/<thingKey>/alarm/<alarmKey>", which is equivalent to sending the following TR50 API call:
{ "1" : { "command" : "alarm.publish", "params" : { "thingKey" : "<thingKey>", "key" : "<alarmKey>", "state" : <state> } } }
-
-
Thing.attribute.set
Publish the value you want to set the attribute to as a string to topic "thing/<thingKey>/attribute/<attrKey>". (Equivalent of sending the following TR50 API call.)
{ "1" : { "command" : "thing.attr.set", "params" : { "thingKey" : "<thingKey>", "key" : "<attrKey>", "value" : <value> } } }
Subscriptions
-
Property changes
Subscribe to a topic such as thing/<thingKey>/property/<propKey> to receive the new value set to the property when it changes.
The value is published to the topic as a string.
Only QoS 0 and 1 are supported.
-
Alarm changes
Subscribe to a topic such as thing/<thingKey>/alarm/<alarmKey> to receive the new state set to the alarm when it changes.
The State is published to the topic as a string.
Only QoS 0 and 1 are supported.
-
-
Location changes
The location is published to the topic as: latitude, longitude, heading, speed, altitude, and fix type.
Subscribe to a topic such as thing/<thingKey>/location to receive real-time location updates for the given thing.
Remember, only QoS 0 and 1 are supported.
-
Connection state changes
Subscribe to a topic such as thing/<thingKey>/connection/+ to receive real-time updates when a thing connects or disconnects from the platform.
To receive only connects, subscribe to thing/<thingKey>/connection/connect.
To receive only disconnects, subscribe to thing/<thingKey>/connection/disconnect.
The timestamp when the event occurred is published to the topic.
-
Other topics
You can use other topics that do not begin with api or thing for custom application development. The use of other topics is subject to monitoring and additional charges if usage is considered excessive.