MQTT Publish

Target Category: Arduino, Generic MCU, Linux AMD64 and Raspberry Pi

Target Sub-Category:  IoT > ESP8266WiFi

Block Sub-Category: Extensions > IoT

Description: The MQTT Publish block publishes messages on the specified topic from your hardware to the Message Queuing Telemetry Transport (MQTT) broker. The broker is primarily responsible for receiving all messages, filtering messages, deciding who is interested in the messages, and publishing the messages to all subscribed clients.

The MQTT Publish block has two inputs:

      Enable: When the enable pin is high, the values entering the data pin are presented to the transmit queue. When the enable pin is 0, values entering the data pin are ignored.

      Data: Accepts the string to be published to the cloud.

Host Name: Specifies the MQTT broker address. For SmartWorks, use mqtt.swx.altairone.com.

Keep Alive: Specifies the maximum time interval between when the client finishes sending a PING message to the broker and starts to send the next PING message. The maximum time interval is 18 hours, 12 minutes, and 15 seconds. When Keep Alive is set to 0, the keep alive mechanism is de-activated and Last Will and Testament is ignored. The default time interval is 60 sec.

Last Will and Testament

Message: Specifies the last will message to be sent to subscribers. If the broker detects that the publisher has unexpectedly disconnected, it sends the last will message to all subscribers of the specified topic.

Retain last will message on server: Retains the last will message if the publisher unexpectedly disconnects.

Will QoS: Specifies the quality of service to the broker. Your choices are:

0: Sends the message once with no guarantee of delivery. The broker does not acknowledge delivery.

1: Guarantees message delivery, but it could send duplicates. The broker acknowledges delivery.

2: Guarantees message delivery without duplicates. The broker acknowledges delivery, then both the broker and publisher discard the stored messages.

Password: Specifies the user password. This is used for authenticating with the broker. As you type the password into the Password parameter, the typed characters are converted to dots.

Port: Indicates the port that the broker is using. The default unencrypted port is 1883; the default encrypted port is 883.

QoS: Specifies the quality of service to the server. Your choices are:

0: Sends the message once with no guarantee of delivery. The server does not acknowledge delivery.

1: Guarantees message delivery, but it could send duplicates. The server acknowledges delivery.

2: Guarantees message delivery without duplicates. The server acknowledges delivery, then both the server and publisher discard the stored messages.

Retain last message on server: Retains the last message if the publisher unexpectedly disconnects.

Topic: Specifies the topic on which the message is to be published. For example, spaces/smartwork/categories/mqtt/things/01GKPF0X8JKAFVFDNCA42PVGS/data

User Name: Specifies the account user name attached to your device. This is used for authenticating with the broker. For example Embed@smartwork.

Examples

See Examples > Blocks > Extensions > IoT.