Gridsense Docs iconGridsense Docs

Authentication

API details

  • Broker: gridsense.cloud
  • TCP/IP port: 1883
  • Secure TLS/SSL port: 8883

Client configuration

  • Username: the device's ID
  • Password: the device's secret.
  • ClientID: "" or any UTF-8 encoded string up to 23 bytes long.

Example

We will use mosquitto_sub to subscribe and mosquitto_pub to publish messages over MQTT.

# Subscribe to all messages published to a specific channel
mosquitto_sub \
    -h gridsense.cloud \
    -u <device id> \
    -P <device secret> \
    -I <device name>
    -t m/<organization>/c/<channel> \
    --capath /etc/ssl/certs # for TLS/SSL

# Publish a message in SenML format to a specific channel
mosquitto_pub \
    -h gridsense.cloud \
    -u <device id> \
    -P <device secret> \
    -I <device name> \
    -t m/<organization>/c/<channel> \
    -m '[{"bn": "org/lighting/SmartLight/", "n": "brightness", "u": "lm", "v": 100}]' \
    --capath /etc/ssl/certs # for TLS/SSL

The topic used in the commands above follows a specific structure, which is explained in topic structure.

On this page