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:
- ip: IP address of the MQTT broker. Default = '127.0.0.1'
- port: Port number used by the MQTT broker. Default = 1883
- retain: Retain published topics by the driver in the MQTT Broker. Default = True
- 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. Default: None
- 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. Default: None
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"
},
"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"}