iot-simulator
The simulator requires the following software to be previously installed:
- RabbitMQ with the following plugins:
rabbitmq_mqtt
rabbitmq_management
- NodeJS
To enable the RabbitMQ plugins, run:
rabbitmq-plugins enable rabbitmq_mqtt rabbitmq_management rabbitmq_web_stomp
After installing its dependencies, the simulator can be run:
npm install
npm run watch
After installing its dependencies, the user interface can be run:
npm install
npm start
With Docker and docker-compose installed, run:
docker-compose up --build
The simulator
directory has automated tests.
In order to run them, make sure you have a RabbitMQ server running and have specific the environment variables in .env
.
Afterwards, run npm test
and tests will run and show a coverage report.
The simulator
directory has example scenarios that can be used to quickly setup an environment.
Before running, make sure you have a RabbitMQ instance running. Running multiple scenarios at the same time may create inconsistencies.
In order to run them, run npm run example <path-to-example>
. When trying to run the example named twoThings.ts
, the following commmand would have to be executed npm run example examples/twoThings.ts
.
Note: in some cases, TypeScript compilation may be slower than running the example. If this happens, you should try again.
- Added a special "Simulated"
@type
that represents a simulated device. - Added
id
field to Web Thing description.
In order for the simulator proxying to work, there must be two different virtual hosts. Once vhost will host the reading of messages by the devices, while the other will host the writing. The simulator's proxy will take care of routing between both.
The TOML API is defined here. The mathematical operations use mathjs for evaluating and parsing. This may pose some security issues. To obtain more information, read the security implications.
To build a generator, it's possible to use a cron expression. The specific parser is this one. You can read more about cron expressions in the Wikipedia page. However, you should note that a seconds
field was prepended to the expression explained in the Wikipedia page.