MQTT Publish

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

Target Sub-Category: IoT, IoT > ESP8266WiFi

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 input connector tabs:

      Enable: When the enable pin is high, the values entering the data pin are presented to the transmit queue. When the enable pin is zero, 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 mqttbroker.altairsmartcore.com for data exchange and mqtt.altairsmartcore.com for API.

Keep Alive: Specifies the keep alive period. That is, how often the client sends a PING message to the broker. 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.

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 SmartWorks, enter your-API-key/streams.

User Name: Specifies the user ID on the MQTT broker. This is used for authenticating with the broker. For SmartWorks, enter your API key.

Examples

See Examples > Blocks > Extensions > IOT.