MQTT
The MQTT driver will communicate with
a control device through the MQTT Protocol.
General Settings
. Host/IP: Insert the Host/IP address of the controller
. Port: Insert the Port of the controller
. Enable: Activates or deactivates the Driver Document
- True: The document will be always activated
- Condition: Activates the document whenever the condition is fulfilled
- False: The document will never activate
MQTT
. Client ID: Insert the ID of the MQTT
. User: Insert the User of the MQTT
. Password: Insert the Password of the MQTT
Read
. Enable: Activates or deactivates the Driver Document
- True: The document will be always activated
- Condition: Activates the document whenever the condition is fulfilled
- False: The document will never activate
Write
. Trigger: If checked, will write all the inputs every time a configured tag changes its value. Select the desired tag to use as a Trigger in the TextBox beside it.
. Tag Changed: If checked, will write an input every time its linked tag (of the Tag List) changes.
Tag List
When opening a Driver Document, it will display Driver options in the Ribbon where it is possible to create and delete Driver Items.
A Driver Item is what links a Tag from SmartView to an Input or Output of a Controller.
Once a new Driver Item is inserted, the user will have four fields to configure:
. Tag: Write the Tag that is going to be associated with the specific address
. Topic: Write the Topic name
. QoS: Select the QoS level from the list
- 0: At most once - the message is sent only once and the client and broker take no additional steps to guarantee the delivery, also known as "fire and forget".
- 1: At least once - it guarantees that a message is delivered at least one time to the receiver, also known as "acknowledged delivery".
- 2: Exactly once - the sender and receiver engage in a four-part handshake to ensure only one copy of the message is received also known as "assured delivery".
. Retain: The broker can retain the last message to each topic if the client chooses to do so, and every time any client subscribes to that same topic it will receive the retained message.
Example:
This is an example of how to configure the communication with SmartView and the client site http://www.hivemq.com/demos/websocket-client/ on the same server.
In the Site:
01. Enter in the site http://www.hivemq.com/demos/websocket-client/
02. Click the Connect button
03. Change Topic field for testtopic/1000000
04. Add New Topic Subscription with topic testtopic/1000000
In SmartView:
01. Create newtag1, String in the Tags Document.
02. Create Mqtt folder in Driver.
03. Create Driver1 document inside Mqtt folder.
04. Write broker.mqttdashboard.com in Host/Ip.
05. Write 1883 in Port.
06. Select True in Enable Read
07. Check Tag Changed in Enable Write
08. Write newtag1 on Tag cell
09. Write testtopic/1000000 on Topic cell
10. Run the application
Here is an example of a configured document: