Harshana's Dummy MQTT Client for SIT725
A lightweight Node.js simulator that emulates multiple BBQ devices by sending MQTT messages to a broker. Useful for testing real-time IoT integrations in the BBQ Tracker project.
- Simulates multiple virtual BBQ devices.
- Sends randomised temperature and sensor data every 5 seconds.
- Publishes to the
bbq/statustopic via MQTT. - Easily configurable device list and broker address.
- Node.js installed.
- An MQTT broker installed and running (default:
mqtt://localhost:1883).- We recommend Mosquitto as a lightweight and widely supported MQTT broker.
If you don’t already have an MQTT broker installed, you can install Mosquitto as follows:
brew install mosquitto
brew services start mosquittosudo apt update
sudo apt install mosquitto mosquitto-clients
sudo systemctl enable mosquitto
sudo systemctl start mosquittoDownload the installer from the official site:
👉 https://mosquitto.org/download/
After installation, start the Mosquitto broker using:
mosquittoTo check that the broker is working, run the following in a new terminal:
mosquitto_sub -h localhost -t bbq/statusThen start the MQTT dummy client. You should see the published messages in the subscriber terminal.
git clone https://github.com/your-username/MQTT_dummy.git
cd MQTT_dummy
npm installStart the MQTT simulator:
node mqttClient.jsYou should see terminal output showing status messages being published from each simulated device.
-
MQTT Broker URL:
To change the broker address, update this line inmqttClient.js:const client = mqtt.connect('mqtt://localhost:1883');
-
Device IDs:
Modify thedeviceIdsarray inmqttClient.jsto simulate different or more devices:const deviceIds = ['bbq-001', 'bbq-002', 'bbq-003'];
-
Message Format:
You can customise the message payload structure in thesetInterval()function wherestatusMessageis constructed.
This project is licensed under the ISC License.