Skip to main content

MQTT

The MQTT component handles configuration and status of the outbound MQTT connection. Here, you can find how to configure your device to connect to an MQTT server. More about the MQTT channel itself, as well as information about the topics available can be found here.

Status#

Through the status of the MQTT component shows whether the device is connected over MQTT.

Properties:

  • connected: boolean, true if the device is MQTT connected, false otherwise
Example status object
{
"connected": false
}

Configuration#

The configuration of the MQTT component contains information about the credentials and prefix used and the protection and notifications settings of the MQTT connection.

Properties:

  • enable: boolean, true if MQTT connection is enabled, false otherwise
  • server: string or null, name of the server to which the device is connected
  • user: string or null, username
  • pass: string or null, password
  • ssl_ca: string or null, type of the TCP socket
    • null - plain TCP connection
    • * - TLS with disabled certificate validation
    • "user_ca.pem" - TLS connection verified by the user-provided CA, see Shelly.PutUserCA
    • "ca.pem" - TLS connection verified by the built-in CA bundle
  • topic_prefix: string or null, prefix of the topics on which device publish/subscribe. Limited to 300 characters. Could not start with $ and #, +, %, ? are not allowed.
    • null - device id is used as topic prefix
  • rpc_ntf: boolean, if true notifications are published on <device_id|topic_prefix>/events/rpc (<topic_prefix> when a custom prefix is set, <device_id> otherwise), false disables publishing. Default value: true.
  • status_ntf: boolean, if true notifications are published on <device_id|topic_prefix>/status/<component>:<id> (<topic_prefix> when a custom prefix is set, <device_id> otherwise), false disables publishing. Default value: false.
Example configuration object
{
"enable": false,
"server": null,
"user": null,
"pass": null,
"ssl_ca": null,
"topic_prefix": null,
"rpc_ntf": true,
"status_ntf": false
}