API Documentation- Device-mqtt-api

Device MQTT API

MQTT is a lightweight publish-subscribe messaging protocol which probably makes it the most suitable for various IoT devices. You can find more information about MQTT here.

Cloudchip server nodes act as an MQTT Broker that supports QoS levels 0 (at most once) and 1 (at least once) and a set of predefined topics.

Publish Telemetry Data

Host: “www.cloudchip.io”
Topic: “v1/devices/me/telemetry”
Port: 1883
Message Format #1 [Json Message]:{“key1”:“value1”, “key2”:“value2”}
Message Format #2 [Json Object with unix timestamp]: {“ts”:1451649600512, “values”:{“key1”:“value1”, “key2”:“value2”}}

Mosquitto MQTT (Method: Publish)

cmd: mosquitto_pub -h “www.cloudchip.io” -t “v1/devices/me/telemetry” -u “$ACCESS_TOKEN” -m {“key1”:“value1”, “key2”:“value2”}

Publish Attributes Data

Host: “www.cloudchip.io”
Topic: “v1/devices/me/attributes”
Port: 1883
Message Format [Json Message]: {“key1”:“value1”, “key2”:“value2”}

Mosquitto MQTT (Method: Publish)

cmd: mosquitto_pub -h “www.cloudchip.io” -t “v1/devices/me/attributes” -u “$ACCESS_TOKEN” -m {“key1”:“value1”, “key2”:“value2”}

Subscribing Widgets data From Dashboard:

Host: “www.cloudchip.io”
Topic: “v1/devices/me/request/+”
Port: 1883

Mosquitto MQTT (subscribe)

cmd: mosquitto_sub -h “www.cloudchip.io” -t “v1/devices/me/rpc/request/+” -u “$ACCESS_TOKEN”