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: 12/1/2024 10:07

Any further questions?

Join our discord