This document explains how to get Crimson 3.1 to talk to Mosquitto using the Generic MQTT Connector. For more details on the Crimson Cloud Connectors, please consult the Crimson User Manual.
CR3000 HMIs / Data Acquisition (DA10 & DA30) / FlexEdge™ (DA50D & DA70D) / Graphite® HMI / Graphite® Controllers
Transferring tag data to Mosquitto.
Crimson 3.1
Build 3106.000 or higher
For testing purposes, an outline database can be created as described in the Crimson Cloud Connectors: Creating an Outline Database Tech Note. The outline database will be referenced when configuring the connector.
Referring to Figure 1, perform the following:
1. Navigate to the Communications section and click on Generic MQTT under Connectors.
2. Click on the Service tab.
3. Set Enable Agent to Yes.
4. Set the Host Name 1 to the IP address of the PC running Mosquitto, 172.16.4.166 in this example.
5. Set the Subscription Topic to "device", this will be used later in the section.
6. Set Force into Root to Enabled.
7. Delete the User Name and Password.
8. Leave all other settings at default.
Figure 1.
Referring to Figure 2, perform the following:
9. Click on the Network tab.
10. Leave all other settings at default.
Figure 2.
Configure the Device Data and Tag Set tabs as required for the application. Figure 3 shows Tag Set 1 configured to send the values of Tag1-Tag4 to Mosquitto, as well as allowing writes.
Figure 3.
Download and install Mosquitto from http://mosquitto.org/download/
1. Start the broker, referring to Figure 4, open a command prompt and make sure you run as administrator.
Note: You absolutely need to make sure you run CMD as administrator and make sure you don’t have more than one instance of CMD open.
Figure 4.
2. Navigate to the Mosquitto root folder, such as C:\Program Files (x86)\mosquito by doing CD C:\Program Files (x86)\mosquitto
3. Start the Mosquitto service by running the command: net start mosquitto, refer to Figure 5.
Figure 5.
You should get the message The Mosquitto Broker service was started successfully.
1. Once Mosquitto is started, type mosquitto_sub.exe -t #.
2. Press the Enter key.
3. Referring to Figure 6, the data will start streaming into the command prompt window.
Figure 6.
* pressing Ctrl + c will stop the service.
1. Referring to Figure 7, type: mosquitto_pub -t device -m "{\"Tag1\":12345,\"Tag2\":54321}"
* "device" needs to match the subscription topic configured in Crimson.
* inside of the "{...}" is the message that will be published by mosquitto, in this example, it will set Tag1 to 12345 and Tag2 to 54321.
2. Press the Enter key.
Figure 7.
Starting with the release of Mosquitto version 2.0.0 the default config will only bind to localhost as a move to a more secure default posture.
If you want to be able to access the broker from other machines you will need to explicitly edit the config files to either add a new listener that binds to the external IP address (or 0.0.0.0) or add a bind entry for the default listener.
By default, it will also only allow anonymous connections (without username/password) from localhost, to allow anonymous from remote add:
allow_anonymous true
listener 1883