iot-simulator-cli
v1.0.4
Published
CLI-based IoT device simulator for MQTT and RabbitMQ with interactive device control, telemetry generation, and config-driven virtual device simulation.
Readme
🐇 IoT Simulator CLI
A CLI-based IoT device simulator built with Node.js and RabbitMQ (MQTT). This tool allows users to generate device configurations, simulate virtual IoT devices, and interact with them directly from the terminal.
🚀 Features
- CLI-based IoT device simulation
- MQTT communication using RabbitMQ
- Interactive terminal device control
- Dynamic telemetry payload generation
- Config-driven simulation architecture
- JSON-based device configurations
- Runtime device interaction shell
⚙️ Installation
Install dependencies:
npm installInstall CLI globally from project root:
npm install -g .🐳 RabbitMQ Setup (Docker)
This project includes a Docker Compose setup for running RabbitMQ with MQTT support enabled.
Start RabbitMQ
Build and start the RabbitMQ container:
docker-compose up -d --buildThis will:
- Build the RabbitMQ image
- Enable MQTT support
- Start RabbitMQ in detached mode
- Expose MQTT and Management UI ports
Stop RabbitMQ
docker-compose downReset RabbitMQ Data
To remove all persisted RabbitMQ data:
docker-compose down -vThen start again:
docker-compose up -d --buildRabbitMQ Management UI
Access the management dashboard:
http://localhost:15672Credentials are loaded from:
rabbitmq.envExposed Ports
| Port | Purpose | | ----- | ---------------------- | | 5672 | AMQP | | 15672 | RabbitMQ Management UI | | 1883 | MQTT |
🛠 Available Commands
Create Device Configuration
Generate a new device configuration interactively:
iot-sim device createThis creates a device configuration JSON file with default MQTT topics, payload generators, and simulation settings.
Generated configs are stored in:
./devices/Generate Device Template
Generate a reusable device template configuration:
iot-sim device template <deviceId>Example:
iot-sim device template sensor01This creates a template-based configuration file for the provided device ID.
Start Device Simulator
Start a virtual IoT device simulator:
iot-sim device start <deviceId>Example:
iot-sim device start sensor01The simulator loads the device configuration, connects to RabbitMQ using MQTT, and starts publishing/subscribing to device topics.
💻 Interactive Device Shell
Once a device simulator starts, an interactive terminal shell is opened for runtime control.
Example operations:
- Publish telemetry
- Check device status
- Simulate reconnects
- Trigger failures
- Stop device simulation
🔄 How It Works
- Device configurations are stored as JSON files
- CLI commands initialize virtual devices
- Devices connect to RabbitMQ via MQTT
- Telemetry payloads are dynamically generated
- Interactive shell allows live device control
📁 Configuration Driven
Each simulated device is fully config-driven and contains:
- Device identity
- MQTT credentials
- Topic mappings
- Payload generators
- Simulation intervals
This enables scalable IoT simulation without modifying source code.
🧠 Use Cases
- MQTT testing
- IoT backend development
- Event-driven architecture testing
- RabbitMQ integration testing
- Local IoT environment simulation
- Device telemetry emulation
📄 License
This project is licensed under the MIT License.
