Skip to content

MQTT Client

The MQTT protocol is intended primarily for the exchange of data between Internet of Things devices and servers and client devices, eg smartphones.

Its main advantage is maintaining a connection in both directions, thanks to which it is possible to easily control the Lan Controller in the local network from the telephone in the operator's local network.

MQTT Client

Elements of page

  1. Connection status with the MQTT broker.
  2. A part of MAC address of the device that the client uses as a clientID when connecting to the broker.
  3. Connection configuration form.
    • Enabling the MQTT client.
    • Enable user/password authentication.
    • Use TLS.
    • Use LWT (to publish connection state on prefix/connected topic, 1 - connected, 0 - disconnected).
    • Send by GSM modem (instead of Ethernet connection).
    • The server address can be given as the IP address or the host name.
    • The communication port, used by default for connections without encryption, is 1883.
    • Login/username used for authentication.
    • Password used for authentication.
    • Prefix is ​​a base part of the topics used by LK. All sending topics and subscription topic begin with the prefix.
    • It defines period of time between consequent send of data selected in section 4.
    • Specifies the keep-alive parameter for the connection.
  4. Reading fields that can be sent by LK periodically (mark the desired readings).
  5. Readings that will be sent on change.
  6. Buttons for saving settings and a link to, which allows you to use the MQTT client on LK. service

The service is free and allows you to connect up to 5 devices.

Data from connected devices are archived and available for viewing on charts.

It is also possible to define events similar to those on LC3, with conditions that can include multiple devices - an event on one can be used to control others.

Using the MQTT WebSocket client available on the website, you can remotely control your devices. There is also a mobile application that allows you to view readings and control devices.


Note about saving the form

Login and password fields are required even if you do not use authentication due to certain assumptions on the device side. Therefore, you should enter anything in the fields mentioned above, eg a space.

Note about LK 3.0

LK 3.0 does not support TLS, LWT function and sending readings on change of their state.

MQTT commands

You can send commands to Lan Controller via the MQTT protocol. They have to be send on the topic <Topic prefix> /cmd, and confirmations/replies from LK can be recieved on the topic <Topic prefix>/cmdr.

The following commands are available (as of version SW 1.44):

  • outX=1 - turn on the output, where X is the output number (0 - 5)
  • outX=0 - turn off the output, where X is the output number (0 - 5)
  • pwmX=1 - turn on the PWM output, where X is the PWM output number (0 - 3)
  • pwmX=0 - turn off the output PWM, where X is the PWM output number (0 - 3)
  • pwmfX=Y - set the PWM frequency, where X specifies the group of PWM outputs (0 for PWM0, 1 for PWM1-PWM3), and Y is the frequency in Hz (50-100000)
  • pwmdX=Y - set the fill factor for the output, where X is the PWM output number (0 - 3), and Y is the value in percent (0-100)
  • eventX=Y - set the value of the virtual variable EVENT, where X specifies the variable number (1-8) and Y specifies the value (0 or 1)
  • read - send all readings selected for periodic sending via MQTT (action does not affect periodic sending)

Last update: 2021-09-29
Back to top