Digital Input MQTT Function
The LucidIoT network I/O module offers many ways how measured data are accessible or how to control outputs of the device. Inputs can be transmitted via Modbus TCP/IP or the native JSON protocol. Beside of this it is also possible to log measured data to an internal file system and download the log file later.
Another way is to make data public by the MQTT protocol. A MQTT client can connect to a server and send out (publish) so called topics to the server or receive (subscribe) MQTT topics. The user can set up his own server like Mosquitto or us a service like Amazon AWS.
LucidIoT is available in many options and the configuration of the MQTT client depends on it. Here we show the configuration of the Digital Input MQTT function which is able to acquire 8 or 16 digital signals with 5V, 10V or 24V threshold levels.
Web Browser MQTT Client Configuration
The picture shows the topic section of the MQTT client configuration page. A topic can be configured as subscribe or publish. If configured as Publish type, the value of the digital input is sent to the MQTT server in the interval specified in PubInt.
The format of the value embedded into the MQTT protocol payload is specified by the parameter Format. MQTT payload in text based and the options available for digital inputs are highlighted. Values can be either “On” / “Off”, 1 / 0 or “true” / “false” depending on the configuration. If the digital input is counting events, the Numeric option can be used in order to transmit the counter value as integer.
With the Value Id parameter connects a topic with the digital input value by its channel number.
If the Format configuration does not match with the type of the channel specified in Value Id parameter, the Format configuration is ignored and the default (Auto) format is used.