MQTT.SUBSCRIBE
Subcribes to the specified topics and places the incoming messages into the target.
Syntax
=MQTT.SUBSCRIBE(Connection, Topics, Target, [QoS], [MQTT V5 No Local], [MQTT V5 Retain as Published], [MQTT V5 Retain Handling], [MQTT V5 Properties], [Datatype])
Arguments
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
Connection | Connection | Connection to use for subscribing. | ||||||
Topics | Range or String | Topics to subscribe to. | ||||||
Target | Target | INBOX(), OUTBOX("MsgID") or a cell range where the incoming MQTT messages will be placed. | ||||||
QoS (optional) | QoS | Quality of Service. This option defines the reliability of the subscribe operation. It depends on the used protocol. Options: 0: At most once 1: At least once. 2: Exactly once. | ||||||
MQTT V5 No Local (optional) | Boolean | No Local MQTT V5 Flag. If set to true, this subscription will not receive message published on the same connection. | ||||||
MQTT V5 Retain as Published (optional) | Boolean | Retain as Published MQTT V5 Flag. | ||||||
MQTT V5 Retain Handling (optional) | RH | Retain Handling MQTT V5 Flag. Specifies, if the subscription will receive retained messages. Options: 0: Receive retained messages. 1: Receive new retained messages. 2: Don't receive retained messages | ||||||
MQTT V5 Properties (optional) | JSON | A JSON with one or more of the following properties:
| ||||||
Datatype (optional) | Datatype | Datatype of the incoming messages Options: "auto": Detect automatically "binary": Binary "json": JSON "string": String |
Return
Type | Description |
---|---|
Boolean or Error | TRUE, if no error. |
Examples
A | |
---|---|
1 | machines/1/# |
2 | machines/2/# |
3 | MQTT.SUBSCRIBE |
Formula | Result | Comment |
---|---|---|
| TRUE | Subscribe to the "machines/+/status" topic and write incoming messsages to the inbox of "Sheet2" |
| TRUE | Subscribe to the topics "machines/1/#" and "machines/2/#" with QoS 2 and and write incoming messsages to the inbox of "Sheet2" |