MQTT.PUBLISH
Publishes either a message or an arbitrary value using a specified Producer and topic. To reference a message from the outbox use the outbox function and to reference a message from the inbox use INBOX.
Syntax
=MQTT.PUBLISH(Connection, MessageOrValue, Topic, [QoS], [Retain], [MQTT V5 Properties])
Arguments
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Connection | Connection | Connection to use for publishing. | ||||||||||||||||||
MessageOrValue | String | Either an existing message from the outbox or a value to publish. | ||||||||||||||||||
Topic | String | Topic that is appended to the base topic defined in the Connector. | ||||||||||||||||||
QoS (optional) | QoS | Quality of Service. This option defines the reliability of the publish operation. It depends on the used protocol. Options: 0: At most once 1: At least once. 2: Exactly once. | ||||||||||||||||||
Retain (optional) | Boolean | This option defines if the message should be retained on the broker. | ||||||||||||||||||
MQTT V5 Properties (optional) | JSON | A JSON with one or more of the following properties:
|
Return
Type | Description |
---|---|
Boolean or Error | TRUE, if no error. |
Examples
All examples assume a base topic with the value "/cedalo" in the connector.
A | B | |
---|---|---|
1 | parameter1 | 12.4 |
2 | parameter2 | 64.2 |
Formula | Result | Comment |
---|---|---|
| TRUE | This publishes a JSON object created by the json function using the "MQTT_Connection" and topic "cedalo/test" |
| TRUE | This publishes the string value "Message" using the "MQTT_Connection" under the topic "cedalo/test" |
| TRUE | This publishes the outbox message with id "Message" using the "MQTT_Connection" and topic "cedalo/test" |