MQTT Driver
This driver allows the communication between Simumatik and an MQTT broker to subscribe and modify the different variables.
Parameters
Aside from the common parameters described in the communication_driver docs, this driver includes:
Parameter | Default Value | Description |
---|---|---|
ip | '127.0.0.1' | IP address of the MQTT broker. |
port | 1883 | Port number used by the MQTT broker. |
retain | True | Retain published topics by the driver in the MQTT Broker. |
username | The username to authenticate with. Need have no relationship to the client id. Must be unicode [MQTT-3.1.3-11]. Set to None to reset client back to not using username/password for broker authentication. | |
password | The password to authenticate with. Optional, set to None if not required. If it is unicode, then it will be encoded as UTF-8. | |
enable_ssl_tls | False | Enables SSL/TLS support. |
Setup data
The setup data will give values to the parameters required and will specify the I/O variables info.
{
"parameters": {
"ip": "192.168.1.23",
"port": 1883,
"retain": true,
"username": "example_name",
"password": "secure_password",
"enable_ssl_tls": false
},
"variables": {
"workspace/light_sensor": {
"datatype": "str",
"size": 1,
"operation": "write"
},
"workspace/lamp": {
"datatype": "str",
"size": 1,
"operation": "read"
}
}
}
note
The setup_params in the generic PLC components for mqtt_client will need the following format:
{
"ip": "192.168.1.23",
"port": 1883,
"retain": true,
"username": "example_name",
"password": "secure_password",
"enable_ssl_tls": false
}