Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[hono-dev] MQTT Command and Control Topics

Hi,


as I work on the implementation of Command and Control for MQTT right now, I would like to summarize some changes to the concept so far, that for my understanding follows the discussions in Toulouse and on the mailing list. The definitions are below. The important changes are:

  • The structure of the topic always reflects the parts for tenant and device-id. They might be empty, if the device is authenticated.

  • The command is at the end of the topic to allow following parts, that will not be used or parsed by Hono.

  • To allow a property bag for future additions the ? is not allowed as the beginning character of a topic part.

  • The res and req parts are now behind tenant and device-id, so we have always the same starting scheme with <endpoint>/[tenant]/[device-id]. As a consequence the subscription (the only one accepted right now) changes to control/+/+/req/#.

  • The control part can have the short version with c.

Request:

Devices receive commands on topic:

 control/[tenant]/[device-id]/req/<req-id>/<command>[/*][/property-bag]

this means it subscribes to:

 control/+/+/req/#

Examples:
  • control/DEFAULT_TENANT/4711/req/xyz/light

  • control///req/xyz/light (tenant and device from auth)

  • control///req/xyz/light/switch/on (additional segments are allowed)


The property-bag at the end is in optional bag of properties, that starts with a ? (so this is not allowed in additional topic segments as a starting character) and is followed by pairs of URL encoded property names and values, which are separated by &:

 <url-encoded-name>=<url-encoded-value>

Examples:
  • control///req/xyz/light/?myId=42&imperator=mouse&a=b

  • control///req/xyz/light/switch/on/?myId=42&imperator=mouse&a=b

Response

Devices sends response to command on topic:

 control/[tenant]/[device-id]/res/<req-id>/<status>

Examples:
  • control/DEFAULT_TENANT/4711/res/xyz/200

  • control///res/xyz/200  (tenant and device from auth)


Back to the top