Skip to content

MQTT Client

The mqtt.client module connects to a MQTT broker and emits a message messages based on the subscribed topic it receives from the port. This module is also capable of publishing MQTT messages to the connected broker.

  • typemqtt.client
  • params:
    • broker: the URL of the MQTT broker to connect to
    • clientId: the client ID to use when connecting to the MQTT broker
    • qos: (optional, default 0) the QoS level to use when publishing messages
    • retained: (optional, default false) whether to set the retained flag when publishing messages
    • topic: an MQTT topic to subscribe to

This module implements the PubSubModule interface.

Open a mqtt connection to test.mosquitto.org subscribing to the showbridge topic.

- id: mqttClient
type: mqtt.client
params:
broker: "mqtt://test.mosquitto.org:1833"
topic: showbridge
clientId: showbridge