MQTT
MQTT is a lightweight messaging protocol where a client can register to send/receive messages on publish/subscribe topics. These messages are forwarded to the users MQTT Broker (server) such as Mosquitto, where the messages can be held until a client requests the messages for a specified topic. The MQTT notifier will register a client to send messages on a Publish Topic and can optionally register to receive Downlink Requests on the Subscribe Topic. The Brokers Address is the IP Address/Hostname of the MQTT Server and the Client ID is an optional field where you can identify the SenRa client connection to your MQTT Broker, if no Client ID is specified then the a unique Client ID will be generated. Client IDs should be unique as the broker will disconnect an existing connection when a new connection is initiated with that same client id.
The Broker Port should be configured to match the port of your server. Typically, the default port is 1883 or 8883 for TLS.
Uplink messages will be forwarded in JSON format to the Publish Topic (See Default Data Fields). Publish Topics can be defined using variable substitution to deliver messages to unique destinations based on the message content. A variable is added to the topic string using this format: "${VARIABLE_NAME}", where the variable name matches a Default Data Fields name or "appEui", the Application EUI of an Application Notifier. Optional and RF data fields may or may not be available for variable substitution depending on the Notfication Target configuration. The Publish Topic is defined during Notification Target setup.
Example Publish Topics With Variable Substitution:
/uplink/${devEui}/
/uplink/${appEui}/{$devEui}/
Users have the ability using external tools to send/publish Downlink messages to this notifier's Subscriber Topic, the SenRa Client can process these messages provided they are delivered in the following JSON format:
Downlink Message Format
{
"eui":"FFFFFFFFFFFFFFFF",
"pdu":"0123456789ABCDEF"
}
Downlink Message Format with optional fields
{
"eui":"FFFFFFFFFFFFFFFF",
"pdu":"0123456789ABCDEF",
"port":0,
"timeout":5,
"confirmed":false
}
Note: Downlink messages will only be processed if the EUI specified is registered with the SenRa Development Portal.
The SenRa Client uses the following QoS levels for the Publish and Subscriber topics:
Publish Topic = At Most Once (0)
Subscribe Topic = Exactly Once (2)
Downlink Considerations
- Users must publish downlinks with a QoS level of 2. This allows the messages to remain on the user's server until the SenRa client connects.
- The Client ID must be specified so the broker knows which messages need to be delivered the next time the client connects.
- The Publish Topic and Subscribe Topic must be different.
Authentication and Security
- Authentication is supported with an optional username and password. The user must configure their broker/server for username and password authentication.
- Security is supported with a trust manager that accepts any valid certificate. The SSL/TLS checkbox will enable SSL/TLS communication.
Platform Setup
Implementation specific.
Notifier Setup
Specify the Brokers IP Address and Publish Topic in the Notification Target fields. The Subscribe Topic is only required if you are going to be processing downlinks. The Client ID is also optional and only required if your broker requires a specific Client ID.