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
- Prerequisite: Install the MQTT broker of your choice.
- Launch BeamNG.tech, select the level of preference and spawn the vehicle you want to send the data for.
- To add more data to the MQTT output, edit the function
updateData
in the fileMQTToutput.lua
. - Open the BeamNG console (by pressing
`
) and switch toBeamNG - Current Vehicle
in the bottom-left combobox. - 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. - To stop, use the same console to execute the following command:
controller.unloadControllerExternal('MQTToutput')
.