Publishes a message to a MQTT topic.
A message is sent each time an event is received. The broker, topic and text of the message, among other parameters are configured in Settings -> Parameters. Most parameters may take on dynamic values through variable interpolation.
For example, the function could be used to publish a heartbeat message on some regular schedule.
in port is used to trigger the sending of a message. When an event is received on this port, the function will establish a connection to the broker, send the message, and finally disconnect.
After a message is successfully published, an event is routed to
If an error occurs during the process outlined above, then the process is aborted, and the occured error is routed to the
error port. (The connection is always properly closed, even if an error occurs.)
The recieved event is assumed to be an object. Variable interpolation in Settings -> Parameters may suppose further assumptions.
success port is the received event re-emitted.
In case of an error occurring, the value routed to the
error port will be the received event, but with the property
mqttErr added on. The purpose of this property is to provide some information about the error that has occured. The value assigned to this property may have any format. In general it is intended to be logged.
This function does not listen to nor emit any events.
If the broker requires authentication, then provide username and password in Settings -> Parameters. Otherwise can the auth field be left empty.
NOTE: authentication credentials are by default sent in plaintext in MQTT. Use a secure transport to protect credentials. The schemes URI
tls signifies to establish a secure connection over TLS to the broker.
Using variable interpolation, dynamic messages are easy to craft.
Updated 11 months ago