MQTT protocol

BeamNG-MQTT integration

MQTT is a lightweight publish/subscribe messaging protocol for the Internet of Things (IoT). The integration of MQTT to BeamNG.tech renders possible to send data from BeamNG.tech to a MQTT broker, via a sample vehicle controller with help of the included luamqtt library.

How to use

  1. Prerequisite: Install the MQTT broker of your choice.
  2. Launch BeamNG.tech, select the level of preference and spawn the vehicle you want to send the data for.
  3. To add more data to the MQTT output, edit the function updateData in the file MQTToutput.lua.
  4. Open the BeamNG console (by pressing `) and switch to BeamNG - Current Vehicle in the bottom-left combobox.
  5. Write: controller.loadControllerExternal('tech/MQTToutput', 'MQTToutput', {uri = '127.0.0.1', topic='car_data'}) into the console to start exporting data to an MQTT server. Change the IP to the one you are using for the MQTT server.
  6. To stop, use the same console to execute the following command: controller.unloadControllerExternal('MQTToutput').
Last modified: May 20, 2024

Any further questions?

Join our discord
Our documentation is currently incomplete and undergoing active development. If you have any questions or feedback, please visit this forum thread.